Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Extensions

Posted on 1999-07-19
2
Medium Priority
?
130 Views
Last Modified: 2010-04-06
Is there a way to enter a file extension into the registry such that whenever the user clicks on a file with a certain extension, it will open up my program to edit the file.
0
Comment
Question by:jackjoker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
Lischke earned 20 total points
ID: 1389494
procedure RegisterFile;

var Reg: TRegistry;

begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_CLASSES_ROOT;
    Reg.OpenKey('\.xxx', True);
    Reg.WriteString('', 'MyProgram');
    Reg.OpenKey('\MyProgram', True);
    Reg.WriteString('', 'a very special file');
    Reg.OpenKey('\MyProgram\DefaultIcon', True);
    Reg.WriteString('', Application.ExeName + ', 1');
    Reg.OpenKey('\MyProgram\Shell\open\command', True);
    Reg.WriteString('', Application.ExeName + ' "%1"');
    ShowMessage('successfully registered');
  finally
    Reg.Free;
  end;
end;

Ciao, Mike
0
 
LVL 17

Expert Comment

by:inthe
ID: 1389495
hi,
not quick enough :-(
this comment was originally from someone else and it works so thanks to them although is same as answer

Let's say you want to register the extension "*.vif" for a "very important file".

(1) Create a new key "HKEY_CLASSES_ROOT\.vif".
(2) Set "HKEY_CLASSES_ROOT\.vif\(default)" to "veryImportantFile". (don't write to the value "(default)", instead write to "").
(3) Create a new key "HKEY_CLASSES_ROOT\veryImportantFile\shell\open\command".
(4) Set "HKEY_CLASSES_ROOT\veryImportantFile\shell\open\command\(default)" to "c:\yourAppPath\yourApp.exe %1".
(5) Create a new key "HKEY_CLASSES_ROOT\veryImportantFile\defaultIcon".
(6) Set "HKEY_CLASSES_ROOT\veryImportantFile\defaultIcon\(default)" to e.g. "c:\yourAppPath\yourApp.exe,1"
 or another icon resource. The ",1" is the icon index in your exefile for the document icon.


Regards Barry
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question