LeTay
asked on
How to programmatically minimize a window in delphi
I need to programmatically minimze a form in Delphi
The WindowState property gives the state but is read-only
So how do I minimize my form at run time, without user intervention ?
The WindowState property gives the state but is read-only
So how do I minimize my form at run time, without user intervention ?
WindowState Readonly ???
ASKER
Hello Geert : SW_MINIMIZED does not compile
Which unit is it in ?
Thanks
Which unit is it in ?
Thanks
windows
forgot the show
SW_SHOWMINIMIZED
forgot the show
SW_SHOWMINIMIZED
ASKER
Works but I thought it would react as if you click in the top menu bar on the _ (minimize) button
Is there a way to have the same (so the icon is on the task bar at the botton)
Is there a way to have the same (so the icon is on the task bar at the botton)
SendMessage(hWin,WM_SYSCOM MAND,SC_MI NIMIZE,0);
should work ok.
should work ok.
ASKER
Hello rinfo, what is hWin ? It does not compile like that
Thanks
Thanks
Hwin is for Handle of the window.
SOrry for the shortcut snippets
here is what you should be doing
var Hwin: THandle ;
begin
hwin := FindWindow ('TForm1', nil);
SendMessage(hwin,WM_SYSCOM MAND,SC_MI NIMIZE,0);
end;
I have tested it.
SOrry for the shortcut snippets
here is what you should be doing
var Hwin: THandle ;
begin
hwin := FindWindow ('TForm1', nil);
SendMessage(hwin,WM_SYSCOM
end;
I have tested it.
ASKER
Does not work with neither 'TForm1' nor 'Form1'
I have tested it and then posted it.
TForm1 is the name of the form you are using.
If your form name is TForm1 it should work.
Which version of window are you using.Window API works oddly in WIndow7 i will check this in windows t.
TForm1 is the name of the form you are using.
If your form name is TForm1 it should work.
Which version of window are you using.Window API works oddly in WIndow7 i will check this in windows t.
ASKER
Indeed TForm1 is the form class
But it did not work on my PC (Windows Vista)
But it did not work on my PC (Windows Vista)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Application.Minimize;
or a separate form:
ShowWindow(Form1.Handle, SW_MINIMIZED);