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 = 1024;
- const int SCREEN_HEIGHT = 768;
- const int START_WAIT = 2000;
- const int CLICK_DELAY = 4;
- 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 start, enter anything and press enter, and wait " << double(START_WAIT)/1000.0 << " seconds.\n";
- while (1) {
- getline(cin, waitstr);
- Sleep(START_WAIT);
- if (GetCursorPos(&p)) {
- input.mi.dx = p.x * (0xFFFF / SCREEN_WIDTH);
- input.mi.dy = p.y * (0xFFFF / SCREEN_HEIGHT);
- }
- for (int i = 0; i < 2000; ++i) {
- SendInput(1, &input, sizeof(INPUT));
- Sleep(CLICK_DELAY);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement