Groups | Blog | Home
all groups > dotnet windows forms controls > august 2004 >

dotnet windows forms controls : [FORM] Catching Minimize event



Imran Koradia
8/30/2004 10:19:06 AM
Override the WndProc method of the form and look for the WM_SYSCOMMAND
message. Here's info on when this message is sent and other details:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardAccelerators/KeyboardAcceleratorReference/KeyboardAcceleratorMessages/WM_SYSCOMMAND.asp

You will not check the WParam for the SC_MINIMIZE value. Here's an example
of how to determine when the form is closed using the 'x' button. This one
checks for the SC_CLOSE value - you can modify it to check for SC_MINIMIZE
to determine when the window is minimized.
http://www.syncfusion.com/FAQ/WinForms/FAQ_c95c.asp#q862q

hope this helps..
Imran.

[quoted text, click to view]

Imran Koradia
8/30/2004 10:30:24 AM
[quoted text, click to view]

Sorry - I meant you will need to check the WParam for the SC_MINIMIZE value.

ClayB [Syncfusion]
8/30/2004 11:01:17 AM
To be notified when a form is minimized, maybe you can catch the form's
SizeChanged event, and check the WindowState.

private void Form1_SizeChanged(object sender, System.EventArgs e)
{
if(this.WindowState == FormWindowState.Minimized)
{
Console.WriteLine("Minimized");
}
}

===================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools

[quoted text, click to view]

Didier BRETIN
8/30/2004 3:56:08 PM
Hello,

I would like to catch the "minimize event" of a form and then add an icon
in the systray. I found how to add the icon, but I can't find the "minimize
event" of the form.

What is it ?

Regards.

--
hirf-spam-me-here NO[at]SPAM gmx.at
8/30/2004 6:02:31 PM
* Didier BRETIN <dbr@informactis.com> scripsit:
[quoted text, click to view]

Add a handler to the form's 'Resize' event and check its 'WindowState'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
AddThis Social Bookmark Button