Autor Beitrag
bigmasterdenis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 48



BeitragVerfasst: Mi 19.12.07 15:00 
Hallo Leute!

Mit WinExecAndWait32(FileName: string; Visibility: Integer) starte ich aus meinem Prog ein anderes. Das Problem dabei ist nur, dass das Fenster des aufgerufenen Programms irgendwo in der Ecke auftaucht. Ich hätte es aber gerne in der Mitte des Desktops.

Hat jemand zufällig eine Idee was man da machen könnte?


Danke und Gruß
gispos
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 94

WIN 7
XE10, D2007
BeitragVerfasst: Do 20.12.07 20:07 
SetWindowPos, brauchst dazu aber das Handle zum Fenster.

Gruß gispos
bigmasterdenis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 48



BeitragVerfasst: Fr 21.12.07 15:48 
Handle wäre natürlich nicht schlecht. Aber wie kriege ich das Handle zu diesem Fenster?
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Fr 21.12.07 15:53 
Wenn ich den Namen der Funktion WinExecAndWait32 richtig deute, wartet die doch, bis das Programm wieder geschlossen ist. Wann willst Du dann noch die Fensterposition setzen?

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Wotan89
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Di 25.12.07 13:09 
Das Fenster kriegt man mit FindWindow oder mit EnumWindows(an gleicht die PID's der Fenster mit der PID des erstellten Prozesses ab). Nimm doch statt WinExecAndWait32() CreateProcess(), setze dann mit SetWindowPos() die Position des Fensters und warte dann mit WaitForSingleObject().