Hi all!
I'm trying to write a program using the GetCursorPos() and SetCursorPos() functions. When my program isn't sleeping, I want it to set the cursor position to +1 (each axis) of what it is when I call GetCursorPos().
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
DWORD timer = strtol(lpCmdLine,NULL,10);
LPPOINT lpPoint;
int x;
int y;
// while(1)
{
Sleep(timer);
GetCursorPos(lpPoint);
x = (lpPoint->x)+1;
y = (lpPoint->y)+1;
SetCursorPos(x,y);
}
return 0;
}
I'm getting a warning saying that lpPointer has been used without having been initialized, but I thought that GetCursorPos() does initialize it. Also, if I take out the x and y assingment statements, and change SetCursorPos() to trivial ints, it works, but still gives the uninitialized error (lpPointer). Therefore, the problem could be with the assignment statements, though I figure it's more likely something I'm doing wrong with lpPoint.
I'm using VC++ 6, if that's of any consequence.
[edit] Added in the +1's.