I want to understand why keybd_event does not work in some contexts. For example, it does not work in games with League of Legends or games emulated in ePSXe.
The following code:
Keys key = Keys.Q;
keybd_event((byte)key, 0x45, 0x0001 | 0, 0);
keybd_event((byte)key, 0x45, 0x0001 | 0x0002, 0);
It works in games like Terraria, but does not work in the games I mentioned earlier.
However, I noticed that if I try to hit Esc on ePSXe, it works and I'm taken to the main screen. The command has activated an emulator action, but does not activate game actions. I believe the same thing happens in League of Legends.
Why does not it work exactly? Is there maybe a way to make this work?