How to catch WM_NCMOUSEMOVE in MDI Form?

  • Thread starter Thread starter Polaris
  • Start date Start date
P

Polaris

Hi C# Experts:

I'm writing a C# MDI program. I need to know when user is moving mouse on
MDI's non-client area (that dark-gray background). I have tried code below
but it did not catch the user's action. Anyone knows how it should be done?

Thanks in advance.
Polaris

protected override void WndProc (ref Message m)
{
if (m.Msg == Utils.WM_NCMOUSEMOVE)
Utils.Beep(11000, 20);

base.WndProc(ref m);
}
 
Correction, the message I need to catch is WM_MOUSEMOVE, I have tried the
code (posted below) with WM_MOUSEMOVE, but still not catching it.
 
Hi Polaris,

When you create an MDI window, the MDI canvas is actually a separate control
and not the non client area of the MDI parent. This canvas control traps the
mouse events and I'm not sure how, or if it is possible, to get these mouse
events.
 
Thanks Morten.

I think there should a way to do it because I tried the Spy++, it can detect
mouse actions (WM_MOUSEMOVE, WM_LBUTTONDOWN...) accurately...

Morten Wennevik said:
Hi Polaris,

When you create an MDI window, the MDI canvas is actually a separate
control
and not the non client area of the MDI parent. This canvas control traps
the
mouse events and I'm not sure how, or if it is possible, to get these
mouse
events.

--
Happy Coding!
Morten Wennevik [C# MVP]


Polaris said:
Hi C# Experts:

I'm writing a C# MDI program. I need to know when user is moving mouse on
MDI's non-client area (that dark-gray background). I have tried code
below
but it did not catch the user's action. Anyone knows how it should be
done?

Thanks in advance.
Polaris

protected override void WndProc (ref Message m)
{
if (m.Msg == Utils.WM_NCMOUSEMOVE)
Utils.Beep(11000, 20);

base.WndProc(ref m);
}
 
Back
Top