title: Automatically pop up tablet touch keyboard on WinForms input focus
body: <p>When I run a WinForms (or Delphi, see at the end) application on Windows 10 in a tablet mode, a touch keyboard does not <a href="https://support.microsoft.com/en-us/windows/get-to-know-the-touch-keyboard-004f3d67-855b-27f0-6f7c-d5145f691181" rel="nofollow noreferrer">pop up automatically</a>, when an input box is focused.</p>
  <p>I believe that this should happen automatically, without any additional code/setup.</p>
  <hr />
  <p>For a test, I have the simplest VS 2015 WinForms desktop application with a single <a href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.textbox" rel="nofollow noreferrer"><code>TextBox</code> control</a>.</p>
  <p><a href="https://i.stack.imgur.com/QLxY5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QLxY5.png" alt="enter image description here" /></a></p>
  <p>It's simply the default Windows Forms Application C# project as created by Visual Studio. No code added, no properties changed. Just the <code>TextBox</code> was added, by dropping from the <em>Toolbox</em> (again no properties changed):</p>
  
  <pre class="lang-csharp prettyprint-override"><code>this.textBox1 = new System.Windows.Forms.TextBox();
  this.textBox1.Location = new System.Drawing.Point(64, 27);
  this.textBox1.Name = &quot;textBox1&quot;;
  this.textBox1.Size = new System.Drawing.Size(100, 20);
  this.textBox1.TabIndex = 0;
  </code></pre>
  <hr />
  <p>To verify my assumption that the pop up should be automatic:</p>
  <ul>
  <li><p>I've tried to run Windows XP version of <code>notepad.exe</code> on Windows 10. It automatically pops up the touch keyboard. I doubt the Windows XP had any explicit support for touch keyboards.</p>
  </li>
  <li><p>I've also tried some ancient MFC applications (for example FileZilla 2.2.15 from 2005). It also pops up the touch keyboard on all its input boxes. Again, I'm pretty sure, the MFC had no explicit support for touch keyboards either.</p>
  </li>
  <li><p>The same for applications built on wxWidgets (for example FileZilla 3.x).</p>
  </li>
  </ul>
  <hr />
  <p>It looks like there's something broken in WinForms that prevents the automatic popup. Interestingly, the automatic pop up works:</p>
  <ul>
  <li>for (editable) combo boxes (<code>ComboBox</code> with <code>DropDownStyle = DropDown</code>)</li>
  <li>for text boxes in a password mode (<a href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.textbox.passwordchar" rel="nofollow noreferrer"><code>TextBox.PasswordChar</code></a>)</li>
  <li>for rich text boxes (<code>RichTextBox</code>)</li>
  <li>when the input box has focus at the moment the hardware keyboard is &quot;removed&quot; (I test this by flipping the screen on Lenovo Yoga notebook), but never after.</li>
  </ul>
  <hr />
  <p>I've seen all the hints about an explicit popup by running the <code>TabTip.exe</code>. E.g.:</p>
  <ul>
  <li><a href="https://stackoverflow.com/q/15554786/850848">How to use Windows On-Screen Keyboard in C# WinForms</a></li>
  <li><a href="https://stackoverflow.com/q/14746263/850848">Open and close Windows 8 touch keyboard tabtip under desktop</a></li>
  <li><a href="https://stackoverflow.com/q/16832328/850848">How do I close the on-screen keyboard process from C# winform correctly?</a></li>
  <li><a href="https://stackoverflow.com/q/34874070/850848">Keyboard Winforms on Windows 10 (surface)</a></li>
  </ul>
  <p>Most of the &quot;solutions&quot; offer a code like this:</p>
  <pre class="lang-csharp prettyprint-override"><code>var progFiles = @&quot;C:\Program Files\Common Files\Microsoft Shared\ink&quot;;
  var keyboardPath = Path.Combine(progFiles, &quot;TabTip.exe&quot;);
  this.keyboardProc = Process.Start(keyboardPath);
  </code></pre>
  <p>But I cannot believe this could be the &quot;official&quot; way. If for nothing else, then because there's no clean way to hide the keyboard opened by running the <code>TabTip.exe</code> (solutions include hacks like killing the process or sending <kbd>Esc</kbd> key).</p>
  <p>And actually the above hack does not seem to work anymore in Windows 10 Anniversary Update:</p>
  <ul>
  <li><a href="https://stackoverflow.com/q/38774139/850848">Show touch keyboard (TabTip.exe) in Windows 10 Anniversary edition</a></li>
  </ul>
  <hr />
  <p>Interestingly, I see the same behavior with Delphi/C++ Builder/VCL applications. The keyboard does not pop up for edit boxes (<a href="https://docwiki.embarcadero.com/Libraries/en/Vcl.StdCtrls.TEdit" rel="nofollow noreferrer"><code>TEdit</code></a>). It does pop up for combo boxes (<a href="https://docwiki.embarcadero.com/Libraries/en/Vcl.StdCtrls.TComboBox" rel="nofollow noreferrer"><code>TComboBox</code></a>) and for edit boxes in a password mode (<a href="https://docwiki.embarcadero.com/Libraries/en/Vcl.StdCtrls.TEdit.PasswordChar" rel="nofollow noreferrer"><code>PasswordChar</code></a>). Interestingly not for <a href="https://docwiki.embarcadero.com/Libraries/en/Vcl.ComCtrls.TRichEdit" rel="nofollow noreferrer"><code>TRichEdit</code></a>, what is notable difference to .NET <code>RichTextBox</code>, that maybe worth investigating.</p>
  <p>This (unanswered) question describes an identical behavior:<br />
  <a href="https://stackoverflow.com/q/32370944/850848">Application written Delphi XE8 touch in edit boxes keyboard not appear in Windows 10</a>.</p>