Board index » cppbuilder » How to use TBrowseInfo in BCB
Patrick Wong
![]() CBuilder Developer |
How to use TBrowseInfo in BCB2005-08-03 02:33:17 PM cppbuilder112 Dear all, I try rewriting a sample program in Delphi to BCB. It makes use of the TBrowseInfo structure. Excerpt from original code likes: function TForm1.BrowseForFolder:string; var BrowseInfo : TBrowseInfo; PIDL : PItemIDList; SelectedPath : array[0..MAX_PATH] of Char; begin Result := ''; FillChar(BrowseInfo,SizeOf(BrowseInfo),#0); BrowseInfo.hwndOwner := Handle; BrowseInfo.pszDisplayName := @SelectedPath[0]; BrowseInfo.lpszTitle := 'Select a folder'; BrowseInfo.ulFlags := BIF_RETURNONLYFSDIRS; PIDL := SHBrowseForFolder(BrowseInfo); if Assigned(PIDL) then if SHGetPathFromIDList(PIDL, SelectedPath) then Result := string(SelectedPath); end; Rewriting it into C++, void __fastcall TForm1::BrowseForFolder(String str) { TBrowseInfo *pBrowseInfo; PItemIDList PIDL; char SelectedPath[MAX_PATH]; String Result = ""; pBrowseInfo = new TBrowseInfo(NULL); memset(pBrowseInfo, sizeof(*pBrowseInfo), 0x00); pBrowseInfo->hwndOwner = Handle; pBrowseInfo->pszDisplayName = &SelectedPath[0]; pBrowseInfo->lpszTitle = "Select a folder"; pBrowseInfo->ulFlags = BIF_RETURNONLYFSDIRS; : : } Cannot get it be compiled. BCB complaints that: E2450 Undefined structure '_browseinfoA' I find _browseinfoA is declared in shlobj.hpp and I did include this header file. Whatelse I have to do to get it compiled? Thanks for kind advice, Patrick |