Registriert seit: 21. Dez 2002
Ort: Lenzburg
861 Beiträge
Delphi 6 Professional
|
24. Apr 2003, 09:30
KLICK
Delphi-Quellcode:
uses Registry;
...
function InstallExt(Extension, ExtDescription, FileDescription,
OpenWith, ParamString: String; IconIndex: Integer): Boolean;
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
with Reg do
begin
RootKey := HKEY_CLASSES_ROOT;
OpenKey(Extension, True);
WriteString('', ExtDescription);
OpenKey('\' + ExtDescription, True);
WriteString('', FileDescription);
OpenKey('DefaultIcon', True);
WriteString('', OpenWith + ','+IntToStr(IconIndex));
OpenKey('\' + ExtDescription + '\Shell\Open\Command', True);
WriteString('', '"' + OpenWith + '" "' + ParamString + '"');
end;
Result := True;
except
Result := False;
end;
Reg.Free;
end;
function UnInstallExt(Extension, ExtDescription: String): Boolean;
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
with Reg do
begin
RootKey := HKEY_CLASSES_ROOT;
DeleteKey(Extension);
DeleteKey('\' + ExtDescription);
end;
Result := True;
except
Result := False;
end;
Reg.Free;
end;
...
InstallExt('.xyz', 'XYZ Datei', 'Tolles Programm', Application.ExeName, '%1',0);
UnInstallExt('.xyz', 'XYZ Datei');
von Johannes Tränkle
***
Gruss Mirilin
Tobias Die Physik ist für die Physiker eigentlich viel zu schwer.
|
|
Zitat
|