function WinExecute(CmdLine: string; Wait: Boolean): Boolean;
var
StartupInfo: TStartupInfo;
ProcessInformation: TProcessInformation;
begin
Result := True;
try
FillChar(StartupInfo, SizeOf(StartupInfo), 0);
StartupInfo.cb := SizeOf(StartupInfo);
if not CreateProcess(nil, PChar(CmdLine), nil, nil, True, 0, nil,
nil, StartupInfo, ProcessInformation) then
RaiseLastWin32Error;
if Wait then
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
except
Result := False;
end;
end;
|