Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SHBrowseForFolder returns wrong info when BIF_USENEWUI | BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_VALIDATE is used

23 views
Skip to first unread message

jchli...@gmail.com

unread,
Apr 14, 2014, 9:13:08 PM4/14/14
to
The following is my code. According to MSDN, when user types in some garbage string in the edit box, the OK button is supposed to be disabled. I am expecting to receive the garbage string and so I can bail out by reminding user. However, it looks like Microsoft is trying to make itself look nice: it is always returning the current selected item in the tree control. This will lead to some unwanted behavior in my application.

Is there some way to force it to disable the OK button or return the garbage string and so I can do some validation by myself? Thanks in advance.

wchar_t outPath[MAX_PATH];
BROWSEINFO bInfo;
::ZeroMemory(&bInfo, sizeof(BROWSEINFO));
bInfo.hwndOwner = parentHWND;
bInfo.pidlRoot = NULL;
bInfo.pszDisplayName = outPath;
bInfo.lpszTitle = (LPCWSTR)caption;
bInfo.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_VALIDATE;
bInfo.lpfn = NULL;
bInfo.lParam = 0;

LPITEMIDLIST lpItem = ::SHBrowseForFolder(&bInfo);

jchli...@gmail.com

unread,
Apr 14, 2014, 9:13:54 PM4/14/14
to
0 new messages