detecting 'x' systembox close on MDIChild
- From: "Jeff Jarrell" <jjarrel_NOSPAM@xxxxxxxxx>
- Date: Thu, 25 Oct 2007 20:43:30 -0400
I'd like to detect the 'x' systembox close on a MDIChild. The formClosing
event, ClosingReason just says 'UserClosing' and doesn't differentiate the
'x' close.
I have some code I used in the past. This works for modal and as I recall
worked for modeless. But it doesn't work when the window is a MDIChild.
Code is below.
Any suggestions?
jeff
private const int WM_SYSCOMMAND = 0x112;
private const int SC_CLOSE = 0xf060;
private const int WM_MDIACTIVATE = 0x222;
protected override void WndProc(ref Message m)
{
if ((((m.Msg == WM_SYSCOMMAND) && (m.WParam.ToInt32() == SC_CLOSE)) ? 1 : 0)
!= 0)
{
Debug.WriteLine("X Detected - Modal");
}
Debug.WriteLine(String.Format("msg:{0}
wparam:{1}",m.Msg,m.WParam.ToInt32()));
base.WndProc(ref m);
}
.
- Prev by Date: Re: Using C# Interfaces and User Controls
- Next by Date: Re: Using C# Interfaces and User Controls
- Previous by thread: Using C# Interfaces and User Controls
- Next by thread: Windows service
- Index(es):