(PyIDL, string displayName, iImage) = SHBrowseForFolder(hwndOwner, pidlRoot , title , flags , callback , callback_data )

Displays a dialog box that enables the user to select a shell folder.


hwndOwner=None : PyHANDLE

Parent window for the dialog box, can be None

pidlRoot=None : PyIDL

PIDL identifying the place to start browsing. Desktop is used if not specified

title=None : Unicode /string

Title to be displayed with the directory tree

flags=0 : int

Combination of shellcon.BIF_* flags

callback=None : object

A callable object to be used as the callback, or None

callback_data=None : object

An object passed to the callback function


If you provide a callback function, it should take 4 args: hwnd, msg, lp, data. Data will be whatever you passed as callback_data, and the rest are integers. See the Microsoft documentation for SHBrowseForFolder, or the shell sample for more information.

Return Value

The result is ALWAYS a tuple of 3 items. If the user cancels the dialog, all items are None. If the dialog is closed normally, the result is a tuple of (PIDL, DisplayName, iImageList)