用下面的方法试试:
需要一个listbox(listbox1),label(label1),command数组(command1(1-5))Option ExplicitPrivate Declare Function SendMessage Lib "user32" _
   Alias "SendMessageA" _
   (ByVal hwnd As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Long, _
    lParam As Any) As LongPrivate Const LB_DIR = &H18D
Private Const LB_RESETCONTENT = &H184Private Const DDL_READWRITE = &H0
Private Const DDL_READONLY = &H1
Private Const DDL_HIDDEN = &H2
Private Const DDL_SYSTEM = &H4
Private Const DDL_DIRECTORY = &H10
Private Const DDL_ARCHIVE = &H20
Private Const DDL_DRIVES = &H4000
Private Const DDL_EXCLUSIVE = &H8000&
Private Const DDL_POSTMSGS = &H2000
Private Const DDL_FLAGS = DDL_ARCHIVE Or DDL_DIRECTORYPrivate Sub Command1_Click(Index As Integer)   Dim found As Long
   Dim DDL_FLAGS As Long
   Dim sPath As String
   
   sPath = "c:\windows\*.*"
   
   Select Case Index
      Case 0: DDL_FLAGS = DDL_EXCLUSIVE Or DDL_ARCHIVE
      Case 1: DDL_FLAGS = DDL_EXCLUSIVE Or DDL_ARCHIVE Or DDL_DIRECTORY
      Case 2: DDL_FLAGS = DDL_EXCLUSIVE Or DDL_HIDDEN
      Case 3: DDL_FLAGS = DDL_EXCLUSIVE Or DDL_SYSTEM
      Case 4: DDL_FLAGS = DDL_EXCLUSIVE Or DDL_DIRECTORY
      Case 5: DDL_FLAGS = DDL_EXCLUSIVE Or DDL_DRIVES
      Case Else
   End Select
   
  'clear and populate the listbox
   Call SendMessage(List1.hwnd, LB_RESETCONTENT, 0, ByVal 0)
   found = SendMessage(List1.hwnd, LB_DIR, DDL_FLAGS, ByVal sPath)   Label1.Caption = found + 1 & " " & Command1(Index).Caption & " found."
   
End Sub