
Delphi - ShellExecute
Zdravím.
Nepomuže někdo?.
procedure TForm1.Button2Click(Sender: TObject);
begin
ShellExecute_AndWait ('c:\Windows\notepad.exe');
Beep;
end;
Procedure ShellExecute_AndWait(FileName : String);
var
exInfo : TShellExecuteInfo;
Ph : DWORD;
begin
FillChar( exInfo, Sizeof(exInfo), 0 );
with exInfo do
begin
cbSize:= Sizeof( exInfo );
fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT;
Wnd := GetActiveWindow();
ExInfo.lpVerb := 'open';
lpFile:= PChar(FileName);
nShow := SW_SHOWNORMAL;
end;
if ShellExecuteEx(@exInfo) then
begin
Ph := exInfo.HProcess;
end
else
begin
ShowMessage(SysErrorMessage(GetLastError));
exit;
end;
while WaitForSingleObject(ExInfo.hProcess, 50) <> WAIT_OBJECT_0 do
Application.ProcessMessages;
CloseHandle(Ph);
end;
Potřebuji ale spustit soubor s parametrem.
ShellExecute(handle,'open',PChar(filename), PChar(parameters),'',SW_SHOWNORMAL);
Volat tu proceduru takto.
procedure ShellExecute_AndWait(FileName : String; parameters : String);
V proceduře je lpFile:= PChar(FileName);
Tak pod to přidam
parametr := PChar(parameters);
A ze zbytkem bych potřeboval pomoct.