locked
Win8: Recommended way to launch touch keyboard? RRS feed

  • Question

  • Is there any way to launch the touch screen keyboard on a Desktop Mode app using the Win32 API or WinRT APIs?  I looked through the Windows 8 API list but didn't see anything helpful.  Otherwise I guess I will just programmatically launch "tabtip.exe".
    Monday, August 13, 2012 8:07 PM

Answers

  • Okay, thanks for the help.  The piece of functionality I'm implementing is a button to launch the touch keyboard, so I would want the keyboard up even when the control is not focused.  As a result, I did go ahead with running tabtip.exe and it ended up working fine.
    • Marked as answer by Adam Gross Thursday, August 23, 2012 9:15 PM
    Thursday, August 23, 2012 9:15 PM

All replies

  • Hi,

    As far as I know, there are two ways to achieve this.

    You can create a custom control which implement ITextProvder and IValueProvider interface. You can follow this sample code
    http://code.msdn.microsoft.com/windowsapps/Touch-keyboard-sample-43532fda

    Another way is to use UI automation.
    http://msdn.microsoft.com/en-us/library/windows/apps/hh465404.aspx

    For more information, you can take a look this thread
    http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/d0b72a7c-ab28-425e-b4e4-a3f4bd559e43/

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, August 14, 2012 7:06 AM
  • Thanks for the response.  FWIW it seems that most of these links are Metro-specific and the documentation doesn't go into much detail about Desktop Mode alternatives.  I'm writing a C++ Desktop Mode app.
    Tuesday, August 14, 2012 1:05 PM
  • You  can use IValueProvider interface in desktop UI Automation
    http://msdn.microsoft.com/en-us/library/windows/desktop/ee671565(v=vs.85).aspx

    You can use this sample code
    http://code.msdn.microsoft.com/windowsdesktop/UI-Automation-Document-24a37c82

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, August 15, 2012 3:25 AM
  • Hi,

    Would you mind letting me know the result of the suggestions? If you need further assistance, feel free to let me know. I will be more than happy to be of assistance.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, August 22, 2012 1:44 AM
  • Unfortunately I'm still not understanding exactly what you are recommending that I do.  I have looked into IUIAutomationElement and the related interfaces and have only found ways to ask Windows for information.  I haven't been able to find any way to tell it to launch the Windows touch keyboard.

    Wednesday, August 22, 2012 2:56 PM
  • Hi,

     

    I mean that if our control implement ITextProvider and IValueProvider interface, the touch keyboard could launch when we focus on the control.

     

    But run the tabtip.exe also can lunch it.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, August 23, 2012 6:12 AM
  • Okay, thanks for the help.  The piece of functionality I'm implementing is a button to launch the touch keyboard, so I would want the keyboard up even when the control is not focused.  As a result, I did go ahead with running tabtip.exe and it ended up working fine.
    • Marked as answer by Adam Gross Thursday, August 23, 2012 9:15 PM
    Thursday, August 23, 2012 9:15 PM
  • hi, do you get a way to resolve this problem?
    Wednesday, December 19, 2012 8:30 AM
  • Please refer to my previous comment: "I did go ahead with running tabtip.exe and it ended up working fine".
    Wednesday, December 19, 2012 2:44 PM
  • I'm trying to solve this same problem. The documentation states that all of the standard Win32 controls already have UI Automation built in, so the previous posts about integrating UI Automation is irrelevant when using standard controls (in my case, a plain old Edit control).

    I've been able to add a handler for when the edit control receives focus, and from that I can invoke tabtip.exe, which brings up the keyboard. But then if I start typing on the keyboard, the input doesn't go to my control. Only if I touch it a 2nd time, after the keyboard comes up, will the input then go to the control. I've tried having the app reclaim focus, set the active window, etc., but none of those things eliminate the need to touch the edit control a 2nd time to get the touch keyboard input to go to that control. This is not an acceptable solution for this application.

    Also, although I can bring up the keyboard, there doesn't seem to be a solution to make it go away when the edit control loses focus. The only solution is to click the X in the upper right corner of the keyboard. This is also not an acceptable solution for this application (for other reasons I won't go into).

    I know that Microsoft really wants to push us all into the world of Metro apps, but doing it by breaking functionality that previously worked as desired in Windows 7 is extremely annoying. There has got to be some way to make this work in a standard (non-Metro) desktop app.

    Tuesday, March 5, 2013 4:48 PM
  • Desktop apps need to opt into the input tracking with IInputPanelConfiguration (and CLSID_InputPanelConfiguration).

    --Rob

    Wednesday, March 6, 2013 2:53 AM
  • Desktop apps need to opt into the input tracking with <IInputPanelConfiguration http://msdn.microsoft.com/en-us/library/windows/desktop/jj126267(v=vs.85).aspx> (and CLSID_InputPanelConfiguration).
    Rob, could you provide a link showing how to implement this exactly?
     

    David Wilkinson | Visual C++ MVP
    Wednesday, March 6, 2013 9:41 AM
  • An example of how to do this in an MFC dialog-based app would be most appreciated.

    Monday, March 25, 2013 10:08 PM
  • Ok, I think I'm close...

    // Opt into the Windows 8 touch keyboard
    CoInitializeEx(NULL, COINIT_MULTITHREADED);
    IInputPanelConfiguration *pIInputPanelConfiguration;
    Result = CoCreateInstance(CLSID_InputPanelConfiguration,
                              NULL,
                              CLSCTX_INPROC_SERVER,
                              IID_IInputPanelConfiguration,
                              (LPVOID *)&pIInputPanelConfiguration);
    if (Result == S_OK)
    {
        pIInputPanelConfiguration->EnableFocusTracking();
    }
    

    The problem is, the result of CoCreateInstance is E_NOINTERFACE.

    What am I doing wrong here?

    - Jay

    Monday, March 25, 2013 11:26 PM
  • Fixed it.

    I just needed to call CoInitializeEx with COINIT_APARTMENTTHREADED instead of COINIT_MULTITHREADED. Now it works exactly as desired.

    Tuesday, March 26, 2013 5:34 AM
  • Fixed it.
     
    I just needed to call CoInitializeEx with COINIT_APARTMENTTHREADED instead of COINIT_MULTITHREADED. Now it works exactly as desired.
    For which controls?
     

    David Wilkinson | Visual C++ MVP
    Tuesday, March 26, 2013 9:30 AM
  • Fixed it.
     
    I just needed to call CoInitializeEx with COINIT_APARTMENTTHREADED instead of COINIT_MULTITHREADED. Now it works exactly as desired.

    For which controls?
     

    David Wilkinson | Visual C++ MVP

    I am not too familiar with C++  (I here ya, so why am I posting in  a C++ forum, LOL).

    But does anyone have a clue how to implement the above in WPF C#.

    I am writing something for windows 8 desktop mode. 

    I can start TabTip manually. but I cannot minimize it when it is not required. And it sure takes a lot of real-estate.

    Any Help would be appreciated.

    Wednesday, April 17, 2013 2:55 PM
  • You can show the Windows 8 touch keyboard using the Window Store API's from within the WPF application:

    http://brianlagunas.com/showing-windows-8-touch-keyboard-wpf/

    Hope this helps

    Wednesday, December 18, 2013 3:32 AM
  • As already mentioned, the correct way for the keyboard to open up automatically is to implement some UI Automation control patterns, specifically ITextProvider/IValueProvider. It is a nuisance, but it works (and it is a cleaner way than launching some *.exe)

    I wrote a sample app and a short article here: http://blog.tombam.net/implementing-textbox-with-on-screen-touch-keyboard-part-1/

    • Edited by arvelius Wednesday, May 10, 2017 7:41 AM
    Wednesday, May 10, 2017 7:40 AM