问题
For my current winforms win7 project I need to simulate some global hotkey presses.
I tried sending the keystrokes with SendMessage directly to the program interceptin the hotkeys, but that doesnt work. The program doesnt seem to handle incoming hotkeys when it's foccused / send directly to them.
How would I send simulated keypresses so that they get recognized as Global Hotkeys?
Thanks in advance!
EDIT: I dont want to Set hotkeys for my app, I want to trigger them in another application From my app. So my app will send Keystrokes somewhere, to be picked up by the other app. I dont know where to send them, sending them directly doesnt work
回答1:
You can use sendKeys:
SendKeys.Send("+^S");
This is for Ctrl+Shift+S
Check msdn: https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send(v=vs.110).aspx
来源:https://stackoverflow.com/questions/36207594/send-global-keystroke-fake-a-global-hotkey-from-a-winforms-application