广告合作
  • 今日头条

    今日头条

  • 百度一下

    百度一下,你就知道

  • 新浪网

    新浪网 - 提供新闻线索,重大新闻爆料

  • 搜狐

    搜狐

  • 豆瓣

    豆瓣

  • 百度贴吧

    百度贴吧——全球领先的中文社区

  • 首页 尚未审核订阅工具 订阅

    使用VB做验证码登陆

    来源:网络收集  点击:  时间:2024-05-22
    【导读】:
    工具/原料moreVisual Basic方法/步骤1/4分步阅读

    打开VB。

    2/4

    绘制控件:TextBox,PictureBox,Label,CommandButton。

    3/4

    添加代码:

    Dim vCode As String

    Private Sub drawvc() 显示校验码

    Dim i, vc, px, py As Long

    Dim r, g, b As Byte

    Randomize 初始化随机种子

    生成随机校验码

    vc = CLng(8999 * Rnd + 1000)

    vCode = vc

    显示校验码

    Picture1.Cls

    Picture1.Print vc

    添加噪点(防止自动图像识别)

    For i = 0 To 2000 画2000个噪点

    画点随机位置

    px = CLng(Picture1.Width * Rnd)

    py = CLng(Picture1.Height * Rnd)

    画点随机颜色

    r = CByte(255 * Rnd)

    g = CByte(255 * Rnd)

    b = CByte(255 * Rnd)

    Picture1.Line (px, py)-(px + 1, py + 1), RGB(r, g, b)

    Next

    End Sub

    Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

    drawvc

    End Sub

    Private Sub Command2_Click()

    If Text1.Text = vCode Then

    MsgBox 验证码正确。, vbInformation + vbSystemModal, 正确

    frmLand.MousePointer = 13

    Timer1.Enabled = True

    Else

    MsgBox 验证码错误。, vbCritical + vbSystemModal, 错误

    Text1.Text =

    drawvc

    End If

    End Sub

    Private Sub Form_Load()

    Picture1.FontSize = 12

    Picture1.FontBold = True

    Picture1.AutoRedraw = True

    drawvc

    End Sub

    4/4

    完成。

    软件
    本文关键词:

    版权声明:

    1、本文系转载,版权归原作者所有,旨在传递信息,不代表看本站的观点和立场。

    2、本站仅提供信息发布平台,不承担相关法律责任。

    3、若侵犯您的版权或隐私,请联系本站管理员删除。

    4、文章链接:http://www.1haoku.cn/art_822433.html

    相关资讯

    ©2019-2020 http://www.1haoku.cn/ 国ICP备20009186号05-05 20:01:52  耗时:0.028
    0.0285s