When user register a application by user choice, there are some registry entries automatically created by windows. By doing the same behaviors like windows, application can be launched automatically by click the associated files.Following example shows an example I implemented
uses System.Win.Registry;
.
.
.
Procedure TForm1.FormCreate(Sender: TObject);
begin
with TRegistry.Create do
try
RootKey := HKEY_CURRENT_USER;
if OpenKey('Software\Classes\.kes', true) then begin
WriteString('', '.kes_auto_file');
end;
finally
Free;
end;
with TRegistry.Create do
try
RootKey := HKEY_CURRENT_USER;
if OpenKey('Software\Classes\.kes_auto_file\shell\open\command', true) then begin
WriteString('', '"' + ParamStr(0) + '" "%1"');
end;
finally
Free;
end;
with TRegistry.Create do
try
RootKey := HKEY_CURRENT_USER;
if OpenKey('Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.kes\UserChoice', true) then begin
WriteString('', 'Applications\EmployeeSurvey.exe');
WriteString('ProgId', '.kes_auto_file');
end;
finally
Free;
end;
end;