找回密码
 加入
搜索
查看: 2670|回复: 2

[系统综合] 如何正确调用LCMapString?[已解决]

[复制链接]
发表于 2010-12-1 10:29:06 | 显示全部楼层 |阅读模式
本帖最后由 3mile 于 2010-12-2 15:14 编辑

如题,调用LCMapString结果总为0?
我想应该是我调用语句有错吧,请大家指教。
#include <string.au3>
#include <array.au3>
#include <winapi.au3>

Local $sInputText = '中華人民共和國', $ab
;MsgBox(0, 0, _Big5toGbk($sInputText))
;MsgBox(0,0,_GbkToBig5('中华人民共和国'))

Func _Big5toGbk(ByRef $sInputText)
    $sInputText = _WinAPI_MultiByteToWideChar($sInputText, 950, $MB_COMPOSITE, False);转为繁体中文
    $sInputText = _WinAPI_WideCharToMultiByte($sInputText, 936);转为GBK繁体中文
    Return $sInputText
EndFunc   ;==>_Big5toGbk

Func _GbkToBig5($sInputText)
    $sInputText = _WinAPI_MultiByteToWideChar($sInputText, 936, $MB_COMPOSITE, False);转为繁体中文
    $sInputText = _WinAPI_WideCharToMultiByte($sInputText, 950);转为GBK繁体中文
    Return $sInputText
EndFunc


$InPtr = _WinAPI_MultiByteToWideChar($sInputText, 936, $MB_COMPOSITE, False)
MsgBox(0,DllStructGetSize($InPtr),DllStructGetData($InPtr,1))
$textbuf=DllStructCreate('WCHAR [16]')
$OutPtr=DllStructGetPtr($textbuf)
$WLC=_WinAPI_MAKELCID(_WinAPI_MAKELANGID(0x04,0x02), 0x03)
MsgBox(0,0,$WLC)
$result = DllCall("kernel32.dll", "none","LCMapStringW", "long", 0x0804, "long", 0x4000000, "PTR", _
                    $InPtr,"LONG",DllStructGetSize($InPtr), "PTR",$OutPtr,'INT',DllStructGetSize($InPtr)*2)
MsgBox(0,$result,DllStructGetData($OutPtr,1))

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

发表于 2010-12-1 11:31:19 | 显示全部楼层
不会 帮顶 等待高手中的高手
 楼主| 发表于 2010-12-2 15:14:14 | 显示全部楼层
自我解决了。结贴
已经做成UDF,
http://www.autoitx.com/forum.php ... amp;fromuid=7639113
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-2 22:23 , Processed in 0.087973 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表