Private Declare Function MultiByteToWideChar Lib "kernel32 " (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As Long Private Declare Function WideCharToMultiByte Lib "kernel32 " (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, ByVal lpDefaultChar As Long, ByVal lpUsedDefaultChar As Long) As Long 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 Private Const CP_ACP As Long = 0 ' default to ANSI code page Public Const CP_UTF8 As Long = 65001 ' default to UTF-8 code page Private Const CP_UTF7 As Long = 65000 Public Const CP_GB2312 As Long = 936 Private Const CP_Big5 As Long = 950 Public Const CP_GB18030 As Long = 54936 'Debug.Print CLng("&H" & Hex$("6767")) 可以强制将16进制 转化为 二进制 Public Function MultiByteToString(buff() As Byte, CodePage As Long) As String ' Byte to String Dim Buffsize As Long, Datasize As Long Datasize = UBound(buff) - LBound(buff) + 1 Buffsize = MultiByteToWideChar(CodePage, 0&, VarPtr(buff(0&)), Datasize, 0&, 0&) MultiByteToString = Space$(Buffsize) MultiByteToWideChar CodePage, 0&, VarPtr(buff(0&)), Datasize, StrPtr(MultiByteToString), Buffsize End Function