VB 判断 半角 全角

来源:百度知道 编辑:UC知道 时间:2024/05/13 23:36:02
如何在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