Thread: SHBrowseForFolder

  1. #1
    ResurgentBarbecue UnclePunker's Avatar
    Join Date
    May 2002
    Posts
    128

    SHBrowseForFolder

    Hi I need to get the path of a folder for a program I am writing, I have to be honest I am winging it a bit sort of understood the SHBrowseForFolder class so far, and managed to get one open and get the return value, now I just need to know how to handle the return value, the item id string it returns means nothing to me any help would be greatly appreciated, thanks, here is my code.

    Code:
    	int i = 0;
    	char temp[MAX_PATH];
    	memset(temp, '\0', sizeof(temp));
    
    	BROWSEINFO dlgbox;
    	ITEMIDLIST *retdir;
    
    	dlgbox.hwndOwner = NULL;
    	dlgbox.pidlRoot = NULL;
    	dlgbox.pszDisplayName = temp;
    	dlgbox.lpszTitle = "Select Report Dir";
    	dlgbox.ulFlags = BIF_EDITBOX;
    	dlgbox.lpfn = NULL;
    
    	retdir = SHBrowseForFolder(&dlgbox);
    Just to clarify I understand what it returns but the abID member item id list is what I need to handle and I don't understand how it translates to a folder path.
    Last edited by UnclePunker; 04-15-2005 at 04:48 AM.
    Compiler == Visual C++ 6.0
    "Come Out Fighting."

  2. #2
    ResurgentBarbecue UnclePunker's Avatar
    Join Date
    May 2002
    Posts
    128
    Sorry people I had been browsing my MSDN disc for ages and not found the answer, I browsed MSDN on the internet and found it almost instantly.

    basically the answer for me is use a function called

    SHGetPathFromIDList(ITEMIDLIST, char (must be MAX_PATH in size))

    Pass it your item id list and a character array and it translates the jibberish to a path.
    Compiler == Visual C++ 6.0
    "Come Out Fighting."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SHBrowseForFolder() -- A better way?
    By Kennedy in forum Windows Programming
    Replies: 18
    Last Post: 09-21-2006, 10:25 AM
  2. Default directory for SHBrowseForFolder
    By PJYelton in forum Windows Programming
    Replies: 2
    Last Post: 04-10-2005, 08:49 PM
  3. multiple selection folder chooser
    By Corrington_j in forum Windows Programming
    Replies: 4
    Last Post: 02-09-2005, 10:38 PM
  4. Help setting SHBrowseForFolder(...) root please
    By cDir in forum Windows Programming
    Replies: 3
    Last Post: 02-07-2002, 03:49 PM