Get Mouse Position in Thread

I have a non-interface or worker thread that I would like to acquire the mouse position.  I tried GetMessagePos, but that only returns NULL.  I'm assuming this is because my thread has no message pump.

Is the only way to get the mouse position to create message pump?  Would a thread message pump work?  Can I "hook" myself into something to acquire the info?  Why isn't there a function just called DWORD GetMousePos()?!?!?

There is a function, "GetMouseMovePointsEx" which retrieves history of mouse points, but it looks like it needs a mouse point from WM_MOUSEMOVE, so no go there... plus you have to have WINVER >= 0x0500 which sucks.  

All I want is the current mouse position.  Any info would be great, thanks!
toddmooreAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
nils pipenbrinckConnect With a Mentor Commented:
I think GetCursorPos will do the job.. Ood naming. it doesn't give you the position of the cursor but the mouse..

I used it with success..

nils
0
 
toddmooreAuthor Commented:
Thanks, it works!  I looked ALL over MSDN for that answer.  Geez!
0
 
toddmooreAuthor Commented:
Thanks, it works!  I looked ALL over MSDN for that answer.  Geez!
0
All Courses

From novice to tech pro — start learning today.