If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

[RESOLVED] SetWindowLong and WM_MOUSEMOVE

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???

Re: SetWindowLong and WM_MOUSEMOVE

DG,

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.

Re: SetWindowLong and WM_MOUSEMOVE

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.