BCX Console Demonstration Program s126.bas |
'------------------------------------------------- ' BrowseFolder -- Original by Jacob Navia ' Converted to BCX version by Kevin Diggins '------------------------------------------------- DIM Folder1$ IF BrowseDir("Choose a directory", Folder1$) THEN PRINT "Chosen Folder: ", Folder1$ ELSE PRINT "Action Cancelled" END IF FUNCTION BrowseDir(Title$, Result$) '--------------------------------------- LOCAL pMalloc AS LPMALLOC LOCAL browseInfo AS BROWSEINFO LOCAL lpItemIDList AS LPITEMIDLIST LOCAL Rc '--------------------------------------- IF S_OK <> SHGetMalloc(&pMalloc) THEN EXIT FUNCTION memset(&browseInfo, 0, SIZEOF(BROWSEINFO)) browseInfo.hwndOwner = GetActiveWindow() browseInfo.pszDisplayName = Result$ browseInfo.lpszTitle = Title$ browseInfo.ulFlags = BIF_NEWDIALOGSTYLE lpItemIDList = SHBrowseForFolder(&browseInfo) IF lpItemIDList <> NULL THEN Result$ = "" IF SHGetPathFromIDList(lpItemIDList, Result$) THEN IF LEN(Result$) > 0 THEN Rc = 1 END IF pMalloc->lpVtbl->Free( pMalloc, lpItemIDList ) END IF pMalloc->lpVtbl->Release(pMalloc) ' BCX is amazing ! FUNCTION = Rc END FUNCTION
Result:
Result not displayed for this example.