Solved

Convert a path string into a ITEMIDLIST structure

Posted on 1997-01-31
1
555 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bigDiff challenge 17 75
haveThree challenge 22 103
wordmultiple challenge 12 93
Making an alias 7 54
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now