Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Convert a path string into a ITEMIDLIST structure

Posted on 1997-01-31
1
Medium Priority
?
637 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 200 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

Technology Partners: 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

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

670 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