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. :)

Recommended Answers

All 3 Replies

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.

In windows you need to know system programming for using mouse event.

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.