Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi <Win NT: Programm ausführen und auf Beenden warten (https://www.delphipraxis.net/31513-win-nt-programm-ausfuehren-und-auf-beenden-warten.html)

moritz 10. Okt 2004 16:45


<Win NT: Programm ausführen und auf Beenden warten
 
Hi Leute,

ich verwende folgende Funktion, um ein Programm auszzuführen und zu warten, bist es beendet ist:
Delphi-Quellcode:
procedure ShellExecute_AndWait(Executable, Parameter: STRING; ShowParameter: INTEGER; WorkingDir: String);
var
  Info: TShellExecuteInfo;
  pInfo: PShellExecuteInfo;
  exitCode: DWord;
begin
  pInfo := @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 := PChar(WorkingDir);
    nShow       := ShowParameter;
    hInstApp    := 0;
  end;
  ShellExecuteEx(pInfo);

  repeat
    exitCode := WaitForSingleObject(Info.hProcess, 500);
    Application.ProcessMessages;
  until (exitCode <> WAIT_TIMEOUT);
end;
Allerdings benötigt dieser Code das Layer Framework, das auf Windows 95/98/ME nicht vorinstalliert ist und extra downgeloadet werden muss, was ein bisschen blöd ist. Deswegen suche ich nach einer Möglichkeit, das gleiche auch auf diesen Windows-Versionen umzusetzten. Bis jetzt löse ich es über ShellExecute und danach Sleep, was natürlich nicht wirklich sauber ist. Kennt ihr eine andere Möglichkeit? (Ich brauche ein Running Directory!)

Gruß, Moritz

Luckie 10. Okt 2004 18:54

Re: <Win NT: Programm ausführen und auf Beenden warten
 
Ich sehe daran eigentlich nichts, was das Layer Framework erfordeert. Hast du es schon mal unter Windows 9x probiert und was kommt für eine Fehlermeldung?

moritz 11. Okt 2004 05:53

Re: <Win NT: Programm ausführen und auf Beenden warten
 
Laut MSDN benötigt ShellExecuteEx das Layer Frakework, unter Wind 98 wird die Funktion auch nicht ausdgeführt.

toms 11. Okt 2004 07:35

Re: <Win NT: Programm ausführen und auf Beenden warten
 
Probier's mit Hier im Forum suchenCreateProcess

Viele Beispiele dazu findest du hier.

Luckie 11. Okt 2004 09:33

Re: <Win NT: Programm ausführen und auf Beenden warten
 
Zitat:

Zitat von moritz
Laut MSDN benötigt ShellExecuteEx das Layer Frakework, unter Wind 98 wird die Funktion auch nicht ausdgeführt.

Oops. :oops: Das hätte ich jetzt nicht erwartet. :roll:

mirage228 11. Okt 2004 13:12

Re: <Win NT: Programm ausführen und auf Beenden warten
 
Zitat:

Zitat von Luckie
Zitat:

Zitat von moritz
Laut MSDN benötigt ShellExecuteEx das Layer Frakework, unter Wind 98 wird die Funktion auch nicht ausdgeführt.

Oops. :oops: Das hätte ich jetzt nicht erwartet. :roll:

Hi,

also unter http://msdn.microsoft.com/library/de...lexecuteex.asp steht

Zitat:

Minimum operating systems: Windows NT 4.0, Windows 95
Also müsste das wohl gehen! :gruebel:

mfG
mirage228

moritz 11. Okt 2004 13:50

Re: <Win NT: Programm ausführen und auf Beenden warten
 
Da steht aber auch:
Zitat:

Windows 95/98/Me: ShellExecuteEx is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
Es geht schon unter Win < NT ,aber halt nur mit dem Framework. CreateProcess schau ich mir mal an, danke!


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:20 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz