CodeItBetter Programming Another VB Programming Blog

How to Launch Windows Explorer with Specific Directory

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'System & API - How to Launch Windows Explorer with Specific Directory

Option Explicit
 
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
Public Const SW_SHOWNORMAL = 1
 
Public Sub OpenExplorer(Optional InitialDirectory As String)
    ShellExecute 0, "Explore", InitialDirectory, vbNullString, vbNullString, SW_SHOWNORMAL
End Sub
 
Private Sub Form_Load()
    Call OpenExplorer("C:\Program Files\")
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.