做个验证码程序熬了一晚上

程序代码:'Option Explicit
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor 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
Dim R As Byte
Dim G As Byte
Dim B As Byte
Dim aaa As Long
Dim bbb As Byte
Dim m As Integer
Dim n As Integer
Dim kuan As Integer
Dim gao As Integer
Dim k As Integer
'二值化
Private Sub Command1_Click()
For m = 1 To Picture1.ScaleHeight Step 15 '像素值量化后用一个字节(8b)
For n = 1 To Picture1.ScaleWidth Step 15
aaa = Picture1.Point(n, m)
R = (aaa Mod 256) '取得红色值
G = (aaa Mod 65536) \ 256 '取得绿色值
B = (aaa Mod 16777216) \ 65536 '取得蓝色值
bbb = R * 0.3 + G * 0.59 + B * 0.11 '取得灰度值
If bbb > 100 Then '这里bbb可作适当改变以获得最佳2值化效果
Picture2.PSet (n, m), RGB(255, 255, 255)
Else
Picture2.PSet (n, m), RGB(0, 0, 0)
End If
Next n
Next m
End Sub
'分割
Private Sub Command10_Click()
Picture2.ScaleMode = 3
Picture4(0).Width = Picture1.Width / 4
Picture4(1).Width = Picture1.Width / 4
Picture4(2).Width = Picture1.Width / 4
Picture4(3).Width = Picture1.Width / 4
BitBlt Picture4(0).hdc, 0, 0, 20, 20, Picture2.hdc, 0, 0, vbSrcCopy
Picture4(0).Refresh
BitBlt Picture4(1).hdc, 0, 0, 20, 20, Picture2.hdc, LHEIGHT.Caption * 1 / 4, 0, vbSrcCopy
Picture4(1).Refresh
BitBlt Picture4(2).hdc, 0, 0, 20, 20, Picture2.hdc, LHEIGHT.Caption * 2 / 4, 0, vbSrcCopy
Picture4(2).Refresh
BitBlt Picture4(3).hdc, 0, 0, 20, 20, Picture2.hdc, LHEIGHT.Caption * 3 / 4, 0, vbSrcCopy
Picture4(3).Refresh
'txtInput0.Text = 0
'txtInput1.Text = 0
'txtInput2.Text = 0
'txtInput3.Text = 0
End Sub
'去噪
Private Sub Command2_Click()
Picture3.Cls
For kuan = 1 To Picture2.ScaleWidth / Screen.TwipsPerPixelX - 1
For gao = 1 To Picture2.ScaleHeight / Screen.TwipsPerPixelY - 1
If GetPixel(Picture2.hdc, kuan, gao) <> 16777215 Then
k = 0
If GetPixel(Picture2.hdc, kuan - 1, gao - 1) <> 16777215 Then k = k + 1
If GetPixel(Picture2.hdc, kuan - 1, gao) <> 16777215 Then k = k + 1
If GetPixel(Picture2.hdc, kuan - 1, gao + 1) <> 16777215 Then k = k + 1
If GetPixel(Picture2.hdc, kuan, gao - 1) <> 16777215 Then k = k + 1
If GetPixel(Picture2.hdc, kuan, gao + 1) <> 16777215 Then k = k + 1
If GetPixel(Picture2.hdc, kuan + 1, gao) <> 16777215 Then k = k + 1
If GetPixel(Picture2.hdc, kuan + 1, gao + 1) <> 16777215 Then k = k + 1
If GetPixel(Picture2.hdc, kuan + 1, gao - 1) <> 16777215 Then k = k + 1
If k < 2 Then
Picture3.PSet (kuan, gao), RGB(255, 255, 255)
Else
Picture3.PSet (kuan, gao), RGB(0, 0, 0)
End If
End If
'去边框
If kuan = 1 Then Picture3.PSet (kuan, gao), RGB(244, 244, 244)
If gao = 1 Then Picture3.PSet (kuan, gao), RGB(244, 244, 244)
If kuan = Picture2.ScaleWidth / Screen.TwipsPerPixelX - 1 Then Picture3.PSet (kuan, gao), RGB(244, 244, 244)
If gao = Picture2.ScaleHeight / Screen.TwipsPerPixelY - 1 Then Picture3.PSet (kuan, gao), RGB(244, 244, 244)
Next
Next
Picture3.Refresh
End Sub
'分割
Private Sub Command3_Click()
'垂直 找分割的点
Dim x, y
Dim fgx(4)
mm = 0
nn = 0
For mm = 0 To Picture3.ScaleWidth
For nn = 0 To Picture3.ScaleHeight
' If GetPixel(Picture3.hdc, mm, nn)< Then
'
' Picture3.PSet (mm, nn), vbRed
'Exit For
' Text3.Text = Text3.Text & mm & "-" & nn & vbCrLf
' End If
'Debug.Print GetPixel(Picture3.hdc, mm, nn)
DoEvents
Next nn
Next mm
'Picture4(0).Width = Picture1.Width / 4
'Picture4(1).Width = Picture1.Width / 4
'Picture4(2).Width = Picture1.Width / 4
'Picture4(3).Width = Picture1.Width / 4
'BitBlt Picture4(0).hdc, 0, 0, 20, 20, _
'Picture3.hdc, 0, 0, vbSrcCopy
'Picture4(0).Refresh
'BitBlt Picture4(1).hdc, 0, 0, 20, 20, _
'Picture3.hdc, LHEIGHT.Caption * 1 / 4 + 2, 0, vbSrcCopy
'Picture4(1).Refresh
'BitBlt Picture4(2).hdc, 0, 0, 20, 20, _
'Picture3.hdc, LHEIGHT.Caption * 2 / 4 + 2, 0, vbSrcCopy
'Picture4(2).Refresh
'BitBlt Picture4(3).hdc, 0, 0, 20, 20, _
'Picture3.hdc, LHEIGHT.Caption * 3 / 4, 0, vbSrcCopy
'Picture4(3).Refresh
'txtInput0.Text = 0
'txtInput1.Text = 0
'txtInput2.Text = 0
'txtInput3.Text = 0
End Sub
Private Sub Command4_Click()
Picture4(0).ScaleMode = 1
Dim i As Long, j As Long, lngRGB As Long
For i = 0 To Picture4(0).ScaleWidth / Screen.TwipsPerPixelX
For j = 0 To Picture4(0).ScaleHeight / Screen.TwipsPerPixelY
lngRGB = GetPixel(Picture4(0).hdc, i, j)
If lngRGB = 0 Then
'Me.CurrentX = i * Me.TextWidth("1")
' Me.CurrentY = j * Me.TextHeight("1")
'Print "1"
txtInput0.Text = txtInput0.Text & "1"
Else
' Me.CurrentX = i * Me.TextWidth("0")
' Me.CurrentY = j * Me.TextHeight("0")
' Print "0"
txtInput0.Text = txtInput0.Text & "0"
End If
Next
Next
Picture4(1).ScaleMode = 1
For i = 0 To Picture4(1).ScaleWidth / Screen.TwipsPerPixelX
For j = 0 To Picture4(1).ScaleHeight / Screen.TwipsPerPixelY
lngRGB = GetPixel(Picture4(1).hdc, i, j)
If lngRGB = 0 Then
Me.CurrentX = i * Me.TextWidth("1")
Me.CurrentY = j * Me.TextHeight("1")
'Print "1"
txtInput1.Text = txtInput1.Text & "1"
Else
Me.CurrentX = i * Me.TextWidth("0")
Me.CurrentY = j * Me.TextHeight("0")
txtInput1.Text = txtInput1.Text + "0"
End If
Next
Next
Picture4(2).ScaleMode = 1
For i = 0 To Picture4(2).ScaleWidth / Screen.TwipsPerPixelX
For j = 0 To Picture4(2).ScaleHeight / Screen.TwipsPerPixelY
lngRGB = GetPixel(Picture4(2).hdc, i, j)
If lngRGB = 0 Then
Me.CurrentX = i * Me.TextWidth("1")
Me.CurrentY = j * Me.TextHeight("1")
' Print "1"
txtInput2.Text = txtInput2.Text & "1"
'txtInput2.Text = txtInput2.Text + 1
Else
Me.CurrentX = i * Me.TextWidth("0")
Me.CurrentY = j * Me.TextHeight("0")
txtInput2.Text = txtInput2.Text & "0"
End If
Next
Next
Picture4(3).ScaleMode = 1
For i = 0 To Picture4(3).ScaleWidth / Screen.TwipsPerPixelX
For j = 0 To Picture4(3).ScaleHeight / Screen.TwipsPerPixelY
lngRGB = GetPixel(Picture4(3).hdc, i, j)
If lngRGB = 0 Then
Me.CurrentX = i * Me.TextWidth("1")
Me.CurrentY = j * Me.TextHeight("1")
'Print "1"
txtInput3.Text = txtInput3.Text & "1"
'txtInput3.Text = txtInput3.Text + 1
Else
Me.CurrentX = i * Me.TextWidth("0")
Me.CurrentY = j * Me.TextHeight("0")
txtInput3.Text = txtInput3.Text & "0"
End If
Next
Next
End Sub

程序代码:Private Sub Command5_Click()
txtInput0.Text = ""
txtInput1.Text = ""
txtInput2.Text = ""
txtInput3.Text = ""
End Sub
Private Sub Command6_Click()
Picture2.ScaleMode = 1
Picture1.Cls
Picture1.Refresh
If InetVCode.StillExecuting Then Exit Sub
InetVCode.Execute Text1.Text, "GET"
End Sub
Private Sub Command7_Click()
'验证码数组
Dim code1(10), code2(10), code3(10), code4(10)
'第一位
code1(0) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111000000000000000000000000000000000000000000000000111111111000000000000000000000000000000000000000000000011110000011000000000000000000000000000000000000000000001100000000010000000000000000000000000000000000000000000110000000000100000000000000000000000000000000000000000001000000000011000000000000000000000000000000000000000000010000000001100000000000000000000000000000000000000000000110000011110000000000000000000000000000000000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code1(1) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000001000000000000100000000000000000000000000000000000000000011111111111111000000000000000000000000000000000000000001111111111111110000000000000000000000000000000000000000011111111111111100000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code1(2) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000111110000000000000000000000000000000000000000000000000001101100000000000000000000000000000000000000000000000000110011000000000000000000000000000000000000000000000000011000110000000000000000000000000000000000000000000000001100001100000000000000000000000000000000000000000000000110000011000000000000000000000000000000000000000000100011100000110000000000000000000000000000000000000000001111110000000000000000000000000000000000000000000000000011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code1(3) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000100000010000000000000000000000000000000000000000001000010100001100000000000000000000000000000000000000000011001101111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code1(4) = ""
code1(5) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111110000000100000000000000000000000000000000000000000111111100000001000000000000000000000000000000000000000001000001000000010000000000000000000000000000000000000000000000010000000100000000000000000000000000000000000000000000000110000001000000000000000000000000000000000000000000000000110000100000000000000000000000000000000000000000000000001111111000000000000000000000000000000000000000000000000000111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code1(6) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111110000000000000000000000000000000000000000000000011111111111000000000000000000000000000000000000000000001111111111111000000000000000000000000000000000000000000011100110000110000000000000000000000000000000000000000001110001000000100000000000000000000000000000000000000000011000110000001000000000000000000000000000000000000000000110001100000010000000000000000000000000000000000000000001100011100001100000000000000000000000000000000000000000011000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code1(7) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000001100000000111000000000000000000000000000000000000000000011000000111000000000000000000000000000000000000000000000110000011100000000000000000000000000000000000000000000001100001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code1(8) = ""
code1(9) = ""
code2(0) = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111000000110000000000000000000000000000000000000000011111110000001100000000000000000000000000000000000000000111111100000011000000000000000000000000000000000000000001100011000000110000000000000000000000000000000000000000011000111000001100000000000000000000000000000000000000000110001111000111000000000000000000000000000000000000000001100001111111100000000000000000000000000000000000000000011000011111111000000000000000000000000000000000000000000110000001111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code2(1) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000000000001000000000000000000000000000000000000000000111111111111110000000000000000000000000000000000000000001111111111111100000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code2(2) = ""
code2(3) = ""
code2(4) = ""
code2(5) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110100000001000000000000000000000000000000000000000000011000100000001000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000001100010000000000000000000000000000000000000000000000000011000110000000000000000000000000000000000000000000000000110000110000100000000000000000000000000000000000000000001100001111111000000000000000000000000000000000000000000011000001111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code2(6) = ""
code2(7) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000000000000000001100000000111100000000000000000000000000000000000000000011000000011110000000000000000000000000000000000000000000110000011110000000000000000000000000000000000000000000001100001110000000000000000000000000000000000000000000000011000111000000000000000000000000000000000000000000000000110011100000000000000000000000000000000000000000000000001101100000000000000000000000000000000000000000000000000011110000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code2(8) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111100000000000000000000000000000000000000000000000000011111000000000000000000000000000000000000000000000111001111111000000000000000000000000000000000000000000011111011001110000000000000000000000000000000000000000000111111100001100000000000000000000000000000000000000000011100111000011000000000000000000000000000000000000000000110001110000110000000000000000000000000000000000000000001100011110011100000000000000000000000000000000000000000011000111111110000000000000000000000000000000000000000000111111011111000000000000000000000000000000000000000000001111100011100000000000000000000000000000000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code2(9) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000000000000111111000000000000000000000000000000000000000000000000011000011000010000000000000000000000000000000000000000000100000010000100000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000010000100011000000000000000000000000000000000000000000000011111111100000000000000000000000000000000000000000000000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code3(0) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111100000000000000000000000000000000000000000000000011111111100000000000000000000000000000000000000000000011110000001000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000001000000000001000000000000000000000000000000000000000000010000000000110000000000000000000000000000000000000000000110000001111000000000000000000000000000000000000000000000111111111000000000000000000000000000000000000000000000000111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code3(1) = ""
code3(2) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000010000000001111000000000000000000000000000000000000000000000000000111010000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000010000001100000000000000000000000000000000000000000000000110000110000000000000000000000000000000000000000000000000111111000000000000000000000000000000000000000000000000000111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code3(3) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000100000000000100000000000000000000000000000000000000000010000000000001000000000000000000000000000000000000000000000000100000110000000000000000000000000000000000000000001000010100011000000000000000000000000000000000000000000011001101111110000000000000000000000000000000000000000000111110001110000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code3(4) = "000000000000011100000000000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000000000000110110000000000000000000000000000000000000000000000000111001100000000000000000000000000000000000000000000000011100011000000000000000000000000000000000000000000000001110001111110000000000000000000000000000000000000000000111111111111100000000000000000000000000000000000000000001111111111000000000000000000000000000000000000000000000011100000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code3(5) = "000000000000000000110000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000100000001000000000000000000000000000000000000000000011100100000010000000000000000000000000000000000000000000110000000000100000000000000000000000000000000000000000001100010000001000000000000000000000000000000000000000000011000110000100000000000000000000000000000000000000000000110000111111000000000000000000000000000000000000000000001100001111100000000000000000000000000000000000000000000011000001110000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code3(6) = "000000000011111100000000000000000000000000000000000000000000000011111111100000000000000000000000000000000000000000000001111111111100000000000000000000000000000000000000000000111000100001100000000000000000000000000000000000000000001100000000001000000000000000000000000000000000000000000010000100000010000000000000000000000000000000000000000000000001100001100000000000000000000000000000000000000000001000011111111000000000000000000000000000000000000000000001000011111100000000000000000000000000000000000000000000000000011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code3(7) = ""
code3(8) = "000000000000000000000000000000000000000000000000000000000000000000011110000000000000000000000000000000000000000000001110001111110000000000000000000000000000000000000000000111110111111100000000000000000000000000000000000000000001111111100011100000000000000000000000000000000000000000010001110000011000000000000000000000000000000000000000000100011100000110000000000000000000000000000000000000000001000011100001100000000000000000000000000000000000000000011001111000011000000000000000000000000000000000000000000111111111001110000000000000000000000000000000000000000001111101111111000000000000000000000000000000000000000000001110001111110000000000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code3(9) = ""
code4(0) = "000000000000000000000000000000000000000000000000000000000000000000011111100000000000000000000000000000000000000000000000011111111110000000000000000000000000000000000000000000001111111111110000000000000000000000000000000000000000000111100000011100000000000000000000000000000000000000000001100000000001000000000000000000000000000000000000000000011000000000010000000000000000000000000000000000000000000110000000000100000000000000000000000000000000000000000001111000000111000000000000000000000000000000000000000000001111111111110000000000000000000000000000000000000000000001111111111000000000000000000000000000000000000000000000000111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code4(1) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000011000000001110000000000000000000000000000000000000000000100001111111100000000000000000000000000000000000000000001111111111111000000000000000000000000000000000000000000111111111100110000000000000000000000000000000000000000001111110000001100000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code4(2) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000011110000000000000000000000000000000000000000000100000001101100000000000000000000000000000000000000000010000000100011000000000000000000000000000000000000000000000000011000110000000000000000000000000000000000000000000000001100001100000000000000000000000000000000000000000000000110000011000000000000000000000000000000000000000000100011100000110000000000000000000000000000000000000000001111110000001100000000000000000000000000000000000000000011111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code4(3) = "000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000100001100001100000000000000000000000000000000000000000011000011000011000000000000000000000000000000000000000000110000110000110000000000000000000000000000000000000000001100001110011100000000000000000000000000000000000000000011000111111110000000000000000000000000000000000000000000111111011111100000000000000000000000000000000000000000001111110011100000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code4(4) = ""
code4(5) = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111100000000000000000000000000000000000000000000000011111011000000000000000000000000000000000000000000000000110000110000000000000000000000000000000000000000000000001100001110001000000000000000000000000000000000000000000011000001111100000000000000000000000000000000000000000000110000001110000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code4(6) = ""
code4(7) = ""
code4(8) = "000000000000000000000000000000000000000000000000000000000000000000000011100000000000000000000000000000000000000000000000000001111100000000000000000000000000000000000000000000011100110001100000000000000000000000000000000000000000001111101000001000000000000000000000000000000000000000000010001100000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000100000111000100000000000000000000000000000000000000000001100000111111000000000000000000000000000000000000000000011111000111100000000000000000000000000000000000000000000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
code4(9) = ""
Text2.Text = ""
For i = 0 To 9
If txtInput0.Text = code1(i) Then Text2.Text = Text2.Text & i
Next i
For i = 0 To 9
If txtInput1.Text = code2(i) Then Text2.Text = Text2.Text & i
Next i
For i = 0 To 9
If txtInput2.Text = code3(i) Then Text2.Text = Text2.Text & i
Next i
For i = 0 To 9
If txtInput3.Text = code4(i) Then Text2.Text = Text2.Text & i
Next i
End Sub
Private Sub Command8_Click()
CommonDialog1.ShowOpen
Set Picture1.Picture = LoadPicture(CommonDialog1.FileName)
End Sub
Private Sub Command9_Click()
Set Picture1.Picture = LoadPicture()
Set Picture2.Picture = LoadPicture()
Set Picture3.Picture = LoadPicture()
End Sub
Private Sub InetVCode_StateChanged(ByVal State As Integer)
If State = icResponseCompleted Then
Dim BinBuff() As Byte
Dim StrPath As String
StrPath = g_TempPath & "vcode.jpg"
BinBuff = InetVCode.GetChunk(0, icByteArray)
If Dir(StrPath) <> "" Then Kill StrPath
Open StrPath For Binary As #1
Put #1, , BinBuff
Close #1
Set Picture1.Picture = LoadPicture(StrPath)
End If
End Sub
Private Sub Picture1_Change()
Picture2.Height = Picture1.Height
Picture2.Width = Picture1.Width
Picture3.Height = Picture1.Height
Picture3.Width = Picture1.Width
LHEIGHT.Caption = Picture1.ScaleWidth / Screen.TwipsPerPixelX - 1
LWIDTH.Caption = Picture1.ScaleHeight / Screen.TwipsPerPixelY - 1
End Sub
Private Sub ruku_Click(Index As Integer)
Select Case Index
Case 0
Print "0"
Open App.Path & "\data\1.text" For Append As #1
Print #1, txtInput0.Text & Z1.Text
Close #1
Case 1
Open App.Path & "\data\2.text" For Append As #2
Print #2, txtInput1.Text & Z2.Text
Close #2
Case 2
Open App.Path & "\data\3.text" For Append As #3
Print #3, txtInput2.Text & Z3.Text
Close #3
Case 3
Open App.Path & "\data\4.text" For Append As #4
Print #4, txtInput3.Text & Z4.Text
Close #4
End Select
End Sub

程序代码:Option Explicit
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Public g_TempPath As String
Public Function GetTempPathStr() As String
Dim StrBuff As String * 256
Dim StrOut As String
Dim n As Integer
n = GetTempPath(256&, StrBuff)
If n <> 0 Then
StrOut = Left(StrBuff, n)
If Right(StrOut, 1) <> "\" Then StrOut = StrOut & "\"
GetTempPathStr = StrOut
End If
End Function
Public Function GetSubString(StrDes As String, StrHead As String, StrEnd As String)
Dim m As Long, n As Long
m = InStr(1, StrDes, StrHead, vbTextCompare)
If m = 0 Then
GetSubString = ""
Exit Function
End If
m = m + Len(StrHead)
n = InStr(m, StrDes, StrEnd, vbTextCompare)
If n = 0 Then
GetSubString = ""
Exit Function
End If
GetSubString = Mid(StrDes, m, n - m)
End Function
