float3701

ThouCursorLib_cursorThou

Apr 23rd, 2022
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. using namespace std;
  4.  
  5. //#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" )
  6.  
  7. //By using the cursorThou function, you can let your cursor teleport from side to side, but you need to run it every tick
  8. //cursorThou实现鼠标从一边翻转,你需要每一刻运行它
  9. void cursorThou() {
  10.     POINT   cursorPos;
  11.     int scrX = GetSystemMetrics(SM_CXFULLSCREEN)-2;
  12.     int scrY = GetSystemMetrics(SM_CYSCREEN)-2;
  13.  
  14. //CursLoop:
  15.  
  16.     //Sleep(10);
  17.     GetCursorPos(&cursorPos);
  18.     SetCursorPos(cursorPos.x < 1 ? scrX-1 : cursorPos.x, cursorPos.y);
  19.  
  20.     GetCursorPos(&cursorPos);
  21.     SetCursorPos(cursorPos.x > scrX ? 1+1 : cursorPos.x, cursorPos.y);
  22.  
  23.     GetCursorPos(&cursorPos);
  24.     SetCursorPos(cursorPos.x, cursorPos.y < 1 ? scrY - 1 : cursorPos.y);
  25.  
  26.     GetCursorPos(&cursorPos);
  27.     SetCursorPos(cursorPos.x, cursorPos.y > scrY ? 1 + 1 : cursorPos.y);
  28.  
  29. //  goto CursLoop;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment