EzicMan

superAutoClicker

Mar 16th, 2019
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <windows.h>
  2. #include <iostream>
  3. #include <algorithm>
  4.  
  5. bool KeyIsPressed ( unsigned char k ) {
  6.     USHORT status = GetAsyncKeyState ( k );
  7.     return (( ( status & 0x8000 ) >> 15 ) == 1) || (( status & 1 ) == 1);
  8. }
  9.  
  10. int WINAPI WinMain ( HINSTANCE hInst, HINSTANCE P, LPSTR CMD, int nShowCmd ) {
  11.     int clicks;
  12.     bool paused = false;
  13.     std::cin >> clicks;
  14.     HWND target = GetForegroundWindow ( );
  15.     //  pt is for the mouse position, wrect is for the client information. The mouse coords to be sent to the window
  16.     //      must be relative to the top-left corner of the client area, so I have to include that too.
  17.     POINT pt;
  18.     RECT wrect;
  19.     bool lastkey = false;
  20.     bool curkey = false;
  21.     bool choosed = false;
  22.     while ( true ) {
  23.         curkey = KeyIsPressed ( VK_CONTROL ) && KeyIsPressed ( 'Q' );
  24.         //  ctrl + T to make the front-most window the targetted window
  25.         if ( KeyIsPressed ( VK_CONTROL ) && KeyIsPressed ( 'Y' ) ) {
  26.             target = GetForegroundWindow ( );
  27.             GetCursorPos ( &pt );
  28.             choosed = true;
  29.         }
  30.  
  31.         //  ctrl + esc to quit
  32.         if ( KeyIsPressed ( VK_CONTROL ) && KeyIsPressed ( VK_ESCAPE ) ) {
  33.             break;
  34.         }
  35.  
  36.         if ( curkey == true && lastkey == false ) {
  37.             paused = !paused;
  38.         }
  39.         lastkey = curkey;
  40.         if(!paused && choosed){
  41.             //  Final argument holds the mouse positions
  42.             PostMessage ( target, WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x,pt.y) );
  43.             Sleep ( std::max<int>(1000.0 / clicks,1) );
  44.  
  45.             PostMessage ( target, WM_LBUTTONUP, 0, MAKELPARAM(pt.x,pt.y) );
  46.             Sleep ( std::max<int>(1000.0 / clicks,1) );
  47.         }
  48.  
  49.     }
  50.  
  51.     return 0;
  52.  
  53. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×