I am creating an auto-clicker for Roblox that clicks whenever you hold down the left click. I can't use getasynckeystate for an obvious reason, so I tried sending the click message whenever left click was held. This works for all the games I play except Roblox. I started thinking maybe it was RawInput, so I tried to send a WM_INPUT. I figured each time it's clicking I need to get the data put it into the mouse structure, and that is what would make the hrawinput change and actually properly define the click. I've been trying to figure this out for sometime, but I am stuck on this. The hrawinput is staying the same regardless which doesn't make sense to me. I thought I knew what decides the hrawinput code, but I guess I was wrong. This is wrote as the code.
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,x,y,clickboost,spin,times;
bool tehee = false;
bool hey = false;
RAWMOUSE mouse;
PUINT numdevices;
POINT C;
HWND hwnd;
while (0==0) {
if (GetAsyncKeyState(VK_LBUTTON)) {
//getting the mouse cursor position to put into the message
GetCursorPos(&C);
hwnd = GetForegroundWindow();
PostMessage(hwnd,WM_LBUTTONDOWN,0,MAKELPARAM(C.x,C.y));
//starting to set the parameters in the structure so I can put it into a WM_INPUT and try to fool Roblox into thinking it's a real click
mouse.usFlags =MOUSE_MOVE_ABSOLUTE;
mouse.usButtonFlags=MOUSEEVENTF_LEFTDOWN;
mouse.lLastX = C.x;
mouse.lLastY = C.y;
PostMessage(hwnd,WM_INPUT,RIM_INPUT,(LPARAM)&mouse);
Sleep(20);
PostMessage(hwnd,WM_LBUTTONUP,0,MAKELPARAM(C.x,C.y));
mouse.usFlags =MOUSE_MOVE_ABSOLUTE;
mouse.usButtonFlags=MOUSEEVENTF_LEFTUP;
mouse.lLastX = C.x;
mouse.lLastY = C.y;
PostMessage(hwnd,WM_INPUT,RIM_INPUT,(LPARAM)&mouse);
Sleep(20);
}
}
}