Whenever I try to use FF_BrowseForFolder I get the attached error message. Any suggestions?
I have succeeded in using Jose Roca's AfxShellBrowseForFolder but I would like to know why the Firefly function does not work. Jose's function works but it does not let me set an existing folder as the starting point for the browse without limiting my ability to browse to a higher level then the starting point. Not sure if the Firefly function would be any better but I cannot try it.
Hi Dick,
I created a simple project that called FF_BrowseForFolder and it worked with no error message.
Are you manually including the #INCLUDE "shlobj.inc" file somewhere in your FireFly project (FF_APPSTART?). That would cause the error message to display.
As you can see from the code below, FireFly outputs certain code whenever FF_BrowseForFolder is used (this is located in the CODEGEN*_MAIN.BAS file). It conflicts with variables in Jose's shlobj.inc file. The reason I couldn't just include the "shlobj.inc" file was because of incompatibilities with Windows 2000 (yes, a few customers still use Win2K). :)
' Include the following code if Jose's includes are used and
' the FF_BrowseForFolder is referenced. We need to do this rather
' than simply include the shlobj.inc file because including that
' file causes a missing function in DLL error in Windows 2000.
%BFFM_INITIALIZED = 1
%BFFM_SELCHANGED = 2
%BFFM_ENABLEOK = %WM_USER + 101
%BFFM_SETSELECTION = %WM_USER + 102
%CSIDL_PERSONAL = &H0005& ' My Documents
Type SHITEMID
cb As Word ' USHORT cb
abID (0) As Byte ' BYTE abID[ 1 ]
End Type
Type ITEMIDLIST
mkid As SHITEMID ' SHITEMID mkid
End Type
Type BROWSEINFO
hWndOwner As Dword ' HWND hwndOwner
pIDLRoot As ITEMIDLIST Ptr ' LPCITEMIDLIST pidlRoot
pszDisplayName As Asciiz Ptr ' LPSTR pszDisplayName // Return display name of item selected.
lpszTitle As Asciiz Ptr ' LPCSTR lpszTitle // text to go in the banner over the tree.
ulFlags As Dword ' UINT ulFlags // Flags that control the return stuff
lpfnCallback As Dword ' BFFCALLBACK lpfn
lParam As Long ' LPARAM lParam // extra info that's passed back in callbacks
iImage As Long ' int iImage // output var: where to return the Image index.
End Type
Declare Function SHBrowseForFolder Lib "SHELL32.DLL" Alias "SHBrowseForFolderA" ( _
ByRef lpbi As BROWSEINFO _ ' __in_out LPBROWSEINFO lpbi
) As Dword
Declare Function SHGetPathFromIDList Lib "SHELL32.DLL" Alias "SHGetPathFromIDListA" ( _
ByVal pidl As Dword _ ' __in PCIDLIST_ABSOLUTE pidl
, ByRef pszPath As Asciiz _ ' __out LPSTR pszPath
) As Long