[英]How to open tabtip keyboard in a custom location?
How can I open the tabtip keyboard in a custom location? 如何在自定义位置打开Tabtip键盘?
This is my code: 这是我的代码:
Private tabtipProcess As Process
Private Sub t_Enter(sender As Object, e As EventArgs)
tabtipProcess = Process.Start("tabtip")
End Sub
- For the record, you cannot seem to programmatically change the location of tabtip. -为了记录,您似乎无法以编程方式更改tabtip的位置。
You can P/Invoke (also known as Platform Invoke ) the WinAPI's SetWindowPos()
function and send your process's MainWindowHandle
to it. 您可以P / Invoke(也称为Platform Invoke )WinAPI的
SetWindowPos()
函数 ,并将进程的MainWindowHandle
发送给它。 Then you just specify the coordinates where you want to put the window. 然后,您只需指定要放置窗口的坐标即可。
<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As Integer) As Boolean
End Function
Const SWP_NOSIZE As Integer = &H0001
Private tabtipProcess As Process
Private Sub t_Enter(sender As Object, e As EventArgs)
tabtipProcess = Process.Start("tabtip")
tabtipProcess.WaitForInputIdle()
SetWindowPos(tabtipProcess.MainWindowHandle, IntPtr.Zero, 300, 200, 0, 0, SWP_NOSIZE)
End Sub
The above example will put the window at coordinates (300, 200). 上面的示例将窗口置于坐标(300,200)。
The tabtipProcess.WaitForInputIdle()
call is necessary as it is used to wait until the application has finished loading and a window handle has been created. tabtipProcess.WaitForInputIdle()
调用是必需的,因为它用于等待应用程序完成加载和创建窗口句柄。 Without it tabtipProcess.MainWindowHandle
will most likely return 0
and result in an error when calling the SetWindowPos()
function. 没有它,
tabtipProcess.MainWindowHandle
很可能会返回0
并在调用SetWindowPos()
函数时导致错误。
Passing the SWP_NOSIZE
flag tells the function that the window should retain its current size. 传递
SWP_NOSIZE
标志告诉函数该窗口应保留其当前大小。
After finally testing my previous answer I can confirm that (as you said) it doesn't work, so I did some research. 最终测试完我先前的答案后,我可以确认(如您所说)它不起作用,因此我做了一些研究。
There are a few others that have also wanted to change its location, so after reading a few posts and after I performed some testing myself, it would seem that the tabtip
application has been designed to trap certain window messages (more specifically WM_MOVE and/or WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED ) which makes you unable to change its location or size programmatically using the standard methods. 还有一些其他人也想更改其位置,因此在阅读了几篇文章并且对自己进行了一些测试之后,
tabtip
应用程序似乎已设计为捕获某些窗口消息(更具体地说是WM_MOVE和/或WM_WINDOWPOSCHANGING和WM_WINDOWPOSCHANGED ),这使您无法使用标准方法以编程方式更改其位置或大小。
At this point there doesn't seem to be a way to modify its location. 目前,似乎还没有办法修改其位置。
You can do this by altering the registry values of the tabtip. 您可以通过更改tabtip的注册表值来实现。
Like this: 像这样:
My.Computer.Registry.SetValue(
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\TabletTip\1.7",
"OptimizedKeyboardRelativeXPositionOnScreen",
&HDB1D,
Microsoft.Win32.RegistryValueKind.DWord
)
My.Computer.Registry.SetValue(
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\TabletTip\1.7",
"OptimizedKeyboardRelativeYPositionOnScreen",
&H12016,
Microsoft.Win32.RegistryValueKind.DWord
)
The two hex values are the locations of your x and y. 两个十六进制值是x和y的位置。
Geoff. 杰夫。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.