title: Determine if Windows 10 Touch Keyboard is Visible or Hidden
body: <p>I am trying to find out if the windows 10 virtual touch keyboard is visible or not to know whether to open it or not from my application. THe following code has worked fine up until the latest Windows 10 update 15063 or possible the one right before it. Seems like Microsoft changed something with the window styles possibly but I can't figure it out.</p>
  
  <pre><code>    public static bool IsKeyboardVisible()
      {
          IntPtr keyboardHandle = GetKeyboardWindowHandle();
          // Specifies we wish to retrieve window styles.
          int GWL_STYLE = -16;
  
          //The window is disabled. See http://msdn.microsoft.com/en-gb/library/windows/desktop/ms632600(v=vs.85).aspx.
          UInt32 WS_VISIBLE =               0x10000000;
          UInt32 WS_DISABLED =              0x08000000;
          UInt32 WS_POPUP =                 0x80000000;
  
  
          bool visible = false;
          bool disabled = false;
  
          if (keyboardHandle != IntPtr.Zero)
          {
              UInt32 style = GetWindowLong(keyboardHandle, GWL_STYLE);
              visible = ((style &amp; WS_VISIBLE) == WS_VISIBLE);
              disabled = ((style &amp; WS_DISABLED) == WS_DISABLED); // ref https://stackoverflow.com/questions/11065026/get-window-state-of-another-process
              log.InfoFormat("style:{0:X4} visible:{1} disabled:{2}", style, visible, disabled);
          }
  
          return visible &amp;&amp; !disabled ;
      }
  </code></pre>
  
  <p>This is related to: <a href="https://stackoverflow.com/questions/38774139/show-touch-keyboard-tabtip-exe-in-windows-10-anniversary-edition">Show touch keyboard (TabTip.exe) in Windows 10 Anniversary edition</a></p>