- 积分
- 36
- 实力分
- 点
- 金钱数
- 两
- 技术分
- 分
- 贡献分
- 分
|

楼主 |
发表于 2006-10-3 09:09:46
|
显示全部楼层
开源
贴一些核心源码,有兴趣的可以研究一下
Private Declare Function ReleaseDC Lib "user32" _
(ByVal hwnd As Long, _
ByVal hdc As Long _
) As Long
Private Declare Function OpenClipboard Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function SetClipboardData Lib "user32" _
(ByVal wFormat As Long, _
ByVal hMem As Long _
) As Long
Private Declare Function SelectObject Lib "gdi32" _
(ByVal hdc As Long, _
ByVal hObject As Long _
) As Long
Private Declare Function DeleteDC Lib "gdi32" _
(ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32" _
(ByVal hDestDC As Long, _
ByVal X As Long, ByVal Y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, ByVal ySrc As Long, _
ByVal dwRop As Long) As Long
Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" _
(ByVal lpDriverName As String, _
ByVal lpDeviceName As String, _
ByVal lpOutput As String, _
lpInitData As Long _
) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" _
(ByVal hdc As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" _
(ByVal hdc As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long _
) As Long
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Sub QRCodeEncode Lib "QRCodeFont.dll" _
(ByVal Message As String, ByVal Version As Integer, ByVal Level As Integer, ByVal Mask As Integer)
Private Declare Sub keybd_event Lib "user32" (ByVal bvk As Byte, ByVal bscan As Byte, ByVal dwflags As Long, ByVal dwextrainfo As Long)
Private Const keyeventf_keyup = &H2
Private Declare Function QRCodeGetRows Lib "QRCodeFont.dll" () As Integer
Private Declare Function QRCodeGetCols Lib "QRCodeFont.dll" () As Integer
Private Declare Function QRCodeGetCharAt Lib "QRCodeFont.dll" (ByVal RowIndex As Integer, ByVal ColIndex As Integer) As Integer
'Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wmsg As Long, ByVal wParam As Long, ByVal IParam As String) As Long
'__________________________________________________________________________
Private Sub Command1_Click()
Message = Text1.Text
' Version
Version = cbxVersion.ListIndex
' Level
' 0: L - recovery rate 7%
' 1: M - recovery rate 15%
' 2: Q - recovery rate 25%
' 3: H - recovery rate 30%
Level = cbxLevel.ListIndex
' Mask
Mask = cbxMask.ListIndex
Call QRCodeEncode(Message, Version, Level, Mask)
txtQRCode.Text = ""
txtQRCode.F
txtQRCode.FontSize = CInt(cbxFontSize.Text)
' how many rows?
RowCount = QRCodeGetRows
' how many characters in one row?
ColCount = QRCodeGetCols
' produce string for QRCode font
EncodedMsg = vbCrLf
For I = 1 To RowCount
For J = 1 To ColCount
EncodedMsg = EncodedMsg & Chr(QRCodeGetCharAt(I - 1, J - 1))
Next J
EncodedMsg = EncodedMsg & vbCrLf
Next I
txtQRCode.Text = EncodedMsg
End Sub
[ 本帖最后由 Jeffrey82 于 2006-10-12 12:53 编辑 ] |
|