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
Function ConvertChineseSimplifiedOrTraditional(ByVal strSrc As String, ByVal bSimplified As Boolean) As String Dim lngSrcLen As Long
Dim strBuffer As String
lngSrcLen = lstrlen(strSrc)
If lngSrcLen = 0 Then Exit Function
strBuffer = Space(lngSrcLen)
If bSimplified Then '转换为简体
LCMapString &H804, &H2000000, strSrc, lngSrcLen, strBuffer, lngSrcLen
Else
LCMapString &H804, &H4000000, strSrc, lngSrcLen, strBuffer, lngSrcLen
End If
ConvertChineseSimplifiedOrTraditional = strBuffer
End Function