简体   繁体   中英

Programmatically hide Win7 touch keyboard prompt in text box? VB.net WPF app

I have a WPF application that was originally developed in VB.net 2010 Express. It worked great on Windows XP, and it works great on non-touchscreen Windows 7 machines.

The app is designed for touchscreen usage and has a UI sorted out with big buttons for editing numbers, etc. It even has a little onscreen keyboard with only the buttons needed for the app so you can't get out into Windows.

Unfortunately, I now need to use 99.9% of the code to develop a new version of the app for a Windows 7 touchscreen machine. It has proper touchscreen drivers (hooray!) instead of mouse emulation (boo), but whenever you highlight a text box it makes Win7's little "open the OSK" prompt appear, which jams over top of my UI.

Picture here: http://i.imgur.com/W8XthZF.jpg

Can I just adjust the TextBox somehow to say "don't show the Win7 OSK prompt"? FWIW I am now using Visual Studio Express 2013, still programming in VB.net but targeting .NET 4.5.2.

Obviously the janky solution is to move the TextBox down far enough the thing doesn't overlap, but I'd also like to remove a convenient way for users to start up the Win7 on-screen keyboard and just hit the win key and start playing Solitaire or whatever.

The keyboard is handled by a process called tabtip.exe usually site in @"C:\\Program Files\\Common Files\\microsoft shared\\ink\\tabtip.exe";

1) you can kill the process.:

                var p = Process.GetProcesses();
                var n = p.Where(x => x.ProcessName.ToLower().Contains("tabtip"));
                foreach (var item in n)
                {
                    try
                    {
                        item.CloseMainWindow();
                        //item.Kill(); 
                    }
                    catch { }
                }

2) Use the windows 32 message to hide (my experience is that not always work):

    var p = Process.GetProcesses();
    var n = p.Where(x => x.ProcessName.ToLower().Contains("tabtip")).FirstOrDefault();
    if (n != null)
    {
        n.CloseMainWindow();
    }

OR one of that

        //  SendMessage(_keyboardProcess.Handle, WS_MINIMIZE, IntPtr.Zero, IntPtr.Zero);
        //  SendMessage(_keyboardProcess.Handle, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
        //  SendMessage(_keyboardProcess.Handle, WM_QUIT, IntPtr.Zero, IntPtr.Zero);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM