Option Explicit
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
Private Declare Function GetWindowsDirectory Lib "kernel32" _
Alias "GetWindowsDirectoryA" (ByVal lpBuffer As _
String, ByVal nSize As Long) As Long
Const SW_RESTORE As Long = &H9&
Private Sub Form_Load()
Dim Win$, Result&
Win = Space(256)
Result = GetWindowsDirectory(Win, Len(Win))
Text1.Text = Left$(Win, Result)
End Sub
Private Sub Command1_Click()
Call OpenExplorer(CStr(Text1.Text))
End Sub
Private Sub OpenExplorer(ByVal Path$)
Path = Left$(Path, Len(Path) - Len(Right$(Path, _
Len(Dir(Path)))))
Call ShellExecute(Me.hwnd, "explore", Path, 0, 0, SW_RESTORE)
End Sub
hoff damit gehts
