home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form dlgRun
- BorderStyle = 3 'Fixed Dialog
- Caption = "Run"
- ClientHeight = 1935
- ClientLeft = 1140
- ClientTop = 1515
- ClientWidth = 5145
- Height = 2340
- Left = 1080
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1935
- ScaleWidth = 5145
- ShowInTaskbar = 0 'False
- Top = 1170
- Width = 5265
- Begin VB.CommandButton cmdBrowse
- Caption = "&Browse..."
- Height = 375
- Index = 2
- Left = 3840
- TabIndex = 5
- Top = 1440
- Width = 1155
- End
- Begin VB.CommandButton cmdCancel
- Cancel = -1 'True
- Caption = "Cancel"
- Height = 375
- Index = 1
- Left = 2640
- TabIndex = 4
- Top = 1440
- Width = 1155
- End
- Begin VB.CommandButton cmdOK
- Caption = "&OK"
- Default = -1 'True
- Height = 375
- Index = 0
- Left = 1440
- TabIndex = 3
- Top = 1440
- Width = 1155
- End
- Begin VB.TextBox txtCommandLine
- Height = 285
- Left = 840
- TabIndex = 2
- Text = "Text1"
- Top = 840
- Width = 4095
- End
- Begin MSComDlg.CommonDialog Dialogs
- Left = 300
- Top = 1380
- _Version = 65536
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- Caption = "&Open:"
- Height = 195
- Left = 180
- TabIndex = 1
- Top = 900
- Width = 435
- End
- Begin VB.Label Label1
- Caption = "Type the Name of a program, folder, or document, and Windows with open it for you."
- Height = 435
- Left = 840
- TabIndex = 0
- Top = 180
- Width = 3855
- End
- Begin VB.Image Image1
- Height = 480
- Left = 120
- Picture = "dlgRun.frx":0000
- Top = 180
- Width = 480
- End
- Attribute VB_Name = "dlgRun"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Public CommandLine As String
- Private boolOK As Boolean
- Public Function Display() As Boolean
- Me.Show vbModal
- Display = boolOK
- End Function
- Public Function Execute() As Variant
- Dim lngResult As Long
- 'This will return a variant of type error
- 'if the command line does not execute successfully
- 'Otherwise it returns the task ID as a variant
- 'to the calling procedure.
- On Error Resume Next
- lngResult = Shell(CommandLine, vbNormalFocus)
- If Err.Number <> 0 Then
- Execute = CVErr(Err.Number)
- Else
- Execute = lngResult
- End If
- End Function
- Private Sub cmdBrowse_Click(Index As Integer)
- Dialogs.Filter = "Executable Files|*.exe;*.com;*.bat;*.cmd;*.pif|All Files|*.*"
- Dialogs.FilterIndex = 1
- 'These flags require the file to exist, use the Windows 95 interface
- 'and allow the use of long file names.
- Dialogs.Flags = MSComDlg.FileOpenConstants.cdlOFNFileMustExist _
- + MSComDlg.FileOpenConstants.cdlOFNExplorer _
- + MSComDlg.FileOpenConstants.cdlOFNLongNames
- 'This allows the program to retrieve information when
- 'the user cancels the dialog.
- Dialogs.CancelError = True
- On Error Resume Next
- 'This uses the new method rather than the old Action property
- Dialogs.ShowOpen
- If Err.Number = 0 Then
- txtCommandLine = Dialogs.FileName
- Else
- If Err.Number <> MSComDlg.ErrorConstants.cdlCancel Then
- 'If this were a "real" app
- 'more extensive error handling would
- 'be required
- Err.Raise Number:=Err.Number
- End If
- End If
- End Sub
- Private Sub cmdCancel_Click(Index As Integer)
- CommandLine = ""
- boolOK = False
- Me.Hide
- End Sub
- Private Sub cmdOK_Click(Index As Integer)
- CommandLine = txtCommandLine
- boolOK = True
- Me.Hide
- End Sub
-