开发者

Sendkeys from WPF application

I have an WPF full screen application and I configured Skype开发者_如何学C´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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜