Sign in to follow this  
cood

Need SHParseDisplayName in windows 2000 (only in XPs shell32.dll) *Solved*

Recommended Posts

SHParseDisplayName only works wuth SHELL32.dll version 6, which comes with windows XP only (win 2000 is version 4 i think). I hate to make my program limited to only windows XP though, it worked fine in older OSs until I added this function. But I need this function to get my item identifier list. MSDN states "This function is the preferred method to convert a string to a pointer to an item identifier list (PIDL)".... Well, what is the non-preferred method to do this? If it works under older OSs then Ill use it. There is this IShellFolder::ParseDisplayName method that is a pure virtual method, but I dont know what I can do with that without getting some instance of an object. CODE: //MUST INITIALIZE COMPONENT OBJECT MODEL(COM) - MSDN SAYS SO CoInitialize(NULL); char folderName[MAX_PATH]; //CONVERT STRING TO WIDE CHAR STRING wchar_t s1[MAX_PATH]; LPITEMIDLIST folderID; mbstowcs(s1, textureDirectory, MAX_PATH); SHParseDisplayName(s1, NULL, &folderID, NULL, NULL); //SETUP STRUCTURE FOR FOLDER BROWSING BROWSEINFO browseFolder; browseFolder.hwndOwner = polyMenu1.getWorkWindowHandle(); browseFolder.pidlRoot = folderID; browseFolder.pszDisplayName = folderName; browseFolder.lpszTitle = "Select Texture Directory"; browseFolder.ulFlags = BIF_NONEWFOLDERBUTTON | BIF_NEWDIALOGstyle; browseFolder.lpfn = BrowseProc; //CALL BROWSE WINDOW folderID = SHBrowseForFolder(&browseFolder); if(folderID == NULL) break; //CONVERT AND SET NEW PATH SHGetPathFromIDList(folderID, folderName); polyMenu1.setTextureDirectory(folderName); objectMenu1.setTextureDirectory(folderName); //FREE MEMORY ALLOCED AND RETURNED BY SHBrowseForFolder() LPMALLOC freePtr; SHGetMalloc(&freePtr); freePtr->Free(folderID); Any help to get this working under other OSs would be great. Thanks a bunch. [Edited by - cood on February 7, 2005 8:20:44 PM]

Share this post


Link to post
Share on other sites
IShellFolder::ParseDisplayName may be what you want.

If so typicaly you Use SHGetDesktopFolder then use that to obtain the methord described above. MSDN doesnt say which version is required though. Its just a guess.

Share this post


Link to post
Share on other sites
wow, thats all I had to do...

IShellFolder *shellFolder;
SHGetDesktopFolder(&shellFolder);
shellFolder->ParseDisplayName(NULL, NULL, s1, NULL, &folderID, NULL);


I looked at all these Shell functions and didnt even think about that one... heh. Thanks a bunch for the help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this