Fixing the cursor at middle of screen

I want to fix my cursor on the middle of screen coordinate, how can I do that.

Kindly let me know where I will write the API and what .h file need to be included for that.

Search for SetCursorPos

But be careful - you won’t be able to move the mouse to close the window (or do anything else for that matter)

int x = 0;
int y = 0;
x = GetSystemMetrics(SM_CXSCREEN);
y = GetSystemMetrics(SM_CYSCREEN);
SetCursorPos(x/2,y/2);

SetCursorPos(GetSystemMetrics(SM_CXSCREEN)/2,
GetSystemMetrics(SM_CYSCREEN)/2);

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.