黑暗乡村迅雷下载:VB 判断 半角 全角

来源:百度文库 编辑:高考问答 时间:2024/05/06 22:50:24
如何在VB里面进行判断半角和全角

你是指判断字符时全角还是半角吗?
用asc函数可以判断。
a是全角的,asc("a")是负值
a是半角的,asc("a")是正值

晕,“知道”自动把全角字符转换成半角了……

如果想在VB里检查你现在的输入法是出于半角还是全角状态,

VB里可以调用一个输入法检测的API函数,
先看这里。

http://www.lihuasoft.net/article/show.php?id=14

另外里还要看一下这个API函数:
BOOL ImmGetConversionStatus(
HIMC hIMC,
LPDWORD lpfdwConversion,
LPDWORD lpfdwSentence
);
Parameters
hIMC
[in] Handle to the input context for which to retrieve information.
lpfdwConversion
[out] Pointer to a variable that receives a combination of conversion mode values. For more information, see IME Conversion Mode Values.
lpfdwSentence
[out] Pointer to a variable that receives a sentence mode value. For more information, see IME Sentence Mode Values.
Return Values
If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero.

Remarks
Conversion and sentence mode values are set only if the IME supports those modes.

取得的lpfdwConversion参数是这样的:
Bit Meaning
IME_CMODE_CHARCODE Set to 1 if character code input mode; 0 if not.
IME_CMODE_EUDC Set to 1 if EUDC conversion mode; 0 if not.
IME_CMODE_FIXED Windows 98/Me, Windows 2000/XP: Set to 1 if fixed conversion mode; 0 if not.
IME_CMODE_FULLSHAPE Set to 1 if full shape mode; 0 if half shape mode.
IME_CMODE_HANJACONVERT Set to 1 if HANJA convert mode; 0 if not.
IME_CMODE_KATAKANA Set to 1 if KATAKANA mode; 0 if HIRAGANA mode.
IME_CMODE_NATIVE Set to 1 if NATIVE mode; 0 if ALPHANUMERIC mode.
IME_CMODE_NOCONVERSION Set to 1 to prevent processing of conversions by IME; 0 if not.
IME_CMODE_ROMAN Set to 1 if ROMAN input mode; 0 if not.
IME_CMODE_SOFTKBD Set to 1 if Soft Keyboard mode; 0 if not.
IME_CMODE_SYMBOL Set to 1 if SYMBOL conversion mode; 0 if not.

看到这个了吧,这就是你所要的。
IME_CMODE_FULLSHAPE Set to 1 if full shape mode; 0 if half shape mode.