Advertisement
2_2002-2004 VB function enhancement #120450

Folder Browser

This is a Function which displays the Browse directory dialogue and returns a path as a string. Unlike the usual shell command, this code works even on machines without the Active Desktop or IE 5 installed.

AI

Podsumowanie AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kod źródłowy
original-source
Public Function BrowseForFolder(lnghWndOwner As Long) As String
  ''Opens a Treeview control that displays the directories in a computer and Returns a String
  Dim lpIDList  As Long
  Dim sBuffer   As String
  Dim szTitle   As String
  Dim tBrowseInfo As BrowseInfo
  szTitle = "This is the title"
  With tBrowseInfo
    .hWndOwner = lnghWndOwner
    .lpszTitle = lstrcat(szTitle, "")
    .ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN
  End With
  lpIDList = SHBrowseForFolder(tBrowseInfo)
  If (lpIDList) Then
    sBuffer = Space(MAX_PATH)
    SHGetPathFromIDList lpIDList, sBuffer
    sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
  End If
  BrowseForFolder = sBuffer
End Function
Oryginalne komentarze (3)
Odzyskane z Wayback Machine