Hey allesammen,
Hvad skal jeg skrive af code for at kunne lave mit program default for filer?
(i mit program ikke i windows/registrerings databasen)
Ken Christensen
Christensenken@hotmail.com
www.Kenchristensen.tk
Nedenstående snip viser hvorledes du kan gøre det
Var
Reg : TRegistry;
Begin
Reg := TRegistry.Create;
try
with Reg do
begin
RootKey := HKEY_CLASSES_ROOT;
OpenKey('MyApp', True);
WriteString('', 'MyApp File');
CloseKey;
OpenKey('MyAppDefaultIcon', True);
// The first parameter below MUST be a blank string
// The last parameter is the icon in your EXE file to use.
WriteString('', Application.ExeName + ',0');
CloseKey;
OpenKey('MyAppshellopencommand', True);
WriteString('', Application.ExeName + ' "%1"');
CloseKey;
RootKey := HKEY_CLASSES_ROOT;
OpenKey('.ext', True); //substitute .ext with
//the extension you desire
WriteString('', 'MyApp');
CloseKey;
end;
finally
Reg.CloseKey;
Reg.Free;
end;
End;