Valhalla Legends Forums Archive | .NET Platform | Minimizing Forms

AuthorMessageTime
Mangix
does a form have an Event that fires exactly when the form gets minimized? i've looked at each event and i dont think im finding what im looking for.
October 7, 2005, 4:42 AM
Myndfyr
No.  You can intercept it, however, by overriding WndProc and handling WM_SYSCOMMAND -- specifically, the SC_MINIMIZE command contained in wParam.

Example code: .NETskinEx's /Controls/NCForm implements this in the form of the protected virtual function OnMinimized.
October 9, 2005, 5:04 AM
Mangix
mmk

also your NetSkinEx program is very neat :)

edit:ok it doesnt work. it compiles fine but when i run it, it crashes on start. here's the message.

[quote]Application has generated an exception that could not be handled.

Process id=0x938 (2360), Thread id=0xc94 (3220).

Click OK to terminate the application.
Click CANCEL to debug the application.[/quote]

my code is this. [code] protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case 274:
if (m.Msg == 0xF020)
{
this.Visible = false;
}
break;
}
}[/code] i took a look at WinUser.h and WM_SYSCOMMAND is 274
October 9, 2005, 6:05 AM

Search