473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to catch WM_NCMOUSEMOVE in MDI Form?

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

Jun 27 '08 #1
3 3055
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.

"Polaris" <et*******@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
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);
}
Jun 27 '08 #2
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" wrote:
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);
}

Jun 27 '08 #3
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 [C# MVP]" <Mo************@hotmail.comwrote in message
news:AE**********************************@microsof t.com...
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" wrote:
>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);
}

Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: DraguVaso | last post by:
Hi, In my application, on some given actions while debugging in Visual Studio, I suddenly get a "System.ComponentModel.Win32Exception was unhandled" Message="Error creating window handle."...
2
by: Galina | last post by:
Hello I have an application in MS Access 2000. I have a form, which includes a subform. The subform is based on a table, but locked for any editing. There is Edit button. When clicked, it starts a...
11
by: Pohihihi | last post by:
I was wondering what is the ill effect of using try catch in the code, both nested and simple big one. e.g. try { \\ whole app code goes here } catch (Exception ee) {}
23
by: VB Programmer | last post by:
Variable scope doesn't make sense to me when it comes to Try Catch Finally. Example: In order to close/dispose a db connection you have to dim the connection outside of the Try Catch Finally...
1
by: angus | last post by:
Dear All, how to try-catch "A potentially dangerous Request.Form value was detected from the client (txtUserName="<asdf")." this exception? i've set the debugger in the Page_InIt function,...
34
by: Bob | last post by:
Hi, The compiler gives Warning 96 Variable 'cmdSource' is used before it has been assigned a value. A null reference exception could result at runtime. Dim cmdSource as SQlClient.SQLDataReader...
5
by: Simon Tamman {Uchiha Jax} | last post by:
Now this is bugging me. I just released software for a client and they have reported an unhandled stack overflow exception. My first concern is that the entirity of the UI and any threaded...
0
by: Nickneem | last post by:
I' m trying to disable all right mouse clicks by using the vbAccelerator Windows Hooks Library The small (systray / console) app. must catch all (right) mouseclicks before they are received by...
4
by: bad_boyu | last post by:
Hello, I have the following code: try { Salarii.Editors.AngajatiNewFrm _angNewFrm = new Salarii.Editors.AngajatiNewFrm(); _angNewFrm.Connection = this.Connection; _angNewFrm.ShowInTaskbar =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.