Gabe Covert
Gabe Covert wrote in message <7bjkah$8ts$1...@usenet41.supernews.com>...
Try trapping the WM_GETMINMAXINFO message.
Example:
// add this to the private section of form
procedure WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo); message
WM_GETMINMAXINFO;
procedure TFrmPostcodes.WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo);
begin
with Message.MinMaxInfo^ do
begin
with ptMaxPosition do
begin
X := SomeValue;
Y := SomeValue;
end; //with
with ptMaxSize do
begin
X := SomeValue;
Y := SomeValue;
end; //with
with ptMinTrackSize do
begin
X := SomeValue;
Y := SomeValue;
end; //with
with ptMaxTrackSize do
begin
X := SomeValue;
Y := SomeValue;
end; //with
end; //with message
inherited; //Call inherited handler
end;
This gives you complete control over position and size of the form.
Hope this helps
Steven Tolleneer
I haven't tried, and this may not answer your question, but I
thought I'd mention it anyway :)
Gabe Covert wrote in message <7bjkah$8ts$1...@usenet41.supernews.com>...
>I am trying to capture the minimize button in Delphi, and have gotten code
>that works if you go to the program menu and choose minimize. This code
>works on capturing the WM_SYSCOMMAND and checking the wParam to see if it
is
>SC_MINIMIZE. However, when the little minimize button is pressed in the
>frame, the WM_SYSCOMMAND code does not execute. How can I tell from my
>Delphi Application if this minimize button is raised? Thanks
>
>Gabe Covert
>
>
--
----------------------
Regards
Robert Cerny
Remove both qwe when replying
email: robert.q...@neosys.xrs.qwe.si
No questions via email, unless explicitly invited.
Gareth
--
Gareth Elliott
Software Engineer
NiSoft (UK) Limited
Unit 8, 31 Ballynahinch Road, Carryduff, BELFAST BT8 8EH
Tel: +44 (0) 1232 814121, Fax: +44 (0) 1232 813962
email: gell...@nisoft.co.uk
Internet: www.nisoft.co.uk
Maybe you forgot to declare it as message handler. Or there is another
component that "steals" the message.
Standard Sys Admin Answer #112, "Well, it works for me."
--
----------------------
Regards
Robert Cerny
Remove both qwe when replying
email: robert.q...@neosys.xrs.qwe.si
No questions via email, unless explicitly invited.
Gareth Elliott wrote in message ...
>I dunno.
>
>Maybe you forgot to declare it as message handler. Or there is another
>component that "steals" the message.
I found your code (or similar) somewhere else. It works fine for the
Minimize in the system menu, but not for the minimize button. Why? If
it works for the system menu it's sure hooked up properly?
thanks, Steffen
From the name, I'm inferring that WM_SYSCOMMAND is sent only when a command
from the system menu is selected. And that clicking on the Minimize button
doesn't do that.
There's another system message, named something like WM_SIZE, which is sent
when a form changes size, and a related one when it's minimized, maximized,
or restored. For the latter, there's a parameter value indicating which is
the case.
Check WM_SIZE and WM_GETMINMAXINFO, and look at any "See Also" in the Win32
help. Sorry I can't do the legwork from where I am.
Elliott
"I don't want to achieve immortality through my work. I want to achieve
it through not dying." -- Woody Allen
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Well, Gabe ol' boy, I went home and found the code snippet I use to detect
when a window is being UN-minimized. The concept is the same; you would just
write "if msg.SizeType = SIZE_MINIMIZED" instead of what I did.
==========================================
protected
procedure WMSize (var msg: TWMSize);
message WM_SIZE;
.
.
.
procedure TForm1.WMSize (var msg: TWMSize);
begin
inherited;
if (msg.SizeType = SIZE_MAXIMIZED) or (msg.SizeType = SIZE_RESTORED)
then ...
end
==========================================
I added this when I discovered that a form I'd placed off the screen was
being brought into visible range when the user clicks Minimize All Windows on
the taskbar, then clicks Undo Minimize All. Cripes, that isn't clicking the
command menu OR the minimize box--but the program detects it all the same.