How do I call the choose folder dialog
-
I´m trying to show the Folder dialog. Does any body knows where can I get a sample ATL/WTL project with this.
SHBrowseForFolder()
is the API. There are wrapper classes here on CP (but I haven't looked to see which ones use ATL.) --Mike-- Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm -
SHBrowseForFolder()
is the API. There are wrapper classes here on CP (but I haven't looked to see which ones use ATL.) --Mike-- Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_HelmYes, I have the following Function wich calls the BROWSEINFO API, but when I run this on Win98 I get an exception, but on winME everything works OK. Can somebody help me solve this problem.:confused: BOOL folderDialog(const HWND parent, const char *topic, char *result, const bool allowNew, const int extraFlags) { // CoInitialize must be called to support BIF_USENEWUI. OleInitialize(NULL); LPMALLOC pMalloc = NULL; LPITEMIDLIST pidl = NULL; BROWSEINFO bi; ZeroMemory(&bi, sizeof(BROWSEINFO)); // set the bi's default values bi.hwndOwner = parent; bi.lpszTitle = topic; bi.ulFlags = BIF_STATUSTEXT | extraFlags; if (!allowNew) { bi.ulFlags = bi.ulFlags; } pidl = SHBrowseForFolder(&bi); if(pidl != NULL) { SHGetPathFromIDList(pidl, result); // free memory if (FAILED(SHGetMalloc(&pMalloc))) { throw "SHGetMalloc Failed!"; } pMalloc->Free(pidl); pMalloc->Release(); OleUninitialize(); return (BOOL)strlen(result); } OleUninitialize(); return FALSE; }
-
Yes, I have the following Function wich calls the BROWSEINFO API, but when I run this on Win98 I get an exception, but on winME everything works OK. Can somebody help me solve this problem.:confused: BOOL folderDialog(const HWND parent, const char *topic, char *result, const bool allowNew, const int extraFlags) { // CoInitialize must be called to support BIF_USENEWUI. OleInitialize(NULL); LPMALLOC pMalloc = NULL; LPITEMIDLIST pidl = NULL; BROWSEINFO bi; ZeroMemory(&bi, sizeof(BROWSEINFO)); // set the bi's default values bi.hwndOwner = parent; bi.lpszTitle = topic; bi.ulFlags = BIF_STATUSTEXT | extraFlags; if (!allowNew) { bi.ulFlags = bi.ulFlags; } pidl = SHBrowseForFolder(&bi); if(pidl != NULL) { SHGetPathFromIDList(pidl, result); // free memory if (FAILED(SHGetMalloc(&pMalloc))) { throw "SHGetMalloc Failed!"; } pMalloc->Free(pidl); pMalloc->Release(); OleUninitialize(); return (BOOL)strlen(result); } OleUninitialize(); return FALSE; }
Check the MSDN. One or more of the functions you are calling may not be implemented by the Win98 shell. Gary R. Wheeler