Solved

Convert a path string into a ITEMIDLIST structure

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

627 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