-
July 22nd, 2018, 12:59 AM
#1
I need help figuring out why this auto-clicker doesn't work on some windows.
Code:
#ifdef __MINGW32__
#define _WIN32_WINNT 0x0501
#endif // __MINGW32__
#include <iostream>
#include <windows.h>
#include <string>
using namespace std;
LPVOID mousedown {
};
int main()
{
int delay,y,clickboost,x,spin,times;
bool tehee = false;
POINT C;
HWND hwnd;
cout << "delay: ";
cin >> delay;
while (0==0) {
if (GetAsyncKeyState(VK_MBUTTON)) {
tehee = true;
cout << "activated" << endl;
while (GetAsyncKeyState(VK_MBUTTON)) {
}
}
while (tehee==true) {
hwnd = GetForegroundWindow();
GetCursorPos(&C);
x = C.x;
y = C.y;
if (GetAsyncKeyState(VK_LBUTTON)) {
PostMessage(hwnd,WM_LBUTTONDOWN,MK_LBUTTON,MAKELPARAM(x,y));
SendMessage(hwnd,WM_SETCURSOR,(WPARAM)hwnd,MAKELPARAM(HTCLIENT,WM_LBUTTONDOWN));
Sleep(delay);
PostMessage(hwnd,WM_LBUTTONUP,MK_LBUTTON,MAKELPARAM(x,y));
SendMessage(hwnd,WM_SETCURSOR,(WPARAM)hwnd,MAKELPARAM(HTCLIENT,WM_LBUTTONUP));
Sleep(delay);
}
if (GetAsyncKeyState(VK_MBUTTON)) {
tehee = false;
cout << "deactivated" << endl;
while (GetAsyncKeyState(VK_MBUTTON)) {
}
}
}
}
}
I made an auto-clicker a couple weeks back that you use 'Z' to activate and deactivate. I then thought it'd be nice to have an auto-clicker that clicks when the left mouse button is held down. I first tried a loop with mouse_event, but that puts itself in an infinite loop due to mouse_event inputting VK_LBUTTON input, so you can't use getasynckeystate. I also can't use a hook because I have sleep statements in there, and passing those through a hook would slow down the whole computer. I discovered messages, and I knew this was how I would do it. The problem is this works on most games and windows, but on games like Roblox or windows like Foobar these don't click. I tried to add adding WM_SETCURSOR to make it work, but this didn't do anything. I am at a loss as I have been at this for a while. If someone has made something like this before, I would greatly appreciate the help.
-
July 22nd, 2018, 11:00 AM
#2
Re: I need help figuring out why this auto-clicker doesn't work on some windows.
Look at using SendInput api.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|