home *** CD-ROM | disk | FTP | other *** search
- Type APIFileOpenMasterForm From SampleMasterForm
- Dim btnOpen As New Button
- Dim Label1 As New Label
- Dim Label2 As New Label
- Dim lblFilePath As New Label
- Dim Label3 As New Label
- Dim lblFileName As New Label
- Dim Label5 As New Label
- Dim lblDirectory As New Label
- Dim OpenPanel As New OpenDialog
- Dim Label4 As New Label
- Dim txtTitle As New TextBox
- Dim Label6 As New Label
- Dim optBmpFiles As New OptionButton
- Dim optTextFiles As New OptionButton
- Dim optExecutables As New OptionButton
- Dim optAllFiles As New OptionButton
- Dim Label7 As New Label
- Dim chkFileMustExist As New CheckBox
- Dim chkNoChangeDir As New CheckBox
- Dim chkNoNetworkButton As New CheckBox
- Dim chkPathMustExist As New CheckBox
- Dim FileObject As New File
- Dim Label8 As New Label
- Dim lblFileSize As New Label
- Dim Label9 As New Label
- Dim lblFileExtension As New Label
- Dim Label11 As New Label
- Dim lblFileDate As New Label
- Dim Label13 As New Label
- Dim lblFileTime As New Label
-
- ' METHODS for object: APIFileOpenMasterForm
- Sub optExecutables_Click()
- OpenPanel.Filter = "Executable files (*.exe)|*.exe|"
- End Sub
-
- Sub optTextFiles_Click()
- OpenPanel.Filter = "Text files (*.txt)|*.txt|Script files (*.bat)|*.bat|System files (*.sys)|*.sys|Config files (*.ini)|*.ini|"
- End Sub
-
- Sub optAllFiles_Click()
- OpenPanel.Filter = "All files (*.*)|*.*|"
- End Sub
-
- Sub optBmpFiles_Click()
- OpenPanel.Filter = "Bitmap files (*.bmp)|*.bmp|"
- End Sub
-
- Sub chkFileMustExist_Click()
- If chkFileMustExist.Value == 0 Then
- OpenPanel.FileMustExist = "False"
- Else
- OpenPanel.FileMustExist = "True"
- End If
- End Sub
-
- Sub chkNoChangeDir_Click()
- If chkNoChangeDir.Value == 0 Then
- OpenPanel.NoChangeDir = "False"
- Else
- OpenPanel.NoChangeDir = "True"
- End If
- End Sub
-
- Sub chkNoNetworkButton_Click()
- If chkNoNetworkButton.Value == 0 Then
- OpenPanel.NoNetworkButton = "False"
- Else
- OpenPanel.NoNetworkButton = "True"
- End If
- End Sub
-
- Sub chkPathMustExist_Click()
- If chkPathMustExist.Value == 0 Then
- OpenPanel.PathMustExist = "False"
- Else
- OpenPanel.PathMustExist = "True"
- End If
- End Sub
-
- Sub btnOpen_Click()
- Dim length As Integer
- Dim IDCANCEL As Integer
-
- ' IDCANCEL is also defined in USER32.PHO
- IDCANCEL = 2
-
- ' Set the title of the open dialog just before we display it.
- OpenPanel.Title = txtTitle.Text
-
- ' Set the initial dir and filename to previous selection (or empty).
- OpenPanel.InitialDir = lblFilePath.Text
- OpenPanel.FileName = lblFileName.Text & lblFileExtension.Text
-
- ' If a filename was picked, then display selected file information.
- If OpenPanel.Execute <> IDCANCEL Then
- FileObject.FileName = OpenPanel.FileName
- lblFilePath.Text = FileObject.FileName
- lblDirectory.Text = FileObject.Path
- lblFileName.Text = FileObject.Name
- lblFileSize.Text = FileObject.Size
- lblFileExtension.Text = FileObject.Extension
- lblFileDate.Text = FileObject.Date
- lblFileTime.Text = FileObject.Time
- Else
- lblFilePath.Text = ""
- lblDirectory.Text = ""
- lblFileName.Text = ""
- lblFileSize.Text = ""
- lblFileExtension.Text = ""
- lblFileDate.Text = ""
- lblFileTime.Text = ""
- End If
- End Sub
-
- Sub ResetApplication_Click ()
-
- ' Initialize Open Dialog Demonstration
-
- optBmpFiles.Value = False
- optTextFiles.Value = False
- optExecutables.Value = False
- optAllFiles.Value = True
-
- ' Set open panel defaults
- OpenPanel.Filter = "All files (*.*)|*.*|"
-
- OpenPanel.FileMustExist = "True"
- OpenPanel.NoChangeDir = "False"
- OpenPanel.NoNetworkButton = "False"
- OpenPanel.PathMustExist = "True"
-
- ' Set the checkbox defaults
- chkFileMustExist.Value = 1
- chkNoChangeDir.Value = 0
- chkNoNetworkButton.Value = 0
- chkPathMustExist.Value = 1
-
- ' Clear out the file/directory labels
- lblDirectory.Text = ""
- lblFileName.Text = ""
- lblFilePath.Text = ""
- lblFileSize.Text = ""
- lblFileExtension.Text = ""
- lblFileDate.Text = ""
- lblFileTime.Text = ""
-
- End Sub
-
- End Type
-
- Begin Code
- ' Reconstruction commands for object: APIFileOpenMasterForm
- '
- With APIFileOpenMasterForm
- .Caption := "Windows Open Dialog Demonstration"
- .Move(6315, 1245, 7800, 7215)
- .CurrentY := 64
- .DefaultButton := APIFileOpenMasterForm.btnOpen
- .SampleDir := "W:\examples\apiopen\"
- .SampleName := "apiopen"
- With .btnOpen
- .Caption := "&Open"
- .Move(3150, 5850, 1800, 450)
- End With 'APIFileOpenMasterForm.btnOpen
- With .Label1
- .Caption := "1. Select options below then choose ""Open"" to select a file."
- .ForeColor := 13107200
- .Move(300, 300, 5850, 300)
- End With 'APIFileOpenMasterForm.Label1
- With .Label2
- .Caption := "FileName:"
- .Move(255, 3450, 1140, 300)
- .Alignment := "Right"
- End With 'APIFileOpenMasterForm.Label2
- With .lblFilePath
- .BackColor := 16777215
- .Move(1500, 3450, 5850, 300)
- .BorderStyle := "Fixed Single"
- End With 'APIFileOpenMasterForm.lblFilePath
- With .Label3
- .Caption := "Name:"
- .Move(285, 4275, 1110, 300)
- .Alignment := "Right"
- End With 'APIFileOpenMasterForm.Label3
- With .lblFileName
- .BackColor := 16777215
- .Move(1500, 4290, 5850, 300)
- .BorderStyle := "Fixed Single"
- End With 'APIFileOpenMasterForm.lblFileName
- With .Label5
- .Caption := "Path:"
- .Move(255, 3855, 1140, 300)
- .Alignment := "Right"
- End With 'APIFileOpenMasterForm.Label5
- With .lblDirectory
- .BackColor := 16777215
- .Move(1500, 3855, 5850, 300)
- .BorderStyle := "Fixed Single"
- End With 'APIFileOpenMasterForm.lblDirectory
- With .OpenPanel
- .FileName := "W:\bin\appstub.EXE"
- .Filter := "All files (*.*)|*.*|"
- .InitialDir := "W:\ALLOBJS.TXT"
- End With 'APIFileOpenMasterForm.OpenPanel
- With .Label4
- .Caption := "Title:"
- .Move(300, 960, 600, 300)
- End With 'APIFileOpenMasterForm.Label4
- With .txtTitle
- .Move(945, 900, 6405, 360)
- End With 'APIFileOpenMasterForm.txtTitle
- With .Label6
- .Caption := "Filter:"
- .Move(300, 1500, 1500, 300)
- End With 'APIFileOpenMasterForm.Label6
- With .optBmpFiles
- .Caption := "&Bitmap Files [*.BMP]"
- .Move(450, 1800, 2700, 300)
- .TabGroup := True
- End With 'APIFileOpenMasterForm.optBmpFiles
- With .optTextFiles
- .Caption := "&Text Files [*.TXT, *.BAT, *.SYS, *.INI]"
- .Move(450, 2100, 3900, 300)
- End With 'APIFileOpenMasterForm.optTextFiles
- With .optExecutables
- .Caption := "&Executables [*.EXE]"
- .Move(450, 2400, 2700, 300)
- End With 'APIFileOpenMasterForm.optExecutables
- With .optAllFiles
- .Caption := "&All Files [*.*]"
- .Move(450, 2700, 2700, 300)
- .TabStop := True
- .Value := True
- End With 'APIFileOpenMasterForm.optAllFiles
- With .Label7
- .Caption := "Options:"
- .Move(4500, 1500, 1500, 300)
- End With 'APIFileOpenMasterForm.Label7
- With .chkFileMustExist
- .Caption := "File Must E&xist"
- .Move(4635, 1815, 2700, 300)
- .TabGroup := True
- .Value := "Checked"
- End With 'APIFileOpenMasterForm.chkFileMustExist
- With .chkNoChangeDir
- .Caption := "No &Change Directory"
- .Move(4635, 2115, 2700, 300)
- End With 'APIFileOpenMasterForm.chkNoChangeDir
- With .chkNoNetworkButton
- .Caption := "No &Network Button"
- .Move(4635, 2415, 2700, 300)
- End With 'APIFileOpenMasterForm.chkNoNetworkButton
- With .chkPathMustExist
- .Caption := "&Path Must Exist"
- .Move(4635, 2715, 2700, 300)
- .Value := "Checked"
- End With 'APIFileOpenMasterForm.chkPathMustExist
- With .FileObject
- .FileName := "W:\bin\appstub.EXE"
- End With 'APIFileOpenMasterForm.FileObject
- With .Label8
- .Caption := "Size:"
- .Move(255, 5235, 1140, 300)
- .Alignment := "Right"
- End With 'APIFileOpenMasterForm.Label8
- With .lblFileSize
- .BackColor := 16777215
- .Move(1500, 5235, 1650, 300)
- .BorderStyle := "Fixed Single"
- End With 'APIFileOpenMasterForm.lblFileSize
- With .Label9
- .Caption := "Extension:"
- .Move(270, 4785, 1125, 300)
- .Alignment := "Right"
- End With 'APIFileOpenMasterForm.Label9
- With .lblFileExtension
- .BackColor := 16777215
- .Move(1500, 4785, 1665, 300)
- .BorderStyle := "Fixed Single"
- End With 'APIFileOpenMasterForm.lblFileExtension
- With .Label11
- .Caption := "Last mod. date:"
- .Move(3480, 4815, 1695, 300)
- .Alignment := "Right"
- End With 'APIFileOpenMasterForm.Label11
- With .lblFileDate
- .BackColor := 16777215
- .Move(5250, 4800, 2100, 300)
- .BorderStyle := "Fixed Single"
- End With 'APIFileOpenMasterForm.lblFileDate
- With .Label13
- .Caption := "Last mod. time:"
- .Move(3480, 5265, 1695, 300)
- .Alignment := "Right"
- End With 'APIFileOpenMasterForm.Label13
- With .lblFileTime
- .BackColor := 16777215
- .Move(5250, 5250, 2100, 300)
- .BorderStyle := "Fixed Single"
- End With 'APIFileOpenMasterForm.lblFileTime
- With .helpfile
- .FileName := "W:\examples\apiopen\apiopen.hlp"
- End With 'APIFileOpenMasterForm.helpfile
- End With 'APIFileOpenMasterForm
- End Code
-