AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi warten bis ShellExecute beendet ist
Thema durchsuchen
Ansicht
Themen-Optionen

warten bis ShellExecute beendet ist

Ein Thema von eddy · begonnen am 14. Aug 2004 · letzter Beitrag vom 14. Aug 2004
Antwort Antwort
Benutzerbild von APP
APP

Registriert seit: 24. Feb 2003
Ort: Graz (A)
705 Beiträge
 
Delphi 7 Enterprise
 
#1

Re: warten bis ShellExecute beendet ist

  Alt 14. Aug 2004, 16:25
Hallo eddy,
das Warten bis ein Prozess beendet wurde funkt nur mit Hier im Forum suchenCreateProcess oder mit ShellExecuteEx:

Anbei ein Beispliel mit ShellExecuteEx:
Delphi-Quellcode:
{******************************************************************************}
FUNCTION StartAndWait(CONST ExecuteFile, ParamString: STRING): boolean;
//http://delphi.about.com/library/weekly/aa040803a.htm
{******************************************************************************}
VAR
  SEInfo : TShellExecuteInfo;
  ExitCode : DWORD;
BEGIN
  Result := False;
  IF NOT FileExists(ExecuteFile) THEN Exit;
  FillChar(SEInfo, SizeOf(SEInfo), 0);
  SEInfo.cbSize := SizeOf(TShellExecuteInfo);
  WITH SEInfo DO
    BEGIN
      fMask := SEE_MASK_NOCLOSEPROCESS;
      Wnd := Application.Handle;
      lpFile := PChar(ExecuteFile);
      lpParameters := PChar(ParamString);
      nShow := SW_SHOWNORMAL;
    END;
  IF ShellExecuteEx(@SEInfo) THEN
    BEGIN
      REPEAT
        Application.ProcessMessages;
        // Damit die Prozessorauslastung sinkt :-)
        Sleep(100);
        GetExitCodeProcess(SEInfo.hProcess, ExitCode);
      UNTIL (ExitCode <> STILL_ACTIVE) OR Application.Terminated;
      Result := True;
    END;
END;
Armin P. Pressler

BEGIN
...real programmers are using C/C++ - smart developers Delphi;
END;
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:25 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz