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) 

http://vcpptips.wordpress.com/tag/vk_lbutton/


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -