⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 简单验证码识别 使用VB制作 希望对大家可以相互进行交流
💻 FRM
字号:
VERSION 5.00
Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "MSINET.OCX"
Begin VB.Form Form1 
   Caption         =   "验证码识别"
   ClientHeight    =   1455
   ClientLeft      =   4830
   ClientTop       =   5910
   ClientWidth     =   3225
   LinkTopic       =   "Form1"
   ScaleHeight     =   97
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   215
   Begin InetCtlsObjects.Inet Inet1 
      Left            =   2160
      Top             =   240
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      Protocol        =   4
      URL             =   "http://"
   End
   Begin VB.CommandButton Command1 
      Caption         =   "识别"
      Height          =   375
      Left            =   2280
      TabIndex        =   1
      Top             =   960
      Width           =   735
   End
   Begin VB.PictureBox Picture1 
      BackColor       =   &H00000000&
      Height          =   465
      Left            =   360
      Picture         =   "Form1.frx":0000
      ScaleHeight     =   27
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   100
      TabIndex        =   0
      Top             =   360
      Width           =   1560
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0C0&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   375
      Left            =   360
      TabIndex        =   2
      Top             =   960
      Width           =   1575
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 1
Dim c1(63) As Integer   '存放单个验证码的字模
Private Sub Command1_Click()
    Dim b() As Byte
    Dim xx As Integer   '验证码X坐标的起始位置
    'Y坐标的y1和y2是固定的
        
    Command1.Enabled = False
    Label1.Caption = ""
    xx = 4
    x = FreeFile
    Inet1.URL = "http://member.cnc.mytv365.net/validateCode/index.asp?200782061408"
    b() = Inet1.OpenURL(, icByteArray)
    Open "c:\tmp.bmp" For Binary Access Write As #x
    Put #x, , b()
    Close #x
    Picture1.Picture = LoadPicture("c:\tmp.bmp")
    For i = 1 To 4
        Label1.Caption = Label1.Caption & getNumber(xx, xx + 6, 3, 11)
        xx = xx + 8
    Next i
    Command1.Enabled = True

End Sub

Function getNumber(x1 As Integer, x2 As Integer, y1 As Integer, y2 As Integer) As Integer
    Dim tmp As Long
    Dim s1 As String
    x = FreeFile
    For i = x1 To x2
        For j = y1 To y2
            tmp = Picture1.Point(i, j)
            s1 = Trim(Hex(tmp))
            If Len(s1) > 2 Then
                If Val("&h" & Right(s1, 2)) > 100 Then
                    c1((i - x1) * 9 + j - y1 + 1) = 1
                Else
                    c1((i - x1) * 9 + j - y1 + 1) = 0
                End If
            Else
                c1((i - x1) * 9 + j - y1 + 1) = 0
            End If
        Next j
    Next i
    
    For i = 0 To 8 '跟现有的字模比较
        Open App.Path & "\" & i & ".dat" For Input As #x
        For j = 1 To 63
            Input #x, tmp
            If c1(j) <> tmp Then GoTo zz
        Next j
        If j = 64 Then
            getNumber = i
            Exit Function
        End If
zz:     Close #x
    Next i
    getNumber = i
End Function




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -