Ver Mensaje Individual
  #4  
Antiguo 30-11-2011
Avatar de duilioisola
[duilioisola] duilioisola is offline
Miembro Premium
 
Registrado: ago 2007
Ubicación: Barcelona, España
Posts: 1.735
Reputación: 20
duilioisola Es un diamante en brutoduilioisola Es un diamante en brutoduilioisola Es un diamante en bruto
Mira esto:

Código Delphi [-]
{Execute a program and wait until it has finished. The following example uses the ShellExecuteEx API function.}

 // Execute the Windows Calculator and pop up
 // a message when the Calc is terminated.
 uses ShellApi;
 ...
 var
    SEInfo: TShellExecuteInfo;
    ExitCode: DWORD;
    ExecuteFile, ParamString, StartInString: string;
 begin
    ExecuteFile:='c:\Windows\Calc.exe';
 
    FillChar(SEInfo, SizeOf(SEInfo), 0) ;
    SEInfo.cbSize := SizeOf(TShellExecuteInfo) ;
    with SEInfo do begin
      fMask := SEE_MASK_NOCLOSEPROCESS;
      Wnd := Application.Handle;
      lpFile := PChar(ExecuteFile) ;
 {
 ParamString can contain the
 application parameters.
 }
 // lpParameters := PChar(ParamString) ;
 {
 StartInString specifies the
 name of the working directory.
 If ommited, the current directory is used.
 }
 // lpDirectory := PChar(StartInString) ;
      nShow := SW_SHOWNORMAL;
    end;
    if ShellExecuteEx(@SEInfo) then begin
      repeat
        Application.ProcessMessages;
        GetExitCodeProcess(SEInfo.hProcess, ExitCode) ;
      until (ExitCode <> STILL_ACTIVE) or
    Application.Terminated;
      ShowMessage('Calculator terminated') ;
    end
    else ShowMessage('Error starting Calc!') ;
 end;
Responder Con Cita