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 - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -