Запустить приложение с помощью ShellExecute и подождать
Материал из DRKB
Запустить приложение с помощью ShellExecute и подождать[править | править код]
var
exInfo: TShellExecuteInfo;
begin
FillChar(exInfo, Sizeof(exInfo), 0);
with exInfo do
begin
cbSize := Sizeof(exInfo); // required!
fMask := SEE_MASK_NOCLOSEPROCESS;
Wnd := Handle; // forms handle
lpVerb := 'paintto';
lpFile := PChar(pdffilename);
lpParameters := PChar(printernameAndPort);
nShow := SW_HIDE;
end;
if ShellExecuteEx(@exInfo) then
begin
while GetExitCodeProcess(exinfo.hProcess, exitcode) and (exitcode = STILL_ACTIVE) do
Sleep(500);
CloseHandle(exinfo.hProcess);
DeleteFile(pdffilename);
end
else
ShowMessage(SysErrorMessage(GetLastError));
ID: 02151