I am working on some code in a DLL for a project. I use this in Java but the question is about C or C++ only.
When using java I used Robot to do keypresses but I quickly encountered the limitations about this. So I now use JNI to do keypresses via a C library.
In the C library I tried the keybd_event which I upgraded to SendInput and they work in almost every situation besides one. And let that one be the reason why I needed the C library in the first place.
In a program X you can set up key combinations like Ctrl+Shift+A. If you use my code when X is in the foreground it works perfect. But when you have a different application in the foreground it does not. The problem however is that when I do this not with my DLL code but just with the keyboard it works in both situations, leaving me with the idea that there may be better methods to call keypresses in windows.
What functions exactly mimics the keyboard in windows?