DirectInput
DirectInput
Hello, how are you. I am writing because I want to send keys via c++ code but because of DirectInput i clearly can't. I've been told to look into API hooking to hook DirectInput but i do not really know why is it needed. So i looked up what really DirectInput does and I found this:
The reverse of that is just what i need, been able to use SendMessage or kbd_event but since it ignores all this, i'm stucked in this problem.
Thanks!
EDIT: My question is how can i apply the tool in order to gain knowledge about this?
The reverse of that is just what i need, been able to use SendMessage or kbd_event but since it ignores all this, i'm stucked in this problem.
Thanks!
EDIT: My question is how can i apply the tool in order to gain knowledge about this?
Re: DirectInput
If APIs like kbd_event are ignored, that's surely ugly. API hooking with madCodeHook might make it possible for you to simulate keyboard and mouse events, but I'm not sure how difficult it would be to implement. Is DirectInput sending events to the application when a mouse/keyboard event occurs? Or is the application polling for keyboard/mouse events? In the latter case you would have to hook the DirectInput polling function, then you could return simulated events to the application calling the API. In the first case you would have to notify the application about keyboard/mouse events in the same way that DirectInput does.
Re: DirectInput
Thanks for the quick reply!
The application is polling for keyboard events, so I will have a look on how to hook the polling func as you said. I was doing some tests and saw that SendInput() func from AHK (AutoHotkey) is working. Since it's an open source project I will have a look at that but if you can help me i would be really grateful!
Again, thanks for the response!
good luckk
The application is polling for keyboard events, so I will have a look on how to hook the polling func as you said. I was doing some tests and saw that SendInput() func from AHK (AutoHotkey) is working. Since it's an open source project I will have a look at that but if you can help me i would be really grateful!
Again, thanks for the response!
good luckk
Re: DirectInput
Well, what AutoHotkey is doing works for you, then that's the cheaper and simpler way to achieve your goal.
Re: DirectInput
Well but let's say I want to implement it to my C++ code and not be working with AHK (Because I would need to read all the documentation, haha)
Re: DirectInput
Well, if you want to use madCodeHook, you'll need a license, and maybe a code signing certificate, and you'll have to get used to doing API hooking and stuff. I dare say it would be easier and faster for you to check the AHK code to see how they're doing that. If you're lucky, maybe they found some undocumented API they call, or something like that.
Re: DirectInput
Seems fair enough, thank you for all @madshi