Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Const SW_SHOWDEFAULT = 10
Const SW_SHOWMAXIMIZED = 3
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWNORMAL = 1
Private Sub cboPattern_Click()
If cboPattern.ListIndex = -1 Then Exit Sub
File1.Pattern = cboPattern.Text
File1.Refresh
End Sub
Private Sub cmdDemo_Click()
Dim Tmp As String
Dim RTN As Long
If txtName = "" Then
MsgBox "오픈시킬 화일명을 선택하세요.", vbInformation
End If
'지정한 파일을 연결된 프로그램으로 실행시키는 예제
Tmp = File1.Path & "\" & File1.FileName
RTN = ShellExecute(Me.hwnd, "Open", Tmp, vbNullString, vbNullString, SW_SHOWDEFAULT)
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
File1.Pattern = cboPattern.Text
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_Click()
txtName = File1.FileName
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
cboPattern.AddItem "*.txt"
cboPattern.AddItem "*.xls"
cboPattern.AddItem "*.doc"
cboPattern.AddItem "*.hwp"
cboPattern.AddItem "*.*"
cboPattern.ListIndex = 0
End Sub