title: How to close TextInputPanel
body: <p>I am porting a WPF application to run on a Windows 8 tablet.</p>
  
  <p>I want to make a TextInputPanel appear when a textbox gets focus and disappear when it looses focus.</p>
  
  <p>Making it appear is no problem but I can't seem to make it close.</p>
  
  <p>I have tried both Kill and CloseMainWindow on the process but get an InvalidOperationException - Cannot process request because the process has exited.</p>
  
  <p>I tried SendMessage but nothing.</p>
  
  <p>Any ideas?</p>
  
  <p>Some WinForm test code follows:</p>
  
  <pre><code>using System;
  using System.Diagnostics;
  using System.Runtime.InteropServices;
  using System.Windows.Forms;
  
  namespace VirtualKeyboard
  {
      public partial class Form1 : Form
      {
          [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
          static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
  
          static uint WM_CLOSE = 0x0010;
          static uint WM_QUIT = 0x0012;
  
          public Form1()
          {
              InitializeComponent();
          }
  
          private Process _keyboardProcess;
  
          private void Open_Click(object sender, EventArgs e)
          {
              _keyboardProcess = Process.Start(@"C:\Program Files\Common Files\microsoft shared\ink\tabtip.exe");
          }
  
          private void Close_Click(object sender, EventArgs e)
          {
              // tried all these
              //SendMessage(_keyboardProcess.Handle, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
              //SendMessage(_keyboardProcess.Handle, WM_QUIT, IntPtr.Zero, IntPtr.Zero);
              //_keyboardProcess.Kill();
              //_keyboardProcess.CloseMainWindow();
          }
  
      }
  }
  </code></pre>