从WPF应用程序的SendKeys [英] Sendkeys from WPF application
问题描述
我有一个WPF全屏幕应用程序,我配置Skype's聚焦Skype的热键为Ctrl + F6组合。
I have an WPF full screen application and I configured Skype´s "Focus Skype" Hotkey to Ctrl+F6 combination.
现在......我如何发送此消息窗口(按Ctrl + F6)?我试图通过的SendKeys,但不能正常工作,它说:。的SendKeys不能在此应用程序内运行,因为应用程序不处理Windows消息要么更改应用程序来处理邮件,或使用SendKeys.SendWait方法
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."
我试过Sendkeys.sendwait方法,但它减少我的全屏应用程序,我需要它仍然是全屏显示。
I tried Sendkeys.sendwait method but it minimized my full screen application and I need it remains full screen.
任何帮助或?线索
在此先感谢
推荐答案
试试这个:
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
的
键码可以在这里看到:
的 http://www.codeproject.com/KB/system/keyboard.aspx
这篇关于从WPF应用程序的SendKeys的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!