Sorry, My mistake.
That code example is taken from an application I wrote some time ago and is actually the body of a function. The complete function looks like this:
BOOL CMyDialog::BrowseForFolder(char *szTitle, HWND hwndOwner, char *szResult)
{
BROWSEINFO bi;
memset((LPVOID)&bi, 0, sizeof(bi));
TCHAR szDisplayName[_MAX_PATH+1];
szDisplayName[0] = '\0';
bi.hwndOwner = hwndOwner;
bi.pidlRoot = NULL;
bi.pszDisplayName = szDisplayName;
bi.lpszTitle = szTitle;
bi.ulFlags = BIF_RETURNONLYFSDIRS;
LPITEMIDLIST pIIL = ::SHBrowseForFolder(&bi);
BOOL bRetVal = ::SHGetPathFromIDList(pIIL, szResult);
if (!bRetVal)
*szResult='\0';
LPMALLOC pMalloc;
SHGetMalloc(&pMalloc);
pMalloc->Free(pIIL);
pMalloc->Release();
return bRetVal;
}
as you can see, szResult is an output parameter of the function which is called like this:
char szOutputDir[MAX_PATH];
if(BrowseForFolder(_T("Choose file location:", GetSafeHwnd(), szOutputDir))
{
m_strLocation = szOutputDir;
UpdateData(FALSE);
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.