导航

« CSS完美兼容IE6/IE7/FF的通用方法Z-Blog模版标签库  »

vb6.0实现汉字简繁转换

虚位以待 Vb6.0

vb中实现汉字简繁转换的方法也有不少,在网上查了很多资料,找到了一种相对简单的方法:

声明部分:

Private Declare Function LCMapString Lib "kernel32" Alias "LCMapStringA" (ByVal Locale As Long, ByVal dwMapFlags As Long, ByVal lpSrcStr As String, ByVal cchSrc As Long, ByVal lpDestStr As String, ByVal cchDest As Long) As Long
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
 

函数部分:

'简转繁
Public Function JToF(ByVal Str As String) As String
Dim STlen As Long
Dim STf As String
STlen = lstrlen(Str)
STf = Space(STlen)
LCMapString &H804, &H4000000, Str, STlen, STf, STlen
JToF = STf
End Function

'繁转简
Public Function FToJ(ByVal Str As String) As String
Dim STlen As Long
Dim STj As String
STlen = lstrlen(Str)
STj = Space(STlen)
LCMapString &H804, &H2000000, Str, STlen, STj, STlen
FToJ = STj
End Function

然后调用函数即可,效果 http://www.spersky.com/post/61.html

补充

调用简例:要想把文本框text1中的汉字由简体变为繁体,代码如下

text1.text=JToF(text1.text)

  • 顶一下
虚位以待




原创文章如转载,请注明:转载自落日故乡

本文链接地址:http://www.spersky.com/post/66.html

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

内容搜索


虚位以待

常用链接

最新评论及回复

Powered By Z-Blog

Copyright spersky All Rights Reserved.Theme Moonlight,Calf modified.n 浙ICP备16017820号-1