CodePudding user response:
//load the English keyboard
HKL m_hHKL=LoadKeyboardLayout (TEXT (" 00000409 "), KLF_ACTIVATE);
If (m_hHKL) {
VERIFY (ActivateKeyboardLayout (m_hHKL KLF_SETFORPROCESS));
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
//SetIMEOpenClose ()
//
//This routines calls IMM API to open or close the IME.
//
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Void SetIMEOpenClose (HWND HWND, BOOL fFlag) {
HIMC HIMC;
//If fFlag is TRUE then the open IME. FALSE close it.
If (! (hIMC=ImmGetContext (hWnd))) return;
ImmSetOpenStatus (hIMC fFlag);//return 1
ImmReleaseContext (hWnd, hIMC);
}