Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Visual Basic Examples

Visual Basic Examples 4 years 2 months ago #3873

<StructLayout(LayoutKind.Sequential)> _
Dim nVersion As Integer
Dim nCorrectionLevel As Integer
Dim nEncodeMode As Integer
Dim nEci As Integer
Dim nFnc1Mode As Integer
Dim nStructuredAppendIndex As Integer
Dim nStructuredAppendCounter As Integer
Dim nApplicationIndicator As Integer
Dim bStructuredAppend As Byte
Dim bProcessTilde As Byte
Dim bAutoConfigurate As Byte
<MarshalAs(UnmanagedType.ByValArray, sizeconst:=7100)> _
Public cData() As Byte
Public Sub Initialize()
ReDim cData(7100)
End Sub

'<VBFixedString(7100), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=7100)> Public cData() As Char
'Dim strBuff(256) As Byte
Dim nSize As Integer
Dim nMargin As Byte
Dim nPixelSize As Byte
Dim clBackGround As Integer
Dim clForeGround As Integer
End Structure

Public Class LibWrap
<DllImport("QRCodeEncodeDll.dll", CallingConvention:=CallingConvention.StdCall)> _
Overloads Shared Sub InitWorkSpace(ByRef ctxQr As tagQRCODECONTEXT)
End Sub
<DllImport("QRCodeEncodeDll.dll", CallingConvention:=CallingConvention.StdCall)> _
Overloads Shared Function QRCodeEncode2File(ByRef ctxQr As tagQRCODECONTEXT, ByVal sFile As String) As Boolean
End Function
<DllImport("QRCodeEncodeDll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Overloads Shared Function QRCodeEncode2Bitmap(ByRef ctxQr As tagQRCODECONTEXT) As Long
End Function
<DllImport("QRCodeEncodeDll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Overloads Shared Function FreeWorkSpace(ByRef ctxQr As tagQRCODECONTEXT) As Boolean

End Function
<DllImport("QRCodeEncodeDll.dll", CallingConvention:=CallingConvention.Cdecl)> _
Overloads Shared Function Encode2File(ByVal pData As String, ByVal nCorrectionLevel As Integer, ByVal nMargin As Integer, ByVal nPixelSize As Integer, ByVal pImageFile As String) As Boolean

End Function

End Class 'LibWrap

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

qrCtx.nCorrectionLevel = 2
qrCtx.nEncodeMode = 4
qrCtx.bAutoConfigurate = True

qrCtx.cData(0) = 57
qrCtx.cData(1) = 48
qrCtx.cData(2) = 49
qrCtx.cData(3) = 50
qrCtx.cData(4) = 51
qrCtx.cData(5) = 52
qrCtx.cData(6) = 53
qrCtx.cData(7) = 54
qrCtx.cData( = 55
qrCtx.cData(9) = 56

qrCtx.nSize = 10
qrCtx.nMargin = 20
qrCtx.nPixelSize = 4 'Auto mode

If (LibWrap.QRCodeEncode2File(qrCtx, "c:\pic4.bmp")) Then
MsgBox("SUccess, Trial version will replace some char of input with '*' randomly")
End If

End Sub
The administrator has disabled public write access.

  • Posts:59
  • developer's Avatar
  • developer
  • Moderator
  • Karma: 1
  • Page:
  • 1
Time to create page: 0.223 seconds
Powered by Kunena Forum :: Wibi