home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
- Begin VB.Form frmSaveDoc
- BorderStyle = 3 'Fixed Dialog
- Caption = "Save Web Document to Local Disk"
- ClientHeight = 2310
- ClientLeft = 1335
- ClientTop = 2010
- ClientWidth = 5340
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 2310
- ScaleWidth = 5340
- ShowInTaskbar = 0 'False
- Begin VB.CommandButton btnBrowse
- Caption = "Browse..."
- Height = 375
- Left = 4200
- TabIndex = 2
- Top = 1320
- Width = 975
- End
- Begin VB.TextBox lblURL
- Height = 375
- Left = 240
- TabIndex = 1
- Top = 1320
- Width = 3855
- End
- Begin VB.CommandButton btnSave
- Caption = "Save Web Page"
- Default = -1 'True
- Enabled = 0 'False
- Height = 375
- Left = 240
- TabIndex = 0
- Top = 1800
- Width = 1575
- End
- Begin MSComDlg.CommonDialog dlgSave
- Left = 4680
- Top = 1800
- _ExtentX = 847
- _ExtentY = 847
- _Version = 327680
- CancelError = -1 'True
- DefaultExt = ".htm"
- DialogTitle = "Save As..."
- FileName = "download.htm"
- Filter = "*.htm"
- End
- Begin VB.Line Line1
- X1 = 240
- X2 = 5160
- Y1 = 840
- Y2 = 840
- End
- Begin VB.Label Label6
- Alignment = 2 'Center
- Caption = "vtiIsPageInWeb, vtiGetDocToFile"
- Height = 255
- Left = 240
- TabIndex = 5
- Top = 480
- Width = 4815
- WordWrap = -1 'True
- End
- Begin VB.Label Label5
- Caption = "This form uses the following FrontPage Explorer methods:"
- Height = 255
- Left = 240
- TabIndex = 4
- Top = 120
- Width = 4815
- End
- Begin VB.Label Label1
- Caption = "Page URL:"
- Height = 255
- Left = 240
- TabIndex = 3
- Top = 1080
- Width = 1935
- End
- Attribute VB_Name = "frmSaveDoc"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub btnBrowse_Click()
- MousePointer = 11
- frmGetURL.Tag = ""
- frmGetURL.Show 1
- If frmGetURL.Tag <> "" Then
- lblURL = frmGetURL.Tag
- End If
- frmGetURL.Tag = ""
- MousePointer = 0
- End Sub
- Private Sub btnSave_Click()
- MousePointer = 11
- Dim webber As Object
- Dim ret As Long
- Dim prefix As String
- Dim fn As String
- Dim ext As String
- Dim idx As Integer
- Dim savename As String
- Dim canceled As Boolean
- canceled = False
- On Error GoTo CancelFile
-
- ' prefix for absolute URLs
- prefix = "http://"
- fn = ""
-
- ' get last path component
- savename = lblURL
- ' strip prefix if any
- If InStr(savename, prefix) = 1 Then
- savename = Mid$(savename, Len(prefix) + 1)
- End If
- idx = InStr(savename, "/")
- While idx > 0
- savename = Mid$(savename, idx + 1)
- idx = InStr(savename, "/")
- Wend
- ' if empty name, call it 'index.htm'
- If savename = "" Then
- savename = "index.htm"
- End If
- dlgSave.filename = savename
- ' get last dot extension
- ext = ""
- idx = InStr(savename, ".")
- If idx > 0 Then
- ext = Mid$(savename, idx + 1)
- idx = InStr(ext, ".")
- While idx > 0
- ext = Mid$(ext, idx + 1)
- idx = InStr(ext, ".")
- Wend
- End If
- If ext <> "" Then
- dlgSave.DefaultExt = "." & ext
- End If
- dlgSave.Filter = "Any (*.*)|*.*"
- Set webber = CreateObject("FrontPage.Explorer")
- If webber.vtiIsPageInWeb(lblURL) Then
- dlgSave.ShowSave
- fn = dlgSave.filename
- ElseIf InStr(lblURL, prefix) = 1 Then
- dlgSave.ShowSave
- fn = dlgSave.filename
- Else
- MsgBox "URL is not in current web and does not begin with " & prefix & "."
- End If
- If Not canceled And fn <> "" Then
- ret = webber.vtiGetDocToFile(lblURL, fn)
- End If
- Set webber = Nothing
- MousePointer = 0
- CancelFile:
- canceled = True
- Resume Next
-
- End Sub
- Private Sub lblURL_Change()
- btnSave.Enabled = Len(lblURL.Text) > 0
- End Sub
-