Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- using namespace std;
- //#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" )
- //By using the cursorThou function, you can let your cursor teleport from side to side, but you need to run it every tick
- //cursorThou实现鼠标从一边翻转,你需要每一刻运行它
- void cursorThou() {
- POINT cursorPos;
- int scrX = GetSystemMetrics(SM_CXFULLSCREEN)-2;
- int scrY = GetSystemMetrics(SM_CYSCREEN)-2;
- //CursLoop:
- //Sleep(10);
- GetCursorPos(&cursorPos);
- SetCursorPos(cursorPos.x < 1 ? scrX-1 : cursorPos.x, cursorPos.y);
- GetCursorPos(&cursorPos);
- SetCursorPos(cursorPos.x > scrX ? 1+1 : cursorPos.x, cursorPos.y);
- GetCursorPos(&cursorPos);
- SetCursorPos(cursorPos.x, cursorPos.y < 1 ? scrY - 1 : cursorPos.y);
- GetCursorPos(&cursorPos);
- SetCursorPos(cursorPos.x, cursorPos.y > scrY ? 1 + 1 : cursorPos.y);
- // goto CursLoop;
- }
Advertisement
Add Comment
Please, Sign In to add comment