locked
about WM_CHAR message RRS feed

  • Question

  • I build a dialog  project on windows mobile 6.0,and I add a CEdit control on the dialog control,  and then I replaced the Cedit class with a new class inherited from cedit..
    like :
    class ttttt : public CEdit
    {
    ...
    }
    in class tttt, I debug this program on "windwo mobile 6 classic emulator" for chinese,but I can not catch wm_char message when I input using softkeyboad.
    I add follow codes to find more message :
    BOOL ttttt::PreTranslateMessage(MSG* pMsg)
    {
     switch(pMsg->message)  
     {  
     case   WM_CHAR:  
      SendMessage(WM_CHAR,pMsg->wParam,pMsg->lParam);  
      break;  
     default:  
      return   CEdit::PreTranslateMessage(pMsg);  
     }  
     return CEdit::PreTranslateMessage(pMsg);
    }

    I was surprised that when the wparam is right value, the message value is 257 . Then the question came out, the macro WM_CHAR is 258.
    then ,I use windwo mobile 6 classic emulator for english, I was suprised that everything goes right!!
    did anyone come across this question ? I want my project to support chinese ,so please help me..

    Friday, July 31, 2009 5:15 PM

Answers

  • Hi,


    I think I have misunderstood your problem. Even if the input is Chinese, WM_CHAR message should be received.

    Could you try to use

    CDialog::PreTranslateMessage(pMsg);

    Instead of CEdit. Then input a Chinese character. In my test, I can catch the WM_CHAR message.

     

    Regards,

    Jennifer

    Thursday, August 6, 2009 8:24 AM

All replies

  • oh,no answer........
    Monday, August 3, 2009 1:32 AM
  • Hi,

     

     

    Chinese character is an Unicode, which is a double-byte character. So WM_CHAR can not process it.

    Generally there are two ways to solve your problem:

    1.       Use WM_IME_CHAR to process the Chinese character

        Detail refer to

    http://msdn.microsoft.com/en-us/library/dd374132(VS.85).aspx

    2.       Make your form support Unicode. In that case, every input no matter English or others will be took as WM_CHAR.

    Hope this helps.

     

    Regards,

    Jennifer

     

    Tuesday, August 4, 2009 9:20 AM
  • Thank you very much Jennifer,I will try it.
    Wednesday, August 5, 2009 8:04 AM
  • I try it like your ways,but it does not work.
    I intput number in en-language state.
    Wednesday, August 5, 2009 8:32 AM
  • Hi,


    I think I have misunderstood your problem. Even if the input is Chinese, WM_CHAR message should be received.

    Could you try to use

    CDialog::PreTranslateMessage(pMsg);

    Instead of CEdit. Then input a Chinese character. In my test, I can catch the WM_CHAR message.

     

    Regards,

    Jennifer

    Thursday, August 6, 2009 8:24 AM