#include "stdafx.h"
#include "Windows.h"
int main()
{
// Step 1: Hide the cursor
ShowCursor(FALSE);
// Step 2: Lock the cursor to the center of the screen
RECT screenRect;
GetClientRect(GetDesktopWindow(), &screenRect);
int screenWidth = screenRect.right - screenRect.left;
int screenHeight = screenRect.bottom - screenRect.top;
SetCursorPos(screenWidth / 2, screenHeight / 2);
// Step 3: Capture the cursor
ClipCursor(&screenRect);
// Your application code goes here...
// Step 4: Release the cursor when done
ClipCursor(NULL);
ShowCursor(TRUE);
return 0;
}