Question for the gurus. I need to be able to ignore the mousemove event selectively for a selected control on a form. More specifically, I need the X and Y mousepointer coordinates to reflect the X,Y coordinates relative to the parent form window and NOT the control the mouse is over. I assume I can use GetWindowLong and SetWindowLong then only handle WM_MOUSEMOVE messages in some routine other than my SelectedControl_Mousemove event routine. But I'm not sure exactly how I would go about ignoring the control boundaries of the selected window I'm processing the messages for.
In my perfect world LOL, I could just discard the WM_MOUSEMOVE messages entirely for a selected window and the WM_MOUSEMOVE messages for the parent window would continue to work uninterrupted as if the mouse had never passed over another window, but that would be too easy now wouldn't it???
Thanks for the reply. Yeah, I knew that controls on my my form were child windows of the parent, and ignoring the mouseclicks is fairly straight forward, but I'm actually looking to ignore the mousemove event of all subwindows during a drag event. I may be re-inventing the wheel here, as I'm now looking at a function:
DragDetect. I can't readily find a VB implementation of this but I've looked at some of the example C++ code and it looks like it might be what I'm looking for. I'm going to charge the Front Line and see if I can make it work.
What I want to do is drag one control across my form window and not lose track of my current location on the form as I drag 'Across' another control.
Still not sure what you mean.
Do you have something written in your controls mouse move procedure, that you don't want invoked?
If so, you could use the GetKeyState API, to detect if the mouse is down.
If, not then GetCursorPos API will give the screen coordinates of the pointer.
Then GetWindowRect will give you the boundry coordinates of your form.
This would allow you to keep track of the position relative to the form.
Private Declare Function apiGetKeyState Lib "user32" Alias "GetKeyState" (ByVal vKey As Long) As Long
Private Declare Function apiGetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hWnd As Long, ByRef lpRect As RECT) As Boolean
Private Declare Function apiGetCursorPos Lib "user32" Alias "GetCursorPos" (ByRef lpPoint As POINTAPI) As Boolean
If that doesn't solve your problem, let us know.
Last edited by TT(n); July 18th, 2009 at 12:58 AM.