0

Making Mouse1 Pressed Without Physically Pressing

I mean, how can make left mouse button clicked in code without physically I press left mouse button. Also, one more thing, what actually happens when we press MOUSE1 or MOUSE2 and how does computer understand that we pressed something on keyboard or mouse?

7th Oct 2018, 1:12 PM
Mustafa K.
Mustafa K. - avatar
1 Answer
+ 1
#include <windows.h> #include <winable.h> int main() { while(true) { while(GetAsyncKeyState('Q')) { INPUT Input={0}; Input.type = INPUT_MOUSE; Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN; ::SendInput(1,&Input,sizeof(INPUT)); Sleep(10); ::ZeroMemory(&Input,sizeof(INPUT)); Input.type = INPUT_MOUSE; Input.mi.dwFlags = MOUSEEVENTF_LEFTUP; ::SendInput(1,&Input,sizeof(INPUT)); Sleep(10); } } } When u click mouse i can hear "Click" and when u press button on keyboard... hmm u can't hear anything xD lol xDDDDDDDDDDDDDD Meow :3 This code above will send click for u without clicking xD lel u can click by pressing Q :D ! WUUUUUUU xD but srsly nothing special is happening when u click :P just electricy is moving xDD y i know my english is great ! btw i luf cats <3 ! :3 lel meow ! xD
19th Dec 2018, 10:41 PM
Tobi PL
Tobi PL - avatar