Autor Beitrag
djmasi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54

Win XP Prof. Tablet PC Edition 2005
D7 Enterprise
BeitragVerfasst: Di 22.04.03 14:08 
Servus,

wie kann ich ein externes Programm starten und dabei aber die Position und Größe des zu startenden Fensters angeben?
Das Starten ist ja kein Problem (ShellExecute, CreateProcess). Es soll wohl über das Fenster Handle gehen, aber wie???
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Di 22.04.03 17:31 
Hallo DJ Masi!

Wenn du das Handle hast, geht das ganz einfach mit SetWindowPos. Wenn du es nicht hast, musst du erst nach dem Programm mit FindWindows suchen.

Gruß wulfskin!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
djmasi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54

Win XP Prof. Tablet PC Edition 2005
D7 Enterprise
BeitragVerfasst: Di 22.04.03 17:44 
Danke, werde es mal probieren. Hoffentlich funktioniert das, sonst kann ich das Programm vergessen :D
djmasi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54

Win XP Prof. Tablet PC Edition 2005
D7 Enterprise
BeitragVerfasst: Mi 23.04.03 10:40 
Also habe jetzt einiges ausprobiert. Das eigene Fenster kann ich verändern, nur meine zu startende Applikation nicht! :?
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.Button2Click(Sender: TObject);
var lauf:word;
    title: array[0..255] of char;
begin
  ShellExecute(Application.Handle, 'open', 'D:\Microsoft Office\Office10\Winword.exe',nil, nil, SW_SHOW);
  TListe := TList.Create;
  EnumWindows(@EnumWindowsProc,0);
  For lauf := 0 to Tliste.Count - 1 do begin
    GetWindowText(hwnd((TListe.Items[lauf])^),title,256);
    If title='Dokument1 - Microsoft Word' Then
      FensterHandle := HWND((TListe.Items[lauf])^);
    ListBox1.Items.Add(title);
  end;
  SetWindowPos(FensterHandle,HWND_TOPMOST,50,50,900,650,SWP_NOMOVE);
  TListe.Free;
end;

Wie man sieht lasse ich mir die Handles in einer Listbox anzeigen. Aber beim starten des Progs ist das Handle da noch nicht vorhanden.
Mit FindWindow habe ich es auch probiert. Vielleicht kann mir das jemand an nem stück code erklären
:wink: