Solved

Convert a path string into a ITEMIDLIST structure

Posted on 1997-01-31
1
593 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Named range not carried over 10 71
difference between String.subString() and String.subSequence() 6 291
twoTwo  challenge 35 120
Problem to event 3 123
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 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