|
刚才看了一段源代码,它只用了WM_CHAR消息就实现了中英文输入,好奇怪啊。WM_CHAR不是只能响应单个字符的输入吗?
case WM_CHAR: // when key down
switch(wParam)
{
case VK_BACK: // backspace, delete 2 char if chn, delete 1 char if eng
len=lstrlen(g_DispMsg);
if (len>0)
{
if ( g_DispMsg[len-1] < 0 && len > 1 ) // chinese character
{
g_DispMsg[len-1]=0;
g_DispMsg[len-2]=0;
}
else g_DispMsg[len-1]=0;
}
break;
default: // catch the string
if (lstrlen(g_DispMsg)>39)
break;
msg[0]=(char)wParam;
msg[1]=0;
lstrcat(g_DispMsg,msg);
break;
}
break; [em5] |
|