Thread: Help setting SHBrowseForFolder(...) root please

  1. #1

    Help setting SHBrowseForFolder(...) root please

    I am using SHBrowseForFolder(...) to have the user select a folder. As you know, this function takes as an argument to configure it, a BROWSEINFO structure. I need to set as the root path, the current working directory. The field of the BROWSEINFO structure that specifies the root path requires an ITEMIDLIST containing the path. I can get the current working directory as a null-terminated string using GetCurrentDirectory(...):

    What I need to find:
    - some way to create an ITEMIDLIST from a null-terminated string containing a path


    - some way to directly create an ITEMIDLIST of the current working directory

    I can not find either. There is a function SHGetPathFromIDList to extract the path from an ITEMIDLIST and put it into a buffer as a null-terminated string, but I can not find a function similiar to go in the opposite direction.

    I would appreciate any suggestions. Surely there must be a simple means of doing such a common seeming task?


  2. #2
    Join Date
    Jan 2002
    Interesting and well made point...

    So one Google search on ITEMIDLIST (first in list):

    Haven't tried it but it looks more than plausible. Could you let me know if it works for you (otherwise I might feel compelled to try it out myself).

    As an aside, maybe ms could have chosen a better name than
    ****EMID for the ITEMIDLIST member - although, on rare occasions, i've been caught in that very situation when the phone or doorbell rings.

    edit: it would appear that the profanity rules of this forum are in complete agreement.
    Last edited by Ken Fitlike; 02-07-2002 at 12:55 AM.

  3. #3
    It does work, yes.

    Rather embarrassing not thinking to check Google before I posted, it is. It hadn't crossed my mind; sorry.

    Thank you.

  4. #4
    Join Date
    Jan 2002
    >>It does work, yes.


    >>Rather embarrassing not thinking to check Google before I posted<<

    Don't. I went to msdn first and found exactly what you had described: zero info. If you hadn't posted then someone else like me may well have asked the same question.

    And anyway, I got to write the correct name of win structure and watch as this site's profanity filters removed half of it! I'm easily amused...

    ****EMID - see, it did it again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pointer confusion
    By Blackroot in forum C++ Programming
    Replies: 11
    Last Post: 09-12-2007, 12:44 AM
  2. Really basic string operation
    By bobthebullet990 in forum C Programming
    Replies: 6
    Last Post: 11-28-2005, 05:18 PM
  3. Bisection Method function value at root incorrect
    By mr_glass in forum C Programming
    Replies: 3
    Last Post: 11-10-2005, 09:10 AM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. Templated Binary Tree... dear god...
    By Nakeerb in forum C++ Programming
    Replies: 15
    Last Post: 01-17-2003, 02:24 AM