The IsDBCSLeadByteEx function determines whether a specified byte is a lead byte, that is, the first byte of a two-byte character in a double-byte character set (DBCS) for the specified code page. BOOL IsDBCSLeadByteEx( UINT CodePage, // identifier of code page BYTE TestChar // byte to test ); Parameters CodePage [in] Identifier of the code page used to check lead-byte ranges. This parameter can be one of the values given in the "Code-Page Identifiers" table in Unicode and Character Set Constants or one of the following predefined values. Value Meaning CP_ACP Use system default ANSI code page. CP_MACCP Windows NT/2000/XP: Use the system default Macintosh code page. CP_OEMCP Use system default OEM code page. CP_THREAD_ACP Windows 2000/XP: Use the current thread's ANSI code page.
IsDBCSLeadByteEx(936, a);
UINT CodePage, // identifier of code page
BYTE TestChar // byte to test
);
Parameters
CodePage
[in] Identifier of the code page used to check lead-byte ranges. This parameter can be one of the values given in the "Code-Page Identifiers" table in Unicode and Character Set Constants or one of the following predefined values. Value Meaning
CP_ACP Use system default ANSI code page.
CP_MACCP Windows NT/2000/XP: Use the system default Macintosh code page.
CP_OEMCP Use system default OEM code page.
CP_THREAD_ACP Windows 2000/XP: Use the current thread's ANSI code page.
Bool ischinesechar(const char ch)
{
if(ch&0x08)
{
return TRUE;
}
else
return FALSE;
}
{
return (ch & 0x80);
}在WIN32程序中,需要响应 WM_CHAR 消息来判断:
.
case WM_CHAR:
if(IsChineseChar((char)wParam))
{...}
break;
.
.