How to catch WM_NCMOUSEMOVE in MDI Form?

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);
}
 
P

Polaris

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.
 
M

Morten Wennevik [C# MVP]

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.
 
P

Polaris

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);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top