06210258.txt 21-Jun-00 CAVO 2.0 and DLL Pavel, > "StandardFolderDialog" function: _DLL FUNCTION SHBrowseForFolder( ; LPBrowseInfo AS _WINBrowseInfo ); AS PTR PASCAL:SHELL32.SHBrowseForFolder > I have been trying to use this function and haven't got it working satisfactorily. I had to create the _winBrowseInfo structure myself as I couldn't find it in CAVO 2 (is this right or am I blind?) I could get it to return the name of the directory but how do I get it to return the entire path of that directory? Has it got something to do with the ItemIDList structure? Here is the code I have used: METHOD PushButton1( ) CLASS GetFolder LOCAL struBIF IS _WINBROWSEINFO LOCAL pszName AS PSZ LOCAL iIndex := 0 AS INT LOCAL struIID AS _winItemIDList pszName := MemAlloc(MAX_PATH) struIID := MemAlloc(_SizeOf(_winItemIDList)) struBIF.hWndOwner := SELF:Handle() //struBIF.pidlRoot := NULL struBIF.pidlRoot := struIID struBIF.pszDisplayName := pszName struBIF.lpszTitle := PSZ("Select Some Folder") struBIF.ulFlags := 0 struBIF.lpfn := NULL struBIF.lParam := 0 struBIF.iImage := iIndex struIID := SHBrowseForFolder(@struBIF) //This returns only the name of the directory, // not the parent directories SELF:oDCSingleLineEdit1:CurrentText := Psz2String(pszName) //InfoMsg(Psz2String(struIID.mkid)) MemFree(pszName) MemFree(struIID) RETURN TIA David Hi David, the code I posted was just example for calling DLL function. It was not complete. You were not blind - _winBrowseInfo structure is not prototyped in CAVO20. Below is my code I used. As you see - almost everything are prototypes, there is just little method BrowseFolders written in VO - so almost no overhead. The code (nothing need to be changed, just copy it ): ----------------- STRUCTURE _WINBrowseInfo MEMBER hwndOwner AS PTR MEMBER pidlRoot AS PTR MEMBER pszDisplayName AS PSZ MEMBER lpszTitle AS PSZ MEMBER ulFlags AS DWORD MEMBER lpfn AS PTR MEMBER lParam AS DWORD MEMBER iImage AS DWORD _DLL FUNCTION SHBrowseForFolder( ; LPBrowseInfo AS _WINBrowseInfo ); AS PTR PASCAL:SHELL32.SHBrowseForFolder _DLL FUNCTION SHGetMalloc( ppMalloc AS PTR ); AS DWORD PASCAL:SHELL32.SHGetMalloc _DLL FUNCTION SHGetPathFromIDList(pidl AS PTR, ; pszPath AS PSZ) AS LOGIC ; PASCAL:SHELL32.SHGetPathFromIDList METHOD BrowseFolders(cNadpis) CLASS Window LOCAL sStruct IS _WINBrowseInfo LOCAL sItem AS PTR, pszDir AS PSZ, cDirName AS STRING sStruct.hwndOwner := SELF:Handle() sStruct.pidlRoot := NULL sStruct.pszDisplayName := String2Psz(Space(40)) sStruct.lPszTitle := String2Psz( cNadpis ) sItem:=SHBrowseForFolder( @sStruct ) PszDir:=String2Psz(Space(50)) SHGetPathFromIdList(sItem, PszDir) cDirName:=Psz2String(PszDir) IF cDirName<>NULL_STRING IF Right( cDirName, 1)<>"\" cDirName+="\" ENDIF ENDIF RETURN cDirName ----------------- Usage example: --- METHOD SelectFolder CLASS MyWindow LOCAL cFullPath AS STRING cFullPath:=SELF:BrowseFolders("Select something") --- Bu as I said, this was necessary only in CAVO20. Version 2.5 has this built-in. HTH -- Greetings from Pavel Vetesnik,