Advertisement
Guest User

My autoclicker

a guest
Apr 19th, 2018
829
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. #define WINVER 0x0500
  2. #include <Windows.h>
  3. #include <iostream>
  4. #include <string>
  5. using namespace std;
  6.  
  7. int main () {
  8.     POINT pt;
  9.     bool hey;
  10.     hey = false;
  11.     int delay;
  12.     HWND hwnd;
  13.     cout << "delay: ";
  14.     cin >> delay;
  15.     while (0==0) {
  16.             if (GetAsyncKeyState(VK_HOME)) {
  17.                 hey = true;
  18.                 cout << "activated" << endl;
  19.             }
  20.             while (hey==true) {
  21.             hwnd = GetForegroundWindow();
  22.             Sleep(4);
  23.                 if (GetAsyncKeyState(VK_END)) {
  24.                     hey = false;
  25.                     cout << "deactivated" << endl;
  26.                 }
  27.         while (GetAsyncKeyState(VK_LBUTTON)) {
  28.             GetCursorPos(&pt);
  29.             SendMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(pt.x,pt.y));
  30.             Sleep(delay);
  31.             SendMessage(hwnd, WM_LBUTTONUP, 0, MAKELPARAM(pt.x,pt.y));
  32.             Sleep(delay);
  33.         }
  34.     }
  35.     }
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement