Einzelnen Beitrag anzeigen

kabuco
(Gast)

n/a Beiträge
 
#4

Re: RunAndWait in For-Schleife

  Alt 16. Jul 2006, 13:32
Hallo,

hier die Funktion, die ich verwende:
Delphi-Quellcode:
procedure TForm6.RunAndWaitShell(Executable, Parameter: STRING; ShowParameter: INTEGER);
var
  Info: TShellExecuteInfo;
  pInfo: PShellExecuteInfo;
  exitCode: DWord;
begin
  {Pointer to Info}
  pInfo := @Info;
  {Fill info}
  with Info do
  begin
    cbSize := SizeOf(Info);
    fMask := SEE_MASK_NOCLOSEPROCESS;
    wnd := application.Handle;
    lpVerb := NIL;
    lpFile := PChar(Executable);
    {Parametros al ejecutable}
    {Executable parameters}
    lpParameters := PChar(Parameter + #0);
    lpDirectory := NIL;
    nShow := ShowParameter;
    hInstApp := 0;
  end;
  {Execute}
  ShellExecuteEx(pInfo);

  {Wait to finish}
  repeat
    exitCode := WaitForSingleObject(Info.hProcess, 500);
    Application.ProcessMessages;
  until (exitCode <> WAIT_TIMEOUT);
end;
Wie zu sehen ist, hat die Funktion keinen Rückgabewert. Man könnte aber einen einbauen, nur weiß ich jetzt leider nicht, wo ich den Rückgabewert setzen muss!?

gruß kabuco
  Mit Zitat antworten Zitat