问题
I have an WPF full screen application and I configured Skype´s "Focus Skype" Hotkey to Ctrl+F6 combination.
Now... How can I send this message to windows (Ctrl+F6)? I tried by sendkeys but is not working, it says that: "SendKeys cannot run inside this application because the application is not handling Windows messages. Either change the application to handle messages, or use the SendKeys.SendWait method."
I tried Sendkeys.sendwait method but it minimized my full screen application and I need it remains full screen.
any help or clue?
Thanks in advance
回答1:
Try this:
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
Private Const kbdDown = 0
Private Const kbdUp = 2
Private Sub SendKey(ByVal Key As Byte)
Call keybd_event(Key, 0, kbdDown, 0)
Call keybd_event(Key, 0, kbdUp, 0)
End Sub
The keycodes can be viewed here: http://www.codeproject.com/KB/system/keyboard.aspx
来源:https://stackoverflow.com/questions/6408168/sendkeys-from-wpf-application