Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
Delphi 10.2 Tokyo Professional
|
Re: InstallExt - Icon ändern
10. Okt 2004, 15:44
Code :
Delphi-Quellcode:
function InstallExt(Extension, ExtDescription, FileDescription,
OpenWith, ParamString: String; IconIndex: Integer): Boolean;
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
try
with Reg do
begin
RootKey := HKEY_CLASSES_ROOT;
OpenKey(Extension, True);
WriteString('', ExtDescription);
CloseKey;
OpenKey('\' + ExtDescription, True);
WriteString('', FileDescription);
CloseKey;
OpenKey('DefaultIcon', True);
WriteString('', OpenWith + ','+IntToStr(IconIndex));
CloseKey;
OpenKey('\' + ExtDescription + '\Shell\Open\Command', True);
WriteString('', '"' + OpenWith + '" "' + ParamString + '"');
CloseKey;
end;
Result := True;
except
Result := False;
end;
finally
Reg.Free;
end;
end;
Aufruf (in Form.Create) :
InstallExt('.xyz', 'xyz-Datei', 'Irgendein Format', Application.ExeName, '%1',0);
Michael
|
|
Zitat
|