我一直在寻找,但仍无法找到有关此问题的答案。我已设法通过此代码打开标签提示的过程:
Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles TextBox1.GotFocus Process.Start("C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe") End Sub
我一直试图杀死这个过程,但它仍然不起作用。
但要将其归还停靠或关闭。仍然找不到任何答案。这可能吗?希望有人帮忙。谢谢! :)
答案 0 :(得分:3)
/// <summary>
/// Close Touch Keyboard
/// </summary>
public static void CloseTouchKeyboard()
{
try
{
foreach (var p in Process.GetProcessesByName("C:\\Program Files\\Common Files\\microsoft shared\\ink\\TabTip.exe"))
{
p.Kill();
}
}
catch (Exception e)
{
Logger.Error(e.ToString());
}
}
/// <summary>
/// Open Touch keyboard
/// </summary>
public static void OpenTouchKeyboard()
{
try
{
Process.Start("C:\\Program Files\\Common Files\\microsoft shared\\ink\\TabTip.exe");
}
catch (Exception e)
{
Logger.Error(e.ToString());
}
}
答案 1 :(得分:1)
Process.Close,CloseMainWindow等对我不起作用,所以发送此消息以关闭键盘。
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(String sClassName, String sAppName);
int WM_SYSCOMMAND = 274
uint SC_CLOSE = 61536
...
IntPtr KeyboardWnd = FindWindow("IPTip_Main_Window", null);
PostMessage(KeyboardWnd , WM_SYSCOMMAND, SC_CLOSE, 0);
感谢http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/de9b66b5-f1e2-477c-9da2-303982790f63/获得答案!