Solved

Convert a path string into a ITEMIDLIST structure

Posted on 1997-01-31
1
578 Views
Last Modified: 2013-11-20
I want to select a directory or folder using the function
SHGetPathFromIDList. As you know it is possible to set a root directory in the BROWSEINFO structure. The pidlRoot element of the BROWSEINFO takes a pointer to a ITEMIDLIST, so I want to convert an existing 0-terminated string eg. "C:\DIR1" into an ITEMIDLIST.
0
Comment
Question by:MehrLutz
1 Comment
 
LVL 1

Accepted Solution

by:
serge010697 earned 100 total points
ID: 1300204
You can use the following code (for UNICODE
version you have to exclude MultiByteToWideChar API
call):

IShellFolder* pDesktop;
if (::SHGetDesktopFolder(&pDesktop) == NOERROR)
{
LPITEMIDLIST pIDLParent;
WCHAR szWPath[_MAX_PATH];
ULONG lEaten, lAttr;

if (MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, "C:\DIR1", -1, szWPath, _MAX_PATH) && 
pDesktop->ParseDisplayName(NULL, NULL, szWPath, &lEaten, &pIDL, &lAttr) == NOERROR)
{
...
BROWSEINFO.pidlRoot = pIDLParent;
...
BrowseForFolder(..);
...
}
pDesktop->Release();

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Different colored text in ComboBox without Subclassing 8 66
Separate files macro - Errors on larger data set 18 73
matchUp  challenge 9 115
Change to event 1 118
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question