SCAN ME
QR Code
QR code stands for quick response code. This code is a two-dimensional barcode that can provide various types of information directly. To open it, it takes a scan or scanning with various scanning tools.
QR codes are usually capable of storing 2089 digits or 4289 characters, including punctuation marks and special characters.
This allows the QR code to display text to the user, open URLs, save contacts to the phone book, and much more.
QR codes are considered more practical than barcodes because they are able to store more data.
A QR code consists of black dots and white spaces arranged in a square shape, and each element has its own meaning.
Create Project QR Code With Visual Basic - Simple For Beginner...
2. Source FrmQRCode
Option Explicit
Dim CN As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim SQL As String
Dim FileName As String
Private Sub CmdQR_Click()
Me.txtEncodeData.Text = "NOID :" + Me.TNOID.Text + vbLf + "NAME : " + Me.TNAME.Text
Dim qrEncoder As New QRCodeEncoder
qrEncoder.QRCodeEncodeMode = ENCODE_MODE.ENCODE_MODE_BYTE
qrEncoder.QRCodeScale = 4
qrEncoder.QRCodeVersion = 7
qrEncoder.QRCodeErrorCorrect = ERROR_CORRECTION.ERROR_CORRECTION_M
picEncode.Picture = qrEncoder.EncodeVB6(txtEncodeData.Text)
SavePicture picEncode.Picture, App.Path & "\" & TNOID.Text & ".bmp"
End Sub
Private Sub Command1_Click()
Dim decoder As New QRCodeDecoder
Dim decodedString As String
Dim qrCodeImage As New QRCodeBitmapImage
qrCodeImage.SetBitmap = picEncode.Picture
decodedString = decoder.decodeVB6(qrCodeImage)
MsgBox "QR Decode : " & vbCrLf & decodedString, vbInformation, "Informasi"
End Sub
3. Module API
Option Explicit Public Const LWA_COLORKEY = 1 Public Const LWA_ALPHA = 2 Public Const LWA_BOTH = 3 Public Const WS_EX_LAYERED = &H80000 Public Const GWL_EXSTYLE = -20 Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal color As Long, ByVal x As Byte, ByVal alpha As Long) As Boolean Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
4. Module Misc
Option Explicit
Sub SetTranslucent(ThehWnd As Long, nTrans As Integer)
On Error GoTo ErrorRtn
'SetWindowLong and SetLayeredWindowAttributes are API functions, see MSDN for details
Dim attrib As Long
attrib = GetWindowLong(ThehWnd, GWL_EXSTYLE)
SetWindowLong ThehWnd, GWL_EXSTYLE, attrib Or WS_EX_LAYERED
SetLayeredWindowAttributes ThehWnd, RGB(255, 255, 0), nTrans, LWA_ALPHA
Exit Sub
ErrorRtn:
MsgBox Err.Description & " Source : " & Err.Source
End Sub
No comments:
Post a Comment