I've recently started college at Digipen, and have developed carpal tunnel already from all the writing/coding/etc... but fortunately for me, I'm learning to be a programmer, and have already made a few programs to assist with things like opening command prompt/bat files faster/without clicking, etc.

Since clicking the mouse is significantly more difficult for me than typing, I was wanting to make a simple program that would just run in the background, and click the mouse for me any time I press a specific key on the keyboard. I don't really know where to start with this though, and have never used anything but standard c so far. Also, being able to move the mouse with keypresses would be handy at times as well.

Thanks for the help. :)

Oh and I should probably mention that I will be using this on both windows vista and 7, and of course I'll be the only one using it.

There is a function called GetAsyncKeyState() in windows.h header. Example :

      if(GetAsyncKeyState(VK_LSHIFT))
      {
         printf("The left shift Has Been Pressed\n");
      }

Here is the definiton : GetAsyncKeyState() is a function that returns a SHORT value (on 32bit processors that is a 2 value, half the size of a normal int). The SHORT value will be non-zero (positive) if the key specified is pressed down at the instant the functions is called.

Now this function also works with mouse buttons. Check this page to learn more about GetAsyncKeyState()

Generally GetAsyncKeyState()is a function used often in hacks, for navigating menus, detecting key presses in the case of nonmenu hacks and so on.

You can also link mouse_event() to GetAsyncKeyState(), but this part, you have to think it on your own :)

This article has been dead for over six months. Start a new discussion instead.