Autor Beitrag
Frankieboy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 65



BeitragVerfasst: Mi 12.03.08 19:06 
Hallo,

ich verwende CreateProcess, um eine Konsolenanwendung in einem neuen Prozess zu starten...

Wie bekommen ich jetzt aber das WindowHandle des neugeöffneten Konsolenfensters?
Kann man das irgendwie aus STARTUPINFORMATION oder PROCESS_INFORMATION rauslesen?

Ich kenn mich halt mit der Windows API nicht so gut aus...


Greetz,

Frankie
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Do 13.03.08 08:44 
Da ein Prozess durchaus mehrere Window Handles haben kann musst du diese alle auflisten.
Das geht mit EnumWindows:
msdn2.microsoft.com/...ms633497(VS.85).aspx

Und danach schauen ob das Windows Handle zu einem Prozess gehört (GetWindowThreadProcessID):
msdn2.microsoft.com/...ms633522(VS.85).aspx

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
Frankieboy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 65



BeitragVerfasst: Do 13.03.08 13:03 
Hallo,

erstmal danke für die Auskunft!

Da CreateProcess in meinem Fall einen seperaten Prozess für eine Konsolenanwendung (openssl.exe) kreiert, gibt es immer nur ein Fenster.
Allerdings hat dieses Fenster standarmäßig den Status SW_HIDE - ist also für den Benutzer unsichtbar...

Findet man in diesem Fall das Fenster mit EnumWindows?
-> Falls es dir nichts ausmacht, wäre ein kurzes Code-Beispiel sehr nett!

Und kann man nicht irgendwie nur alle Fenster eines Prozesses (oder Threads) auflisten?

Thanks,

Frankie
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Do 13.03.08 13:14 
Alternativ:
EnumThreadWindows

Obs für unsichtbare Fenster geh weiß ich nicht

Beispiel hier:

www.swissdelphicente.../showcode.php?id=327

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit