title: Can' t close OSK.exe under Windows 10
body: <p>I use below code to open osk.exe</p>
  
  <pre><code>HINSTANCE Dlg::ExecuteOSK()
  {
      typedef BOOL (WINAPI * LPFN_IsWow64Process)(HANDLE, PBOOL);
      typedef BOOL (WINAPI * LPFN_Wow64DisableWow64FsRedirection)(PVOID *);
      typedef BOOL (WINAPI * LPFN_Wow64RevertWow64FsRedirection)(PVOID);
      LPFN_IsWow64Process fnIsWow64Process = NULL;
      LPFN_Wow64DisableWow64FsRedirection fnWow64DisableWow64FsRedirection = NULL;
      LPFN_Wow64RevertWow64FsRedirection fnWow64RevertWow64FsRedirection = NULL;
      fnIsWow64Process = (LPFN_IsWow64Process) GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
      fnWow64DisableWow64FsRedirection = (LPFN_Wow64DisableWow64FsRedirection) GetProcAddress(GetModuleHandle(TEXT("kernel32")), "Wow64DisableWow64FsRedirection");
      fnWow64RevertWow64FsRedirection = (LPFN_Wow64RevertWow64FsRedirection) GetProcAddress(GetModuleHandle(TEXT("kernel32")), "Wow64RevertWow64FsRedirection");
      BOOL bIsWow64 = FALSE;
      PVOID OldValue = NULL;
      HINSTANCE handle;
      if (NULL == fnIsWow64Process || NULL == fnWow64DisableWow64FsRedirection || NULL == fnWow64RevertWow64FsRedirection)
      {
          handle = ::ShellExecute(NULL, "open", "OSK", NULL, NULL, SW_SHOW);
      }
      else
      {
          fnIsWow64Process(GetCurrentProcess(), &amp;bIsWow64);
  
          if (TRUE == bIsWow64)
          {
              fnWow64DisableWow64FsRedirection(&amp;OldValue);
              handle = ::ShellExecute(NULL, "open", "OSK", NULL, NULL, SW_SHOW);
              fnWow64RevertWow64FsRedirection(OldValue);
          }
          else
          {
              handle = ::ShellExecute(NULL, "open", "OSK", NULL, NULL, SW_SHOW);
          }
      }
      return handle;
  }
  </code></pre>
  
  <p>And then, I want to close the osk.exe when user press enter.</p>
  
  <pre><code>BOOL CALLBACK EnumWindowsProc(
    _In_ HWND   hwnd,
     _In_ LPARAM lParam)
  {
      char name[256];
      GetClassName( hwnd, name, sizeof(name) );
      if(strcmp(name,"OSKMainClass") == 0)
          SendMessage(hwnd, WM_CLOSE  , NULL, NULL); //I have tried WM_DESTROY
      return TRUE;
  }
  
  BOOL Dlg::PreTranslateMessage(MSG* pMsg) 
  {
      if (pMsg-&gt;message == WM_KEYDOWN)
      {       
          int nKey = (int)pMsg-&gt;wParam;       
  
          switch(nKey)            
          {
          case VK_RETURN:     
              EnumWindows(EnumWindowsProc, NULL);
  
          }
      }
  
      return CBitmapDialog::PreTranslateMessage(pMsg);
  }
  </code></pre>
  
  <p>However, this part of code cannot be used to close osk.exe successful.</p>
  
  <p>I have tried to catch another window, it can be closed successfully.</p>
  
  <p>Does it is an issue on Windows 10?</p>