CAFE

vb6 api

ShellExecute

작성자프랭크핀|작성시간09.01.30|조회수765 목록 댓글 0

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

다음검색
현재 게시글 추가 기능 열기

댓글

댓글 리스트
맨위로

카페 검색

카페 검색어 입력폼