c++ - Detect if mouse button is down -
i new c++ , trying activate line of code only when left mouse button held down. in example, code works seems toggles it. when click, spams h key then, when click again, stops.
currently have code:
if ((getkeystate(vk_lbutton))) { keybd_event(vkkeyscan('h'),0,0,0); sleep ( 30 ); }
edit:
i have inside function:
int winapi winmain ( hinstance hinst, hinstance p, lpstr cmd, int nshowcmd );
use determine if button pressed.
if((getkeystate(vk_lbutton) & 0x100) != 0)
Comments
Post a Comment