Ver Mensaje Individual
  #3  
Antiguo 05-09-2008
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Reputación: 20
cHackAll Va por buen camino
Considero más apropiado usar la API ShellExecuteEx especificando SEE_MASK_NOCLOSEPROCESS en su estructura para obtener en la misma el manejador (hProcess), del proceso creado... ésto obviamente para que mediante la API WaitForSingleObject podamos saber si el proceso creado está en ejecución.

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var ShellExecuteInfo: TShellExecuteInfo;
begin
 with ShellExecuteInfo do
  begin
   cbSize := SizeOf(ShellExecuteInfo);
   fMask := SEE_MASK_NOCLOSEPROCESS;
   Wnd := Handle;
   lpVerb := 'open';
   lpFile := PChar(Path + '\' + PiezaenRed(PzpedidosREF_N.AsString) + '.pdf');
   lpParameters := nil;
   lpDirectory := nil;
   nShow := SW_HIDE;
  end;
 ShellExecuteEx(@ShellExecuteInfo);
 WaitForSingleObject(ShellExecuteInfo.hProcess, INFINITE);
 MessageBox(0, 'Done!', nil, 0);
end;

Saludos
__________________
RTFM > STFW > Foro > Truco > Post > cHackAll > KeBugCheckEx
Responder Con Cita