BrowseFolders Dialog on Win2k/IE5?
-
Hello, I've got a class to browse folders similiar to CSXBrowseFolder here on code-project. It worked fine until I needed to run my software on a fresh installed Windows 2000 with IE5. Selecting e.g. "My Documents" gives me not the real path but an Id like "::{xxxxxxxxx}". I'm not sure if I'm right, but I think I need to resolve this "link" using the shell functions. But whatever I tried it didn't work. If I select a usual folder (e.g. c:\test) it works like expected. I found a message on MSDN, that win2k/ie5 doesn't follow these links. But newer versions do so. Seems I get the Id of the not real existing folder, while IE6 resolves these links automatically. Maybe someone can give me hint how to solve this problem? Thanks in advance! Ingmar
-
Hello, I've got a class to browse folders similiar to CSXBrowseFolder here on code-project. It worked fine until I needed to run my software on a fresh installed Windows 2000 with IE5. Selecting e.g. "My Documents" gives me not the real path but an Id like "::{xxxxxxxxx}". I'm not sure if I'm right, but I think I need to resolve this "link" using the shell functions. But whatever I tried it didn't work. If I select a usual folder (e.g. c:\test) it works like expected. I found a message on MSDN, that win2k/ie5 doesn't follow these links. But newer versions do so. Seems I get the Id of the not real existing folder, while IE6 resolves these links automatically. Maybe someone can give me hint how to solve this problem? Thanks in advance! Ingmar
You can convert the file object's display name into a path with the following:
/// <summary>
/// Sample that converts a textual file/folder object display name
/// (::{GUID} format) to a physical path (if possible)
/// </summary>
/// <author> Peter A. Ritchie</author>
/// <date type="creation">26-Apr-2005</date>
CComPtr<IShellFolder> pshf = NULL**;**::SHGetDesktopFolder**(&pshf)****;**
LPITEMIDLIST pidlDocFiles**;**
ULONG cbEaten**;**
pshf->ParseDisplayName**(NULL,**NULL**,** L"::{450d8fba-ad25-11d0-98a8-0800361b1103}"**,** &cbEaten**,** &pidlDocFiles**,** NULL**)****;**
TCHAR szPath**[MAX_PATH]** = _T**("")****;**
::SHGetPathFromIDList**(pidlDocFiles,** szPath**)****;**
But, I'm curious, how are you getting the display name "::{GUID}"? Are you using SHBrowseForFolder? If so, what are you doing with the PIDL? PeterRitchie.com
-
You can convert the file object's display name into a path with the following:
/// <summary>
/// Sample that converts a textual file/folder object display name
/// (::{GUID} format) to a physical path (if possible)
/// </summary>
/// <author> Peter A. Ritchie</author>
/// <date type="creation">26-Apr-2005</date>
CComPtr<IShellFolder> pshf = NULL**;**::SHGetDesktopFolder**(&pshf)****;**
LPITEMIDLIST pidlDocFiles**;**
ULONG cbEaten**;**
pshf->ParseDisplayName**(NULL,**NULL**,** L"::{450d8fba-ad25-11d0-98a8-0800361b1103}"**,** &cbEaten**,** &pidlDocFiles**,** NULL**)****;**
TCHAR szPath**[MAX_PATH]** = _T**("")****;**
::SHGetPathFromIDList**(pidlDocFiles,** szPath**)****;**
But, I'm curious, how are you getting the display name "::{GUID}"? Are you using SHBrowseForFolder? If so, what are you doing with the PIDL? PeterRitchie.com
Thanks for the help. I tried it out, but if gives me the same GUID back again I put in?! For your question, I use
itemIDList = SHBrowseForFolder(&browseInfo);
...do some checks and thenSHGetPathFromIDList(itemIDList, szPathBuffer);
And at this point I've got that GUID in szPathBuffer. I found so many samples, everyone does it that way, but I already tested on 2 win2k machines and it doesn't work. (Except I update to IE6, but this is currently not an option). Maybe something is wrong with my browseinfo structure? I did nothing special, maybe some flags are needed I didn't set? Ingmar -
Thanks for the help. I tried it out, but if gives me the same GUID back again I put in?! For your question, I use
itemIDList = SHBrowseForFolder(&browseInfo);
...do some checks and thenSHGetPathFromIDList(itemIDList, szPathBuffer);
And at this point I've got that GUID in szPathBuffer. I found so many samples, everyone does it that way, but I already tested on 2 win2k machines and it doesn't work. (Except I update to IE6, but this is currently not an option). Maybe something is wrong with my browseinfo structure? I did nothing special, maybe some flags are needed I didn't set? IngmarThen you've got a GUID to a virtual folder that does not have a physical location for it. PeterRitchie.com
-
Then you've got a GUID to a virtual folder that does not have a physical location for it. PeterRitchie.com
I tested some things, and it seems the problem isn't SHBrowseForFolder itself. But it's more strange: A simple BrowseForFolder-application works well on 2k, but my real application doesn't! I did try and error and I found out, that I get a good path, when I run SHBroswForFolder before I open a database via ODBC (CDatabase) ?!?! Don't have a good idea now, but it has definitly to do with the DB-Open. Maybe it's a bug? This works great on XP or better on any machine with IE>5. Ingmar