Search results for 'File Association'. 1 post(s) found.
- 2007/08/25 How To Register Own File Types
Use the registry to register your own filetype
uses registry;
procedure TForm1.RegisterFileType(prefix:String; exepfad:String);
var
reg:TRegistry;
begin
reg:=TRegistry.Create;
reg.RootKey:=HKEY_CLASSES_ROOT;
//create a new key --> .pci
reg.OpenKey('.'+prefix,True);
//create a new value for this key --> pcifile
reg.WriteString('',prefix+'file');
reg.CloseKey;
//create a new key --> pcifile
reg.CreateKey(prefix+'file');
//create a new key pcifile\DefaultIcon
reg.OpenKey(prefix+'file\DefaultIcon',True);
//and create a value where the icon is stored --> c:\project1.exe,0
reg.WriteString('',exepfad+',0');
reg.CloseKey;
reg.OpenKey(prefix+'file\shell\open\command',True);
//create value where exefile is stored --> c:\project1.exe "%1"
reg.WriteString('',exepfad+' "%1"');
reg.CloseKey;
reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
RegisterFileType('pci','c:\project1.exe');
end;
procedure TForm1.RegisterFileType(prefix:String; exepfad:String);
var
reg:TRegistry;
begin
reg:=TRegistry.Create;
reg.RootKey:=HKEY_CLASSES_ROOT;
//create a new key --> .pci
reg.OpenKey('.'+prefix,True);
//create a new value for this key --> pcifile
reg.WriteString('',prefix+'file');
reg.CloseKey;
//create a new key --> pcifile
reg.CreateKey(prefix+'file');
//create a new key pcifile\DefaultIcon
reg.OpenKey(prefix+'file\DefaultIcon',True);
//and create a value where the icon is stored --> c:\project1.exe,0
reg.WriteString('',exepfad+',0');
reg.CloseKey;
reg.OpenKey(prefix+'file\shell\open\command',True);
//create value where exefile is stored --> c:\project1.exe "%1"
reg.WriteString('',exepfad+' "%1"');
reg.CloseKey;
reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
RegisterFileType('pci','c:\project1.exe');
end;
Another posts included in "Delphi"
| How To Force The Correct Decimal Separator (0) | 2007/08/25 |
| How To Change Screen Resolution (0) | 2007/08/25 |
| How To Check If A Soundcard Is Installed (0) | 2007/08/25 |
| How To Get Volume Name (0) | 2007/08/25 |
| How To Get Windows And System Directory (0) | 2007/08/25 |
| Get The Drive Type (0) | 2007/08/25 |
| How can I modify aliases programmatically ? (0) | 2007/08/25 |
| Setting TQuery SQL Statement (0) | 2007/08/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 04:29
moneyideas
-
Subject different money making ideas
2010/01/29 13:33
moneyideas
-
Subject different money making ideas
2010/01/31 16:44
moneyideas

Prev

Rss Feed