I'm new here, so I apologize if I'm not doing this correctly. I need some help in a game I'm making where I need to be able to see where on screen that someone clicked. I understand that the GetCursorPos function would help, but I'm still not really sure how to implement this in my code...at all. Do you think someone could help with a very basic, sample code that would be able to give the cursor position when clicked?
"Spoons go in the spoon drawer. Forks go in the fork drawer and the Whiskernugen goes in the whiskernugen drawer." - Chowder
Following the logic of my cartoon hero; the the Windows questions are more accurately answered in the Windows section of the forum. The WinAPI function "GetCursorPos()" fills out a 'POINT' struct that describes the X and the Y 'coords' of the cursor at the moment it is called. You should put this in the event handler for the application, or you could provide some code if you need more specifics.
The advantage to this over GetCursorPos is not only that you are notified when the user clicks... but the position you get back is in client coords (ie: 0,0 is the upper left corner of your game's drawing space).
Whereas GetCursorPos() will give you the position in screen coords (ie: 0,0 is the upper left corner of the user's monitor)... so you will have to manually convert to client coords.
Thanks, Disch, that helps a lot. It is in a window, so this would definitely be good to use. May I just ask, though, and I'm very sorry because I'm pretty new at this, what the LOWORD(lparam) AND HIWORD(lparam) things are? Thanks so much for all your help.