验证码识别程序的问题!
这几天从网上下载下了个验证码识别的源代码,样版已经更改过了!验证码还是无法识别!郁闷哈!!请各位大牛帮看看是什么原因!随便也注解一下哈!!谢谢!
Private WordX As String, WordY As String, Word26(26) As String
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
'//本程序没什么技术含量,也不是真正意义是图象识别技术.纯粹写着玩,今天晚上太无聊了.哎~~
'// ----------- BY: 一周八天@
Private Sub Command1_Click()
Command1.Enabled = False
If Len(Text1.Text) = 5 Then Text1.Text = ""
Static Words As Byte
WordY = (Me.Top + Picture1.Top) / Screen.TwipsPerPixelY + 4
WordX = (Me.Left + Picture1.Left) / Screen.TwipsPerPixelX + 5 + (Words) * 9
Dim tempColor As Long
Dim i As Byte, x As Byte, y As Byte, arrColor(54) As Boolean
Dim dc
dc = GetDC(0)
i = 1
For y = 0 To 8
For x = 0 To 5
Print WordX + x, WordY + y
tempColor = GetPixel(dc, WordX + x, WordY + y)
' SetCursorPos WordX + x, WordY + y - 1
'Print tempColor
arrColor(i) = False
If (tempColor - 3200000) > 0 Then arrColor(i) = True
i = i + 1
Next
Next
Dim w As Integer, Best As Byte, Temp As Byte, bestIndex As Byte
For w = 1 To 10
Temp = 0
For i = 1 To 54
If arrColor(i) = Mid(Word26(w), i, 1) Then Temp = Temp + 1
Next
If Temp > Best Then Best = Temp: bestIndex = w
Next
Text1.Text = Text1.Text & bestIndex ' Chr(64 + bestIndex)
If Words < 3 Then
Words = Words + 1
Command1_Click
Else
Words = 0
Command1.Enabled = True
End If
ReleaseDC 0, dc
End Sub
Private Sub Form_Load()
Picture1.Picture = LoadPicture("G:\VB\网页\4.jpg")
'采样(本程序修改后完成的此功能.)
Word26(1) = "001100010010100001100001100001100001100001010010001100"
Word26(2) = "001100010100000100000100000100000100000100000100011111"
Word26(3) = "111100000010000010000010000100001000010000100000111110"
Word26(4) = "111100000010000010000100011000000100000010000010011100"
Word26(5) = "000010000110001010010010100010111111000010000010000010"
Word26(6) = "111110100000100000111000000100000010000010000100111000"
Word26(7) = "001111010000100000101100110010100001100001010010001100"
Word26(8) = "111111000001000010000100000100001000001000010000010000"
Word26(9) = "011110100001100001010010011110100001100001100001011110"
Word26(10) = "001100010010100001100001010011001101000001000010111100"
End Sub
Private Sub Label1_Click()
Unload Me
End Sub
[[it] 本帖最后由 tig2 于 2008-4-17 01:00 编辑 [/it]]