zoukankan      html  css  js  c++  java
  • 踏破铁鞋无觅处:网页下载图片的代码


    为了解决投票自动识别验证码,必须先得到图片。在单位时,搜到了这段代码,并且在程序中试验成功。回到家,重新搜索,居然搜不到了,一直找到半夜两点,仍然找不到它。。。。那天晚上快疯了。

    今天在整理硬盘时,它却在那硬盘层层目录深处静悄悄地躲藏着呢。

    代码如下:

    Private Sub webSky_DownloadComplete()
        On Error Resume Next
        WebSky.Silent = True
        Me.MousePointer = vbDefault
       
        Dim x, CtrlRange
        Dim sPath As String
       
        sPath = App.Path
       
        sPath = Left(sPath, InStr(sPath, vbNullChar) - 1)
        If Len(sPath) > 3 Then sPath = sPath & "\"
       
        If Trim(txtUser.Text) <> "" Then
            gstrFileName = sPath & Trim(txtUser.Text) & "Code.bmp"
        Else
            gstrFileName = sPath & "TempCode.bmp"
        End If

        For Each x In WebSky.Document.All
            If x.tagName = "IMG" Then
                    WebSky.Stop
                    Set CtrlRange = WebSky.Document.body.createControlRange()
                    CtrlRange.Add (x)
                    CtrlRange.execCommand ("Copy")
                   
                    SavePicture Clipboard.GetData, gstrFileName
                   
                    'getCodeForSky
                   
                End If
            End If
        Next
    End Sub

  • 相关阅读:
    mac下更改MySQL的默认编码
    pycharm使用gitlab输错密码解决办法
    Django中form组件的is_valid校验机制
    装饰器整理
    粘包
    MySQL常见数据库引擎及对比
    jtag、在线仿真器
    《如何高效学习》-整体性学习策略
    keil5到iar8的使用配置迁移
    Python3学习(1)——初步了解
  • 原文地址:https://www.cnblogs.com/spy/p/350770.html
Copyright © 2011-2022 走看看