unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ShellApi;
type
TForm1 =
class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure ShowShellPropertiesDlg(
const APath:
string);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text := '
C:\WINDOWS\system32\userinit.exe';
try
ShowShellPropertiesDlg(Edit1.Text);
except
MessageBox(
Handle, '
Exception', '
Test', 0);
end;
end;
procedure TForm1.ShowShellPropertiesDlg(
const APath:
string);
var
AExecInfo: ShellAPI.TShellExecuteinfo;
// info passed to ShellExecuteEx
begin
FillChar(AExecInfo, SizeOf(AExecInfo), 0);
AExecInfo.cbSize := SizeOf(AExecInfo);
AExecInfo.lpFile := PChar(APath);
AExecInfo.lpVerb := '
properties';
AExecInfo.fMask := ShellAPI.SEE_MASK_INVOKEIDLIST;
ShellAPI.ShellExecuteEx(@AExecInfo);
//<----------------- EXE weg!!!!
end;
end.