接收不到IME消息的问题和解决方法

接收不到IME消息的问题和解决方法

        上次写了一个UI的控件editbox,我采用了IME响应中文输入,但在消息处理的时候收到WM_INPUTLANGCHANGEREQUEST,却没收到WM_INPUTLANGCHANGE的消息,在网上也查不到原因,看MSDN一开始也没看出原因。但实际上是我自己没能理解MSDN所说的。
The WM_INPUTLANGCHANGEREQUEST message is posted to the window with the focus when the user chooses a new input language, either with the hotkey (specified in the Keyboard control panel application) or from the indicator on the system taskbar. An application can accept the change by passing the message to the DefWindowProc function or reject the change (and prevent it from taking place) by returning immediately.
        实际上这段话的意思是,收到了 WM_INPUTLANGCHANGEREQUEST后,要把该消息发送给 DefWindowProc才能收到输入法的改变消息。
我原来的代码是:
BOOL WndProc()
{
    switch (msg)
    {
   
    }
    return 0;
}

后来改为:
BOOL WndProc()
{
    switch (msg)
    {
   
    }
    return DefWindowProc(......);
}
 就没问题了!所以一定要充分理解MSDN所说的。

你可能感兴趣的:(接收不到IME消息的问题和解决方法)