Knowledge Base Nr: 00162 setcursorpos.cpp - http://www.swe-kaiser.de

Win32: Mauszeiger global setzen

  
#include <windows.h>

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
{
char* px = strstr(lpCmdLine, "x=");
char* py = strstr(lpCmdLine, "y=");

if (!px || !py)
{
::MessageBox(0, "usage: setcursorpos x=123 y=123", "setcursorpos", MB_OK);
return 1;
}

int x = atoi(px+2);
int y = atoi(py+2);

::SetCursorPos(x, y);

return 0;
}