By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,081 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,081 IT Pros & Developers. It's quick & easy.

No WM_NCMOUSELEAVE messages under "Windows Classic Style"

P: n/a
Hi, hope I'm posting to the right forum.

I'm using C# under .NET 1.1, Windows XP SP2

I have a form and I've overridden WndProc to print to a text box whenever it
receives the WM_NCMOUSELEAVE message. Under "Windows XP Style", I get these
messages fine (when the mouse moves off the title bar or form borders).
Under "Windows Classic Style", I don't get the message at all!

Has anyone seen this?

Thanks!
Jen

Note: If you have an answer/solution, if you could also e-mail
lisseut_at_gmail_dot_com that would be great! (I get so much spam in my
Hotmail account now...).

Sample source (I've tried some different things here):

private System.Windows.Forms.TextBox m_txtMessages;

protected override void WndProc(ref Message m)
{
const int WM_NCMOUSELEAVE = 0x02A2;
const int WM_MOUSELEAVE = 0x02A3;

switch (m.Msg)
{
case WM_MOUSELEAVE:
m_txtMessages.Text = "WM_MOUSELEAVE\n" + m_txtMessages.Text;
break;
case WM_NCMOUSELEAVE:
m_txtMessages.Text = "WM_NCMOUSELEAVE\n" + m_txtMessages.Text;
break;
default:
break;
}
base.WndProc (ref m);
}

protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter( e );
TRACKMOUSEEVENT tme = new TRACKMOUSEEVENT();
tme.hwndTrack = this.Handle;
tme.cbSize = (uint)Marshal.SizeOf(tme);
tme.dwFlags = TME_NONCLIENT;
tme.dwHoverTime = 1000 * 3;
TrackMouseEvent(ref tme);
}

[DllImport("user32.dll")]
static extern bool TrackMouseEvent(ref TRACKMOUSEEVENT lpEventTrack);

[StructLayout(LayoutKind.Sequential)]
public struct TRACKMOUSEEVENT
{
public UInt32 cbSize;
public UInt32 dwFlags;
public IntPtr hwndTrack;
public UInt32 dwHoverTime;
};

const int TME_NONCLIENT = 0x00000010;
Jul 7 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.