|
网上找到,代码如下
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 |
|