procedure xxxx;
var
ShExecInfo: SHELLEXECUTEINFO;
WaitResult: DWORD;
APath:string;
begin
ShExecInfo.fMask := SEE_MASK_NOCLOSEPROCESS ;
ShExecInfo.wnd := 0;
ShExecInfo.lpVerb := nil;
ShExecInfo.lpFile := pChar(APath); //can be a file as well
ShExecInfo.lpDirectory := '';
ShExecInfo.nShow := SW_HIDE;
ShExecInfo.hInstApp := 0;
ShellExecuteEx(@ShExecInfo);
if (ShExecInfo.hProcess <> 0) then
begin
repeat
WaitResult := WaitForSingleObject(ShExecInfo.hProcess, 100);
until WaitResult <> WAIT_TIMEOUT;
ShExecInfo.hProcess := 0;
end;
end;
var
ShExecInfo: SHELLEXECUTEINFO;
WaitResult: DWORD;
APath:string;
begin
APath := ExtractFilePath(ParamStr(0))+'xxx.exe';
ShExecInfo.fMask := SEE_MASK_NOCLOSEPROCESS ;
ShExecInfo.wnd := 0;
ShExecInfo.lpVerb := nil;
ShExecInfo.lpFile := pChar(APath); //can be a file as well
ShExecInfo.lpDirectory := '';
ShExecInfo.nShow := SW_HIDE;
ShExecInfo.hInstApp := 0;
ShellExecuteEx(@ShExecInfo);
if (ShExecInfo.hProcess <> 0) then
begin
repeat
WaitResult := WaitForSingleObject(ShExecInfo.hProcess, 100);
until WaitResult <> WAIT_TIMEOUT;
ShExecInfo.hProcess := 0;
end;
end;