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

SHBrowseForFolder fails in Windows Vista

10 views
Skip to first unread message

devi.la...@gmail.com

unread,
Dec 12, 2006, 10:34:25 PM12/12/06
to
Hi,

The SHBrowseForFolder() function with BROWSEFORPRINTER flag
returns NULL in Vista.

The following is the code snippet.
============================================

char pszDisplayName[MAX_PATH];
LPITEMIDLIST lpID;
BROWSEINFOA bi;
LPITEMIDLIST pIdl_NW = NULL;
SHGetSpecialFolderLocation(NULL, CSIDL_NETWORK, &pIdl_NW);
bi.hwndOwner = hwndOwner;
bi.pidlRoot = pIdl_NW;
bi.pszDisplayName = pszDisplayName;
bi.lpszTitle = lpszTitle;
bi.ulFlags = BIF_BROWSEFORPRINTER ;
bi.lpfn = BrowseCallbackProc;
bi.iImage = NULL;
HRESULT hres = CoInitialize(NULL);
lpID = SHBrowseForFolderA(&bi);
============================================

Here IpID is NULL in Vista.

Can anyone tell me what is wrong in teh above snippet which has impact
in Vista????

Thanks in Advance
Lucky

tim.j....@gmail.com

unread,
Dec 13, 2006, 12:21:47 PM12/13/06
to
devi.la...@gmail.com wrote:

> The SHBrowseForFolder() function with BROWSEFORPRINTER flag
> returns NULL in Vista.

What does GetLastError() return after SHBrowseForFolder() fails?

jus...@zeusedit.com

unread,
Dec 13, 2006, 5:01:25 PM12/13/06
to
devi.la...@gmail.com wrote:

> The SHBrowseForFolder() function with BROWSEFORPRINTER flag
> returns NULL in Vista.

I would try adding a call to ZeroMemory for the BROWSEINFOA bi
structure.

Jussi Jumppanen
Zeus for Windows - "The ultimate programmer's editor/IDE"
http://www.zeusedit.com

devi.la...@gmail.com

unread,
Dec 20, 2006, 6:32:33 AM12/20/06
to

After SHBrowseForFolder gets an error code value as 1400 which
correspond to "Invalid window handle".

Thanks in Advance
Lucky

0 new messages