Get window handle and maximize


how to get handle of window and then
maximize , restore the window?

Regards
Lulli
lulliAsked:
Who is Participating?
 
intheConnect With a Mentor Commented:
hi,
you can do like:
procedure TForm1.Button1Click(Sender: TObject);
var
  MyHandle: THandle;
begin
  MyHandle := FindWindow('notepad',nil);
  if MyHandle <> 0 then
   begin
    ShowWindow(myhandle,SW_MINIMIZE);
 //ShowWindow(myhandle,SW_MAXIMIZE);
     
end;
  end;


usually the classname is not the same as the program name but in notepads case it is the same.

you can use either:
FindWindow('notepad',nil);
FindWindow(nil,'untitled - notepad');
FindWindow('notepad','untitled - notepad');

Regards Barry

btw you can get a program called sinfo to show you the classnames of other programs.just search yahoo or altavista for a download address for it.


0
 
lulliAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.