Autor Beitrag
thorbenZ
Hält's aus hier
Beiträge: 12



BeitragVerfasst: Mi 27.08.03 15:18 
Hallo,

ich starte mit ShellExecute eine Anwendung. Die Anwendung startet, tut etwas und beendet sich dann wieder selbst. Wie kann ich mein Programm dazu veranlassen, das Programm so zu starten, dass meins abwartet, bis sich das andere beendet hat?
Terra23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Mi 27.08.03 16:18 
Das steht hier irgendow im Forum. Such mal nach Mathias Simmack (Suche in: Delphi-Forum, Delphi-Library MATHIASSIMMACK). Den genauen Begriff weiß ich nicht. Was du vielleicht machen könntest:

Dein Programm, daß per ShellExecute gestartet wird, kann beim Erzeugen einen Wert in die Registry schreiben und beim Beenden wieder löschen. Dein erstes Programm, daß das andere startet, kann laufend prüfen, ob der Wert noch da ist. Ist er das nicht (mehr), kann es weitermachen. Ist vielleicht nicht sehr schön, aber erfüllt den Zweck. :-)

_________________
Hasta La Victoria Siempre
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 27.08.03 16:47 
ShellexecuteEx oder CteateProcess und WaitForSingleObject.

Codebeispiel hier:
www.delphipraxis.net...=waitforsingleobject
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 28.08.03 09:51 
Hallo!

Hier mal ein Code-Beispiel. Woher ich den Code habe weiß ich nicht mehr. Kann auch nicht genau sagen ob er 100%ig funktioniert:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
Procedure RunProcessAndWait (aFilename: String);
Var
  StartupInfo : TStartupInfo;
  ProcessInfo : TProcessInformation;
  Result: Boolean;
Begin
  FillChar (StartupInfo, SizeOf (TStartupInfo), 0);
  StartupInfo.cb := Sizeof (TStartupInfo);

  StartupInfo.dwFlags := STARTF_USESHOWWINDOW OR STARTF_USEPOSITION OR STARTF_USESIZE ;
  StartupInfo.wShowWindow := SW_SHOWDEFAULT;

  Result := CreateProcess (
      nil,
      pChar (aFilename),
      nil,
      nil,
      False,
      NORMAL_PRIORITY_CLASS, 
      nil,
      nil,
      StartupInfo,
      ProcessInfo
    );
  
  If Result then
    WaitForSingleObject (ProcessInfo.hProcess,INFINITE);

  if ProcessInfo.hProcess <> 0 then 
    CloseHandle (ProcessInfo.hProcess);
End;
Akut-Programming
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 69

WinXP, Win2000
Delphi 7 Enterprise, Delphi 5 Prof.
BeitragVerfasst: Do 28.08.03 10:29 
@Tino

:mahn: Kuck dir ma den Link im Post über dir an!Dann weißt du wo du den Code her hast. :lol:

_________________
Gruß,
Akut - Programming
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 28.08.03 13:08 
Das muß nicht gesagt sein. Eventuell habe ich meinen Code aus seiner Quelle und nur etwas ausgearbeitet.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 28.08.03 13:15 
Akut-Programming hat folgendes geschrieben:
Kuck dir ma den Link im Post über dir an!Dann weißt du wo du den Code her hast.

Ne, daher habe ich das nicht! Der Code auf der DP ist auch etwas anders! :shock:
Akut-Programming
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 69

WinXP, Win2000
Delphi 7 Enterprise, Delphi 5 Prof.
BeitragVerfasst: Do 28.08.03 13:16 
:nixweiss: Ahso! Nagut, das merkt man bei n schnellen Blick nich! Also sorry!!! :oops:

_________________
Gruß,
Akut - Programming
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Fr 29.08.03 15:22 
falls die sachen von oben nich funzen: www.swissdelphicente...showcode.php?id=1333




MrSaint

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems