Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Following example shows an example I implemented

Code Block
languagedelphi
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;

...