frmFlashgetDownload.frm
资源名称:IE_VB.rar [点击查看]
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:20k
源码类别:
浏览器
开发平台:
Visual Basic
- VERSION 5.00
- Begin VB.Form frmFlashgetDownload
- BorderStyle = 3 'Fixed Dialog
- Caption = "下载批量文件"
- ClientHeight = 2100
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 6030
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- HasDC = 0 'False
- Icon = "frmFlashgetDownload.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- NegotiateMenus = 0 'False
- ScaleHeight = 2100
- ScaleWidth = 6030
- ShowInTaskbar = 0 'False
- StartUpPosition = 1 'CenterOwner
- Begin VB.Frame Frame1
- BorderStyle = 0 'None
- Caption = "Frame1"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 735
- Left = 60
- TabIndex = 9
- Top = 810
- Width = 5895
- Begin VB.TextBox txtBeginPos
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 1680
- TabIndex = 1
- Text = "Text2"
- Top = 0
- Width = 615
- End
- Begin VB.TextBox txtEndPos
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 2640
- TabIndex = 2
- Text = "Text3"
- Top = 0
- Width = 615
- End
- Begin VB.TextBox txtStarLength
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 4440
- TabIndex = 3
- Text = "Text4"
- Top = 0
- Width = 735
- End
- Begin VB.CheckBox chkStar
- Appearance = 0 'Flat
- Caption = "通配符1:(*)"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 195
- Left = 0
- TabIndex = 12
- TabStop = 0 'False
- Top = 45
- Value = 1 'Checked
- Width = 1455
- End
- Begin VB.CheckBox Check2
- Appearance = 0 'Flat
- Caption = "通配符2:(*1)"
- Enabled = 0 'False
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 195
- Left = 0
- TabIndex = 11
- Top = 480
- Width = 1455
- End
- Begin VB.CommandButton cmdAuto
- Caption = "Auto"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 5280
- TabIndex = 10
- Top = 0
- Width = 615
- End
- Begin VB.Label Label2
- Caption = "通配符长度"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 3480
- TabIndex = 15
- Top = 45
- Width = 975
- End
- Begin VB.Label Label3
- Caption = "从"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 1440
- TabIndex = 14
- Top = 45
- Width = 255
- End
- Begin VB.Label Label4
- Caption = "到"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 2400
- TabIndex = 13
- Top = 45
- Width = 255
- End
- End
- Begin VB.CommandButton cmdGetUrl
- Caption = "当前URL"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 4980
- TabIndex = 8
- Top = 420
- Width = 975
- End
- Begin VB.TextBox txtUrl
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 285
- Left = 540
- OLEDropMode = 2 'Automatic
- TabIndex = 0
- Text = "Text1"
- Top = 60
- Width = 5415
- End
- Begin VB.CommandButton cmdCancel
- Cancel = -1 'True
- Caption = "取消"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 5100
- TabIndex = 6
- Top = 1680
- Width = 855
- End
- Begin VB.CommandButton cmdOk
- Caption = "确定"
- Default = -1 'True
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 4140
- TabIndex = 5
- Top = 1680
- Width = 855
- End
- Begin VB.Label lblSample
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 60
- TabIndex = 7
- Top = 420
- Width = 3735
- End
- Begin VB.Label Label1
- Caption = "URL:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 60
- TabIndex = 4
- Top = 90
- Width = 495
- End
- End
- Attribute VB_Name = "frmFlashgetDownload"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '---------------------------------------------------------------------------------------
- ' Module : frmFlashgetDownload
- ' DateTime : 200x-x-xx xx:xx
- ' Author : Lingll
- ' Purpose :
- '---------------------------------------------------------------------------------------
- Option Explicit
- Private vTxtBeginPos As cNumberTextBox
- Private vTxtEndPos As cNumberTextBox
- Private vTxtStarLength As cNumberTextBox
- Private Sub chkStar_Click()
- chkStar.Value = 1
- End Sub
- Private Sub cmdAuto_Click()
- Dim tstr$, tVal&
- tstr = txtUrl.SelText
- If tstr <> "" Then
- tVal = Val(tstr)
- txtUrl.SelText = "(*)"
- txtStarLength.Text = Len(tstr)
- txtBeginPos.Text = "1"
- txtEndPos.Text = tVal
- End If
- End Sub
- Private Sub cmdCancel_Click()
- Unload Me
- End Sub
- Private Sub cmdGetUrl_Click()
- If loadedBrowserCount > 0 Then
- txtUrl.Text = webbState(gActiveWebIndex).webForm.GetWebUrl
- End If
- End Sub
- Private Sub cmdOk_Click()
- Call AddUrl
- Unload Me
- End Sub
- Private Sub Form_Load()
- Dim tCtl As Control
- For Each tCtl In Me.Controls
- tCtl.FontName = "宋体"
- tCtl.FontSize = 9
- Next tCtl
- lblSample.Caption = "例如:http://sample.net/sample(*)(*1).htm"
- Call IniTextBox
- End Sub
- Private Sub IniTextBox()
- Set vTxtBeginPos = New cNumberTextBox
- Set vTxtEndPos = New cNumberTextBox
- Set vTxtStarLength = New cNumberTextBox
- vTxtBeginPos.NumberTextBox = txtBeginPos
- vTxtEndPos.NumberTextBox = txtEndPos
- vTxtStarLength.NumberTextBox = txtStarLength
- txtUrl.Text = ""
- txtUrl.Appearance = 0
- End Sub
- Private Sub AddUrl()
- On Error GoTo due
- Dim objjc As JCCATCHLib.JetCarNetscape
- Set objjc = New JCCATCHLib.JetCarNetscape
- Dim i&
- Dim tPos1&, tPos2&
- Dim tZero$
- Dim tUrlArr(), tUrl As String
- tPos1 = vTxtBeginPos.TextVal
- tPos2 = vTxtEndPos.TextVal
- tUrl = txtUrl.Text
- ReDim tUrlArr(0 To (tPos2 - tPos1) * 2 + 2)
- tUrlArr(0) = ""
- tZero = String(vTxtStarLength.TextVal, "0")
- For i = tPos1 To tPos2
- tUrlArr((i - tPos1) * 2 + 1) = Replace(tUrl, "(*)", Format(i, tZero))
- tUrlArr((i - tPos1) * 2 + 2) = ""
- Next i
- objjc.AddUrlList tUrlArr
- Exit Sub
- due:
- MsgBox Err.Description
- End Sub
- Private Sub txtUrl_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
- If Data.GetFormat(vbCFText) Then
- txtUrl.Text = Data.GetData(vbCFText)
- End If
- End Sub
- '
- ''---------------------------------------------------------------------------------------
- '' Procedure : GetImageUrl
- '' DateTime : 2005-5-9 23:46
- '' Author : Lingll
- '' Purpose : 获得img的url,供外部使用
- ''---------------------------------------------------------------------------------------
- 'Public Function GetImageUrl() As String
- '
- '
- 'Dim tHtml$, tFrag$, tSUrl$
- 'Dim tPos&
- 'tHtml = GetCFHtml()
- 'tFrag = GetFragment(tHtml)
- 'tSUrl = GetSourceURL(tHtml)
- '
- 'tPos = IsImageDrop(tFrag)
- 'If tPos > 0 Then
- ' GetImageUrl = GetImgUrl(tSUrl, tFrag)
- 'End If
- '
- '
- 'End Function
- '
- '
- ''---------------------------------------------------------------------------------------
- '' Procedure : GetImgUrl
- '' DateTime : 2005-5-10 15:55
- '' Author : Lingll
- '' Purpose : 获得img的url,供内部使用
- ''---------------------------------------------------------------------------------------
- 'Private Function GetImgUrl(vUrl$, vHtml$) As String
- 'On Error Resume Next
- ' Dim tPos1&, tPos2&, tPos3&
- ' Dim tOrgSrc$
- '
- ' tPos1 = InStr(1, vHtml, "<IMG ", vbTextCompare)
- ' If tPos1 > 0 Then
- ' tPos3 = InStr(tPos1, vHtml, ">", vbTextCompare)
- ' tPos1 = InStr(tPos1 + 1, vHtml, "src=", vbTextCompare)
- ' If tPos1 > 0 Then
- ' Select Case Mid$(vHtml, tPos1 + 4, 1)
- ' Case "'"
- ' tPos2 = InStr(tPos1 + 5, vHtml, "'")
- ' If tPos2 > 0 And tPos2 < tPos3 Then
- ' tOrgSrc = Mid$(vHtml, tPos1 + 5, tPos2 - tPos1 - 5)
- ' End If
- ' Case """"
- ' tPos2 = InStr(tPos1 + 5, vHtml, """")
- ' If tPos2 > 0 And tPos2 < tPos3 Then
- ' Debug.Print tPos2 - tPos1 - 5
- ' tOrgSrc = Mid$(vHtml, tPos1 + 5, tPos2 - tPos1 - 5)
- ' End If
- ' Case Else
- ' tPos2 = InStr(tPos1 + 1, vHtml, " ")
- ' If tPos2 <= 0 Or tPos2 > tPos3 Then
- ' tPos2 = tPos3
- ' End If
- ' tOrgSrc = Mid$(vHtml, tPos1 + 4, tPos2 - tPos1 - 4)
- ' End Select
- '
- ' If tOrgSrc <> vbNullString Then
- ' GetImgUrl = GetRealUrl(vUrl, tOrgSrc)
- ' End If
- ' End If
- ' End If
- '
- 'End Function
- '
- '
- ''---------------------------------------------------------------------------------------
- '' Procedure : GetRealUrl
- '' DateTime : 2005-5-10 16:21
- '' Author : Lingll
- '' Purpose :
- ''---------------------------------------------------------------------------------------
- 'Private Function GetRealUrl(ByVal vSrcUrl$, ByVal vOrgUrl$) As String
- '
- 'Dim tPos1&, tPos1Pre&, tPos2&, tPosStart&
- '
- 'If InStr(1, vOrgUrl, "://") > 0 Then
- ' GetRealUrl = vOrgUrl
- 'ElseIf InStr(1, vOrgUrl, ":") > 0 Then
- ' GetRealUrl = vOrgUrl
- 'Else
- ' vOrgUrl = Replace(vOrgUrl, "", "/")
- ' vSrcUrl = Replace(vSrcUrl, "", "/")
- ' If Right$(vSrcUrl, 1) <> "/" Then
- ' tPos1 = InStrRev(vSrcUrl, "/")
- ' If tPos1 > 0 Then
- ' vSrcUrl = Left$(vSrcUrl, tPos1)
- ' End If
- ' End If
- ' tPosStart = InStr(1, vSrcUrl, "://")
- ' tPos1 = InStr(1, vOrgUrl, "../")
- ' tPos1Pre = 0
- ' tPos2 = Len(vSrcUrl)
- ' While tPos1 > 0
- ' tPos2 = InStrRev(vSrcUrl, "/", tPos2 - 1)
- '
- ' tPos1Pre = tPos1
- ' tPos1 = InStr(tPos1 + 1, vOrgUrl, "../")
- ' Wend
- ' If tPos1Pre > 0 Then
- ' GetRealUrl = Left$(vSrcUrl, tPos2) & Replace(Mid$(vOrgUrl, tPos1Pre + 3), "./", "")
- ' ElseIf tPos1Pre = 0 Then
- ' GetRealUrl = vSrcUrl & Replace(vOrgUrl, "./", "")
- ' End If
- 'End If
- '
- 'End Function
- '
- '
- ''---------------------------------------------------------------------------------------
- '' Procedure : GetCFHtml
- '' DateTime : 2005-5-10 15:50
- '' Author : Lingll
- '' Purpose :
- ''---------------------------------------------------------------------------------------
- 'Public Function GetCFHtml(Data As DataObject) As String
- ' Dim tArr() As Byte
- ' Dim tstr$
- ' Dim FMT As FORMATETC, STM As STGMEDIUM
- ' With FMT
- ' .cfFormat = CF_HTML
- ' .TYMED = TYMED_HGLOBAL
- ' .dwAspect = DVASPECT_CONTENT
- ' .lindex = -1
- ' End With
- '
- ' If m_DragDropDataObject.GetData(FMT, STM) = 0 Then
- ' 'GetCFHtml = StrConv(pvStringFromhGlobal(STM.Data), vbUnicode)
- ' tArr = pvStringFromhGlobal(STM.Data)
- ' GetCFHtml = UTF8_Decode(tArr)
- ' ReleaseStgMedium STM
- ' End If
- '
- 'End Function
- '
- ''---------------------------------------------------------------------------------------
- '' Procedure : GetFragment
- '' DateTime : 2005-5-9 23:52
- '' Author : Lingll
- '' Purpose : 获得在 "<!--StartFragment-->","<!--EndFragment-->"之间的东西
- ''---------------------------------------------------------------------------------------
- 'Private Function GetFragment(vHtml$) As String
- ' Dim tPos1&, tPos2&
- '
- ' tPos1 = InStr(1, vHtml, cfhtml_Tag_Start, vbTextCompare)
- ' If tPos1 > 0 Then
- ' tPos2 = InStr(tPos1, vHtml, cfhtml_Tag_End, vbTextCompare)
- ' If tPos2 > 0 Then
- ' GetFragment = Mid$(vHtml, tPos1 + Len(cfhtml_Tag_Start), tPos2 - tPos1 - Len(cfhtml_Tag_Start))
- ' End If
- ' End If
- 'End Function
- '
- '
- ''---------------------------------------------------------------------------------------
- '' Procedure : GetSourceURL
- '' DateTime : 2005-5-10 16:02
- '' Author : Lingll
- '' Purpose :
- ''---------------------------------------------------------------------------------------
- 'Private Function GetSourceURL(vHtml$) As String
- '
- ' Dim tPos1&, tPos2&
- ' tPos1 = InStr(1, vHtml, cfhtml_Tag_SourceURL, vbTextCompare)
- ' If tPos1 > 0 Then
- ' tPos2 = InStr(tPos1, vHtml, vbNewLine)
- ' If tPos2 > 0 Then
- ' GetSourceURL = Mid$(vHtml, tPos1 + Len(cfhtml_Tag_SourceURL), tPos2 - tPos1 - Len(cfhtml_Tag_SourceURL))
- ' End If
- ' End If
- '
- 'End Function
- '
- ''---------------------------------------------------------------------------------------
- '' Procedure : IsImageDrop
- '' DateTime : 2005-5-9 23:57
- '' Author : Lingll
- '' Purpose :
- ''---------------------------------------------------------------------------------------
- 'Public Function IsImageDrop(vImghtml$) As Long
- 'Dim FMT As FORMATETC
- ' With FMT
- ' .cfFormat = vbCFDIB
- ' .TYMED = TYMED_HGLOBAL
- ' .dwAspect = DVASPECT_CONTENT
- ' .lindex = -1
- ' End With
- ' If m_DragDropDataObject.QueryGetData(FMT) = 0 Then
- ' IsImageDrop = InStr(1, vImghtml, "<IMG ", vbTextCompare)
- ' Else
- ' IsImageDrop = 0
- ' End If
- 'End Function
- '
- '
- '
- '
- ''---------------------------------------------------------------------------------------
- '' Procedure : GetHtmlTag
- '' DateTime : 2005-5-10 18:38
- '' Author : Lingll
- '' Purpose : url,text,img
- ''---------------------------------------------------------------------------------------
- 'Public Function GetHtmlDragDropType() As String
- 'Dim FMT As FORMATETC
- 'Dim isHtml As Boolean, isDIB As Boolean, isUrl As Boolean, isText As Boolean
- 'With FMT
- ' .TYMED = TYMED_HGLOBAL
- ' .dwAspect = DVASPECT_CONTENT
- ' .lindex = -1
- 'End With
- '
- 'FMT.cfFormat = CF_HTML
- 'isHtml = (m_DragDropDataObject.QueryGetData(FMT) = 0)
- '
- 'FMT.cfFormat = vbCFDIB
- 'isDIB = (m_DragDropDataObject.QueryGetData(FMT) = 0)
- '
- 'FMT.cfFormat = CF_URL
- 'isUrl = (m_DragDropDataObject.QueryGetData(FMT) = 0)
- '
- 'FMT.cfFormat = vbCFText
- 'isText = (m_DragDropDataObject.QueryGetData(FMT) = 0)
- '
- 'If isHtml And isDIB Then
- ' GetHtmlDragDropType = "img"
- 'ElseIf isUrl Then
- ' GetHtmlDragDropType = "url"
- 'ElseIf isText Then
- ' GetHtmlDragDropType = "text"
- 'End If
- '
- 'End Function