Move (non Delphi) window

Hi!
I know the caption of a window and want to move it to the upper left corner of the screen. It's out of sight due to a bug in the dual head video driver :´-(

Alex
LVL 2
__alexAsked:
Who is Participating?
 
php4delphiConnect With a Mentor Commented:
procedure TForm1.Button1Click(Sender: TObject);
var
 W : HWND;
begin
  WinExec('notepad.exe', SW_SHOW);
  W := FindWindow(nil, 'Untitled - Notepad');
  if W > 0 then
   SetWindowPos(W, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE);
end;
0
 
kretzschmarCommented:
u could use the findwindow-api to get the handle
and then the setwindowpos-api to set the new position

currently i'm not able to provide a sample, sorry

meikl ;-)
0
 
kretzschmarCommented:
a bit too late ;-))
php4delphi, provided already what i have meant -> good work, php4delphi  
0
 
__alexAuthor Commented:
Works like a charm!
0
All Courses

From novice to tech pro — start learning today.