1,451
社区成员
发帖
与我相关
我的任务
分享
Private Declare Function ScanQRCode Lib "QRCodeLibx.dll" Alias "ScanQRCodeA" (ByVal imgPath As String, ByRef imgResult As Byte) As Long
Private Sub Command1_Click()
Dim imgBuff() As Byte
Dim lRet As Long
Dim strQRContent As String
'--预先分配足够大的Byte数组--
ReDim imgBuff(2048)
'--函数失败返回0,成功返回数组大小--
lRet = ScanQRCode("c:\qrtest.jpg", imgBuff(0))
If lRet > 0 Then
'--重新调整数组大小--
ReDim Preserve imgBuff(lRet - 1)
strQRContent = StrConv(imgBuff, vbUnicode)
End If
MsgBox strQRContent
End Sub