Option ExplicitPrivate Sub Form_Load()
Text1.Text = "please input your text to be converted"
End SubPrivate Sub Text1_click()
Text1.Text = ""
End Sub
Private Sub Text1_change()
QRmaker1.InputDataB = Text1.Text
End Sub
有没有高手帮忙解释一下,怎么才能生成汉字二维码?
运行英文时,二维码扫描正常。运行中文字符是,二维码扫描时乱码。
跪求高手帮助。
Text1.Text = "please input your text to be converted"
End SubPrivate Sub Text1_click()
Text1.Text = ""
End Sub
Private Sub Text1_change()
QRmaker1.InputDataB = Text1.Text
End Sub
有没有高手帮忙解释一下,怎么才能生成汉字二维码?
运行英文时,二维码扫描正常。运行中文字符是,二维码扫描时乱码。
跪求高手帮助。
QRmaker1.InputDataB = StrConv(Text1.Text, vbFromUnicode)
不知道楼主是用什么扫的码啊,是不是“编码格式不兼容”造成的呢?
Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByRef lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long
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 Const CP_UTF8 = 65001
Private Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Public Function UTF8_Encode(ByVal strUnicode As String) As Byte()
'UTF-8 编码
Dim TLen As Long
Dim lngBufferSize As Long
Dim lngResult As Long
Dim bytUtf8() As Byte
TLen = Len(strUnicode)
If TLen = 0 Then Exit Function
lngBufferSize = TLen * 3 + 1
ReDim bytUtf8(lngBufferSize - 1)
lngResult = WideCharToMultiByte(CP_UTF8, 0, StrPtr(strUnicode), TLen, bytUtf8(0), lngBufferSize, vbNullString, 0)
If lngResult <> 0 Then
lngResult = lngResult - 1
ReDim Preserve bytUtf8(lngResult)
End If
UTF8_Encode = bytUtf8
End Function
Public Function UTF8_Decode(ByRef bUTF8() As Byte) As String
'UTF-8 解码
Dim lRet As Long
Dim lLen As Long
Dim lBufferSize As Long
Dim sBuffer As String
Dim bBuffer() As Byte
lLen = UBound(bUTF8) + 1
If lLen = 0 Then Exit Function
lBufferSize = lLen * 2
sBuffer = String$(lBufferSize, Chr(0))
lRet = MultiByteToWideChar(CP_UTF8, 0, VarPtr(bUTF8(0)), lLen, StrPtr(sBuffer), lBufferSize)
If lRet <> 0 Then
sBuffer = Left(sBuffer, lRet)
End If
UTF8_Decode = sBuffer
End Function