|
-
October 31st, 2012, 11:09 AM
#4
Re: _TrackMouseEvent not working
 Originally Posted by VbEndUser
I not sure how to detect the mouse in and mouse leave in a control which attached to my dialogbox.
Please refer to my attachment.
I need to use Setcapture to detect my mouse position when it move over the control.
You don't need to call SetCapture to detect when the mouse is inside our outside your control. When the mouse moves inside your control, you receive a WM_MOUSEMOVE message (i.e. your OnMouseMove function will be called). In that function you call TrackMouseEvent, such that you will receive a WM_MOUSELEAVE message whenever the mouse cursor leaves your control (you will not receive WM_MOUSEMOVE messages when the mouse cursor moves outside the control).
You should only use SetCapture and ReleaseCapture if you want to keep receiving WM_MOUSEMOVE messages when the mouse moves outside the control. E.g. you can call SetCapture when the user starts dragging inside your control and ReleaseCapture when the dragging ends.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|