Autor Beitrag
jaenschi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 89

Win XP, Debian
D7
BeitragVerfasst: Mo 07.03.05 17:42 
Hallo,
ich möchte ein externes Programm verschieben.Dazu habe ich atm diesen Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button1Click(Sender: TObject);
var win:HWND;
begin
  win:=FindWindow(nil,'Test');
  SetForegroundWindow(win);
  PostMessage(win,WM_MOVE,0,0);
end;

Wenn ich jetzt aber auf den Button klick, wird da gar nix verschoben. Das Fenster hat er ganz sicher gefunden!
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Mo 07.03.05 19:30 
Wo steht denn da, um viele Pixel das Fenster wohin verschoben werden soll :?:
jaenschi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 89

Win XP, Debian
D7
BeitragVerfasst: Mo 07.03.05 19:38 
Wie kann ich das denn verschieben? :oops:
Ich würde das Fenster gerne in die Ecke oben links verschieben.
Geht das?
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Mo 07.03.05 19:54 
Geh mit der Maus auf WM_MOVE und dann drück F1 :!:
jaenschi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 89

Win XP, Debian
D7
BeitragVerfasst: Mo 07.03.05 20:01 
Also meine Delphi-Hilfe sagt dazu nur "Topic not available" und das, was man bei msdn findet
konnte ich auch nicht so ganz für mein Problem nutzen :(
@wdbee: Könntest du mir vllt. das anhand meines Codes aus dem ersten Posting kurz erklären?
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mo 07.03.05 20:02 
Warum verwendest du nicht gleich MoveWindow() sonder schickst eine WM_MOVE Message..? :roll:

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
jaenschi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 89

Win XP, Debian
D7
BeitragVerfasst: Mo 07.03.05 20:09 
Ich wusst nicht, dass es MoveWindow gibt :oops:
Funktioniert aber super, THX :D
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Mo 07.03.05 20:54 
Also nur zur Vollständigkeit:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
  SetWindowPos(
    win,           // handle of window
    HWND_TOPMOST,  // placement-order handle
    0,             // horizontal position
    0,             // vertical position
    0,             // width
    0,             // height
    SWP_SHOWWINDOW or SWP_NOSIZE // window-positioning flags
   );


Damit hast du zusätzliche Möglichkeiten, z. B. wenn du die Größe des Fensters nicht ändern willst, nur die Position. Der Rest in der Delphihilfe zum Windows SDK