GetCursorPos()
I've seen posts about using GetCursorPos() to get the cursor coordinates, but I can't figure out how to use it. I know it uses the POINT structure with POINT.x and POINT.y (I think), but I don't understand how to get those coordinates. What exactly is supposed to go in the () and how do you use that to put the values into variables?
"I want chicken, I want liver, meow mix, meow mix, please deliver."
[428 byte] By [
orbitalne] at [2007-11-17 11:50:03]

# 1 Re: GetCursorPos()
Its very simple.
BOOL GetCursorPos(LPPOINT lpPoint); gets the position of the cursor in screen coordinates.
So for example... a section of code.
#include <windows.h>
POINT p;
GetCursorPosition(&p);
p.x; //this would contain the x postion of its position
p.y; //constains the y position.
Note! The top left corner of the desktop screen is 0,0 and the bottom right it for example 1100,800.. or whatever your resolution is in.
The value you pass to GetCursorPos is a long pointer to a POINT...in other words a pointer to a POINT structure.
Hope that helped.
Thanx for voting :)