View Single Post
Old 29-Mar-2007, 03:02 AM   #2 (permalink)
Iphone
Fixed Error!
 
Iphone's Avatar

Posts: 4,202
Join Date: Mar 2007
Rep Power: 6 Iphone is on a distinguished road

IM:
Default Re: Capture Mouse Position

I found this text in the Windows SDK helpfile:

BOOL GetCursorPos(

LPPOINT lpPoint // address of structure for cursor position
);


Parameters

lpPoint

Points to a POINT structure that receives the screen coordinates of the cursor.



Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The cursor position is always given in screen coordinates and is not affected by the mapping mode of the window that contains the cursor.
The calling process must have WINSTA_READATTRIBUTES access to the window station.

---------

The POINT structure defines the x- and y- coordinates of a point.

typedef struct tagPOINT { // pt
LONG x;
LONG y;
} POINT;


Members

x

Specifies the x-coordinate of the point.

y

Specifies the y-coordinate of the point.

------
And here is an example

POINT yourMousePos;

if (GetCursorPos(&yourMousePos) == 0)
MessageBox(0, "Mousepos could not be grabbed!", "Error", MB_ICONSTOP | MB_OK);
Iphone is offline   Reply With Quote