Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #define WINVER 0x0601
- #include <windows.h>
- using namespace std;
- const int SCREEN_WIDTH = 1360;
- const int SCREEN_HEIGHT = 768;
- const int CLICK_DELAY = 10; // in milliseconds
- int main() {
- INPUT input;
- input.type = INPUT_MOUSE;
- input.mi.dwFlags = (MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE|MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP);
- input.mi.mouseData = 0;
- input.mi.dwExtraInfo = NULL;
- input.mi.time = 0;
- POINT p;
- string waitstr;
- cout << "To activate, press DELETE.\n";
- bool active = false;
- while (true) {
- SHORT keyState = GetAsyncKeyState(VK_DELETE);
- bool isToggled = keyState & 1;
- if (isToggled) {
- active = !active;
- }
- if (active) {
- if (GetCursorPos(&p)) {
- p.x += 3;
- p.y += 2;
- input.mi.dx = p.x * (0xFFFF / SCREEN_WIDTH);
- input.mi.dy = p.y * (0xFFFF / SCREEN_HEIGHT);
- }
- SendInput(1, &input, sizeof(INPUT));
- Sleep(CLICK_DELAY);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement