API - abrir a tela do windows abrir com

Top  Previous  Next

uses

  ShellApi;

 

procedure OpenWith(FileName: string);

begin

  ShellExecute(Application.Handle, 'open', PChar('rundll32.exe'),

    PChar('shell32.dll,OpenAs_RunDLL ' + FileName), nil, SW_SHOWNORMAL);

end;

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  OpenWith('c:\x.txt');

end;