You know I posted this example on 10/08/2002 to this very list and David
Haycraft added some enhancements to it but here it is again(Browse for
folder using MapBasic):
-------------code-------------------------
include "mapbasic.def"
include "menu.def"
include "icons.def"
 
Define BIF_RETURNONLYFSDIRS &H1
Define MAX_PATH 260
Define CSIDL_DRIVES &H11
 
Type BrowseInfo
    hWndOwner      As Integer
    pIDLRoot       As Integer
    pszDisplayName As String
    lpszTitle      As String
    ulFlags        As Integer
    lpfnCallback   As Integer
    lParam         As Integer
    iImage         As Integer
End Type
 
 
 
Declare Function BrowseForFolder(hWndOwner As Integer, sPrompt As String) As
String 
Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Integer)
Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As
String, ByVal lpString2 As String) As Integer
Declare Function SHBrowseForFolder Lib "shell32" Alias
"SHBrowseForFolderA"(lpbi As BrowseInfo) As Integer
Declare Function SHGetPathFromIDList Lib "shell32" Alias
"SHGetPathFromIDListA" (ByVal pidList As Integer, lpBuffer As String) As
Integer
Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal
hwndOwner As Integer, ByVal nFolder As Integer, ppidl As Integer) As Integer
 
Declare Sub Main

Sub Main()
 Dim sPrompt As String
 Dim sFolder As String

 sPrompt = "Select a Folder"
 do
  sFolder = BrowseForFolder(sPrompt)
  if sFolder<>"" then
   Note "Selected Folder=["+sFolder+"]"
  end if
 loop until sFolder=""
End Sub   
 
   
Function BrowseForFolder(hWndOwner As Integer, sPrompt As String) As String
 Dim lpIDList As Integer
 Dim nResult As Integer
 Dim sPath As String
 Dim bi As BrowseInfo

 sPath = Space$(MAX_PATH)

 bi.hWndOwner = 0
 bi.pidlRoot=0
 bi.pszDisplayName = Space$(MAX_PATH)
 bi.lpszTitle = sPrompt
 bi.ulFlags = 0

 lpIDList = SHBrowseForFolder(bi)
 If lpIDList <> 0 Then
  nResult = SHGetPathFromIDList(lpIDList, sPath)
  Call CoTaskMemFree(lpIDList)
 End If

 BrowseForFolder = RTrim$(sPath)

End Function
 
----------------------------------end
code-------------------------------------
 

-----Original Message-----
From: B. Thoen
To: MapInfo-L
Sent: 11/8/2003 12:00 PM
Subject: MI-L MB: SHBrowseForFolder() Constants Definitions?

I'm exploring the Windows API function SHBrowseForFolder() for a
MapBasic
app I'm developing, but the MSDN pages describing this function don't
tell
me the actual values for the constants (BIF_RETURNONLYFSDIRS, etc.)
Anyone
know where to find this info in the MSDN library web pages?

- Bill Thoen



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 9079

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 9083

Reply via email to