[try Beta version]
Not logged in

 
Get Mouse klick, fire keyboard

Oct 26, 2015 at 3:45pm
Hi,

i have a mouse with forward and back mouse buttons and i want to use them within a game. The problem is that the games i want to play do not support that special mouse buttons.
So i thought i write a little program that listen for mouse button press and if forward/back/what ever special mouse button is pressed it fires an keyboard key event, so for example p that you never use in a game.

Maybe with a little gui where you can define the mouse button and the keyboard key that will be "connected".

I have a little experience with cpp and Qt.
(playing reversi on the console, list/stack/...)

I hope someone can tell me how to do that and point me in the right direction.


Thank you.
Oct 26, 2015 at 7:28pm
Use windows hooks(I.e., SetWindowsHookEx()) to monitor mouse events and use SendInput() to simulate a key press.

Hooks:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms632589%28v=vs.85%29.aspx

SetWindowsHookEx:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms644990%28v=vs.85%29.aspx

SendInput:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx

Hope this helps.
Topic archived. No new replies allowed.