我正在使用vb.net开发自己的屏幕键盘
我需要一个较低级别的键盘,该键盘可以在每个进程中进行编写。 在新的记事本文件上写我使用以下代码:
Dim hwnd As IntPtr = FindWindow(Nothing, "Untitled - Notepad")
If Not hwnd = IntPtr.Zero Then
SetForegroundWindow(hwnd)
SetFocus(hwnd)
keybd_event(VK_RETURN, 0, 0, 0)
Thread.Sleep(100)
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0)
End If
但是我需要这个键盘在各种文本编辑器和文件名中写入(不仅在文件“ untitled-Notepad”中)
在专注于表单之前,我如何专注于最后一个过程?
非常感谢
答案 0 :(得分:0)
进行设置,以免屏幕键盘一开始就无法聚焦,然后写入当前聚焦的窗口。
对于WinForms,请参见https://www.codeproject.com/Articles/71808/Creating-a-Form-That-Doesn-t-Take-Focus;对于WPF,请参见Not take focus, but allow interaction?。
答案 1 :(得分:0)
看着http://www.vbforums.com/showthread.php?459890
问题解决了vb.net屏幕键盘形式不能成为焦点。