to create a browse button to display path of file using mfc dialog box
-
plz can any one help me in creating a dialog box with browse button to display path of the files in mfc i,e vc++
-
plz can any one help me in creating a dialog box with browse button to display path of the files in mfc i,e vc++
shiva shankar wrote: plz can any one help me in creating a dialog box with browse button to display path of the files in mfc i,e vc++ LPMALLOC pMalloc; /* Gets the Shell's default allocator */ if (::SHGetMalloc(&pMalloc) == NOERROR) { BROWSEINFO bi; char pszBuffer[MAX_PATH]; LPITEMIDLIST pidl; // Get help on BROWSEINFO struct - it's got all the bit settings. bi.hwndOwner = GetSafeHwnd(); bi.pidlRoot = NULL; bi.pszDisplayName = pszBuffer; bi.lpszTitle = _T("Select a Starting Directory"); bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; bi.lpfn = NULL; bi.lParam = 0; // This next call issues the dialog box. if ((pidl = ::SHBrowseForFolder(&bi)) != NULL) { if (::SHGetPathFromIDList(pidl, pszBuffer)) { // At this point pszBuffer contains the selected path */. DoingSomethingUseful(pszBuffer); } // Free the PIDL allocated by SHBrowseForFolder. pMalloc->Free(pidl); } // Release the shell's allocator. pMalloc->Release(); }
It's not a bug, it's an undocumented feature.
suhredayan@omniquad.commessenger :suhredayan@hotmail.com