WINCE下一般都沒有鍵盤做為輸入,所以如果要輸入漢字的話,方法一是在IMEdll中彈出SIP軟鍵盤來按鍵,方法二當然就是手寫輸入了。
我們用的是方法一,OS固化IME後,從開機,IME的status window就一直在,因為一直都有IMN_OPENSTATUSWINDOW訊息通知IMEDLL開啟status window。
這時就要想法隱藏掉tatus window了,
方法一:
HIMC ImmAssociateContext(
HWND hWnd,
HIMC hIMC
);
在OnInitDialog或初始化視窗時調用ImmAssociateContext(GetSafeHwnd(), NULL); 把hIMC置空,可以隱藏該視窗的status window。
方法二:
BOOL ImmDisableIME(
DWORD idThread
);
ImmDisableIME在WINCE下參數只能用0。ImmDisableIME(0);
該方法使該進程內都禁用IME,而不像方法一是使一個視窗不用IME。
要注意的是:ImmDisableIME要在該進程建立任何視窗前調用才會成功。所以一個好地方是CWinApp的InitInstance。
不知道有沒有這樣的方法,讓WINCE一開機,沒有IME視窗,到我要用IME時能調出IME視窗,好象這樣才是最好的辦法。
另外windows禁用IME的情況,可能是一個edit或某些edit禁用IME,這樣的解決方案是:
http://topic.csdn.net/t/20050913/19/4267382.html
HIMC m_hImc; // 全域或者成員變數
// Function for Disabling IME
void CMyDialog::DisableIME()
{
HWND hWnd = GetDlgItem(IDC_EDIT1)->m_hWnd;
if (hWnd && IsWindow(hWnd))
{
// Get input context for backup.
m_hImc = ImmGetContext(hWnd);
// Remove association the testing
if (m_hImc)
ImmAssociateContext(hWnd, NULL);
// Release input context
ImmReleaseContext(hWnd, m_hImc);
::SetFocus(hWnd);
}
}
// Function for Enabling IME
void CMyDlg::EnableIME()
{
HWND hWnd = GetDlgItem(IDC_EDIT1)->m_hWnd;
if (hWnd && IsWindow(hWnd))
{
// Enable IME
if (m_hImc)
{
// Associate the input context with testing window
ImmAssociateContext(hWnd, m_hImc);
m_hImc = NULL;
}
::SetFocus(hWnd);
}
}
本文來自CSDN部落格,轉載請標明出處:http://blog.csdn.net/albertkong/archive/2009/06/06/4244426.aspx