MsgBox(0, '转大五:', _GbkToBig5('演示'))
MsgBox(0, '转大五:', _GbkToBig5(_JianToFan('陈旧')))
Func _Big5toGbk(ByRef $sInputText);BIG5转GBK
$sInputText = _WinAPI_MultiByteToWideChar($sInputText, 950, $MB_COMPOSITE, False);转为繁体中文
$sInputText = _WinAPI_WideCharToMultiByte($sInputText, 936);转为GBK繁体中文
Return $sInputText
EndFunc
Func _GbkToBig5($sInputText);GBK转BIG5
$sInputText = _WinAPI_MultiByteToWideChar($sInputText, 936, $MB_COMPOSITE, False);转为繁体中文
$sInputText = _WinAPI_WideCharToMultiByte($sInputText, 950);转为GBK繁体中文
Return $sInputText
EndFunc
Func _JianToFan($sInputText);GB2312转GBK
Local $InPtr = _WinAPI_MultiByteToWideChar($sInputText, 936, $MB_COMPOSITE, False)
Local $OutPtr
Local $dll = DllOpen('kernel32.dll')
Local $result = DllCall($dll, "none", "LCMapStringA", "LONG", 0x0804, "dword", 0x4000000, "STR", DllStructGetData($InPtr, 1), "LONG", DllStructGetSize($InPtr), "str", $OutPtr, 'long', DllStructGetSize($InPtr)); "PTR",$OutPtr,'long',DllStructGetSize($InPtr))
If IsArray($result) Then Return $result[5]
EndFunc
Func _FanToJian($sInputText);GBK转GB2312
Local $InPtr = _WinAPI_MultiByteToWideChar($sInputText, 936, $MB_COMPOSITE, False)
Local $OutPtr
Local $dll = DllOpen('kernel32.dll')
Local $result = DllCall($dll, "none", "LCMapStringA", "LONG", 0x0804, "dword", 0x2000000, "STR", _
DllStructGetData($InPtr, 1), "LONG", DllStructGetSize($InPtr), "str", $OutPtr, 'long', DllStructGetSize($InPtr)); "PTR",$OutPtr,'long',DllStructGetSize($InPtr))
If IsArray($result) Then Return $result[5]
EndFunc