Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Other Forums > Chit-Chat


Chit-Chat Relax for a bit and have a general conversation (off topic is allowed!) with other members. Please be polite and respect your fellow members.

Reply
 
Thread Tools Display Modes
Old 27th April 2008, 10:45 AM   (permalink)
Experienced Member
 
HerbertMunch is on a distinguished road
Default C# Windows messaging problem

Hi all,
im trying to implement toolbar docking but have run into a problem.

Im using c# forms as toolbar windows and have overridden the tool windows wndproc.

I listen out for WM_NCLBUTTONDOWN messages to detect when to start dragging, which works fine.

The problem is that my wndproc method never seems to get any WM_Mousemove messages when the form is being dragged by the NC area.

This is strange as Ms spy records WM_Mousemove messages, even when the window is being dragged by the nc region.

Here are some of the recorded messages that spy obtained from my tool window form, as i dragged it using the title bar.

<00059> 00010572 S WM_NCHITTEST xPos:551 yPos:213
<00060> 00010572 R WM_NCHITTEST nHittest:HTCAPTION
<00061> 00010572 S WM_MOUSEACTIVATE hwndTopLevel:00010572 nHittest:HTCAPTION uMsg:WM_LBUTTONDOWN
<00062> 00010572 R WM_MOUSEACTIVATE fuActivate:MA_NOACTIVATE
<00063> 00010572 S WM_SETCURSOR hwnd:00010572 nHittest:HTCAPTION wMouseMsg:WM_LBUTTONDOWN
<00064> 00010572 R WM_SETCURSOR fHaltProcessing:False
<00065> 00010572 P WM_NCLBUTTONDOWN nHittest:HTCAPTION xPos:551 yPos:213
<00066> 00010572 S WM_NCACTIVATE fActive:True
<00067> 00010572 R WM_NCACTIVATE
<00068> 00010572 P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:367 yPos:-9
<00069> 00010572 P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:366 yPos:-10
<00070> 00010572 P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:366 yPos:-12
<00071> 00010572 P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:365 yPos:-13
<00072> 00010572 P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:362 yPos:-15


Does anyone know why if spy can see the messages, why the WinForms windows wndproc doesnt?


I thought that maybe the dotnet windows forms wndproc was somehow limited so i just tried using SetWindowLong api to subclass the wndproc.

Didnt work, exactly the same results as overriding the Wndproc method.

here are the messages that were recorded using the subclassed window inside my program:

WM_MOVE
WM_WINDOWPOSCHANGING
WM_GETMINMAXINFO
WM_WINDOWPOSCHANGED
WM_MOVE
WM_WINDOWPOSCHANGING
WM_GETMINMAXINFO
WM_WINDOWPOSCHANGED
WM_MOVE
WM_WINDOWPOSCHANGING
WM_GETMINMAXINFO
WM_WINDOWPOSCHANGED
...... etc

As you can see, the WM_MOUSEMOVE message is not being received by my form, even though the spy output shows it as being sent to the form.

I think that maybe its something to do with the fact that the WM_MOUSEMOVE is sent as Postmessage and not sendMessage().

Thanks in advance to anyone that can shed any light on this.
__________________
Chris
HerbertMunch is offline   Reply With Quote
Old 27th April 2008, 01:47 PM   (permalink)
Experienced Member
 
HerbertMunch is on a distinguished road
Default

Hi all,

dont worry I have sorted out what was wrong. it appears that i needed to call win32api SetCapture() method in response to WM_NCLBUTTONDOWN, in order to receive the wm_mousemove messages that spy++ found .

Chris.
__________________
Chris
HerbertMunch is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Anyone tried Windows Vista? What do you think? ThermalRunaway Chit-Chat 13 6th July 2006 07:45 PM
Windows XP is no good for me mstechca Chit-Chat 15 7th April 2006 05:31 PM
windows 98, windows xp danielsmusic Chit-Chat 20 28th August 2005 12:47 AM
Networking Harddrives crazymonkey General Electronics Chat 3 9th March 2004 04:55 PM
strange color camera problem schrodingerscat Electronic Projects Design/Ideas/Reviews 5 4th October 2003 07:25 PM



All times are GMT. The time now is 05:44 AM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.