none
Can't open a floating keyboard upon touch of input fields while running a WPF app via Shell Launcher RRS feed

  • Question

  • I develop a WPF application that must support touch (including a floating keyboard that appears upon touching input fields such as textboxes) and also must support running my WPF app exe file in a shell mode. 

    I run my WPF app exe file in shell mode as following:




    The code I use for opening the floating keyboard via touch is as following:

        txtUserName.TouchUp += ShowKeyboard;
        txtUserName.LostFocus += CloseKeyboardProcess;



    And the implementation of those two methods is as following:

       
     private void ShowKeyboard(object sender, RoutedEventArgs e)
        {
                var touchKeyboardPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles) +
                                        @"\Microsoft Shared\ink\TabTip.exe";
                _keyProccesl = Process.Start(touchKeyboardPath);
        }
    
            [DllImport("user32.dll")]
            public static extern int FindWindow(string lpClassName, string lpWindowName);
    
            [DllImport("user32.dll")]
            public static extern int SendMessage(int hWnd, uint Msg, int wParam, int lParam);
    
            private void CloseKeyboardProcess(object sender, RoutedEventArgs e)
            {
                try
                {
                    var iHandle = FindWindow("IPTIP_Main_Window", "");
                    if (iHandle > 0)
                    {
                        SendMessage(iHandle, 0x0112, 0xF060, 0);
                    }
                }
                catch (Exception ex)
                {
                    Logger.WriteErr(LogCode.WIN_KEYBOARD_CLOSE_FAILED, ex);
                }
            }



    The _keyProcess1 is just a private member of the class:
         private Process _keyProccesl;




    Now, let me describe the problem I've encounterd:

    When I run my WPF app in a regular mode (NOT in a shell mode as described above), everything works perfectly: When I touch a textbox, the floating keyboard appears. When I get out of the text box (losing focus), the floating keyboard indeed closes.

    The problem occurs ONLY when I run my WPF app exe file in a shell mode.
    When I do that, NO floating keyboard appears when I touch an input textbox (same action that has worked perfectly in a regular non-shell mode).

    Now let me describe all the actions that I've tried to apply to make this work in a shell mode:

     1. Adding the following two reg entries did NOT fix the problem:
    HKCU\Software\Microsoft\TabletTip\1.7\EnableDesktopModeAutoInvoke = 1 
    HKCU\Software\Microsoft\windows\CurrentVersion\ImmersiveShell\TabletMode = 1

    Also, NOT these ones:

    HKLM\Software\Microsoft\TabletTip\1.7\EnableDesktopModeAutoInvoke = 1
    HKLM\Software\Microsoft\windows\CurrentVersion\ImmersiveShell\TabletMode = 1

     2. I've tried to apply a Nuget package as described here:

    https://stackoverflow.com/questions/45227217/onscreen-keyboard-issue-with-wpf-classic-windows-app-as-custom-shell-on-windows

    The nuget package of: 

    Osklib.Wpf

    Did NOT work.

     3. I've tried to apply a Nuget package as described here:

    https://www.nuget.org/packages/WPFTabTip/

    The nuget package of: 

    WPFTabTip

    Did NOT work.

    Note that all these 3 work well in a regular non-shell mode.

    --------------------------------------------------

    The ONLY thing that has worked for me is trying to open the following process:
        (Environment.GetFolderPath(Environment.SpecialFolder.System) + Path.DirectorySeparatorChar + "osk.exe");



    This is the ONLY thing that works for me in a shell mode, but this is NOT a good solution for me because it opens the keyboard as a separate window (on screen keyboard), and NOT as an embedded keyboard into my WPF app as the TabTip.exe does.

    Your kind assistance will be greatly appreciated, thank you!


    Monday, May 28, 2018 12:02 PM

All replies

  • Hi DK1987,

    Some questions:

    1. What's the OS version? Pro or Enterprise? Build Version?

    2. Whether the TouchUp event handler has been triggered in shell mode or not.

    3. Have you confirmed that if manually executing Taptip.exe to show virtual keyboard in shell mode is working well?


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 29, 2018 3:42 AM
    Moderator
  • Hello, here are the answers to your questions: 
    1. Windows 10
    Enterprise
    Version: 1709
    OS Build: 16299.431

    2. The process start method is invoked.
    To make sure, I've tried to write this code inside a button click event handler, that also set the focus for textbox after opening the process (the focus is indeed set).

    3. Wow, I can't open it manually. That is surprising. So I guess this is an issue with windows and not in my code. 
    What can I do about it? 

    Let me please elaborate more about how I open the app in shell mode:

    You need to configure windows to run in shell Launcher mode. (please follow these instructions)

    https://docs.microsoft.com/en-us/windows-hardware/customize/enterprise/shell-launcher

    In this article you will find a script, you need to configure it to run your own application.

    After you will configure windows to run in a shell mode, after restart you will get windows login screen with floating touch keyboard (it does work in Microsoft's windows login page)
    do the login and after that, your application should run (in shell mode, you will not see windows desktop).
    Now in my case, when I touch input fields or click a button that is supposed to open the mentioned process, no floating keyboard appears.

    Thank you for your help!


    • Edited by DK1987 Tuesday, May 29, 2018 12:46 PM
    Tuesday, May 29, 2018 12:46 PM