Quote Originally Posted by LaVolpe View Post
Updated the UnicodeBrowseFolders class

1. Added a self-contained callback function that uses JIT (just-in-time) thunk creation in order to callback to a class procedure so the class doesn't need to have an additional bas module.
- This callback is automatically invoked if you set the InitialDirectory or InitialDirectoryPIDL properties. CustomHookProc must not be set to use this default callback. You will not get any events from this callback procedure.
- This option is ignored if you set the CustomHookProc property to use your own hooks
- The CustomHookData() property is ignored if CustomHookProc is not set

2. Added 2 properties to set the startup/initial folder by either string path or PIDL (needed for virtual folders like Control Panel)
- InitialDirectory property sets the startup as a string path
- InitialDirectoryPIDL property sets the startup as a PIDL, which you are required to destroy
- Setting either of those overwrites the other

3. Added option to set the Root folder as either a string path or PIDL
- SetRootFolder requires a string path (no change)
- SetRootFolderPIDL (added) requires a PIDL, which you are required to destroy
- Setting either of those overwrites the other

4. As with the previous version, the main function ShowBrowseFolder has a parameter to prevent the class from destroying the PIDL returned by the API used to display the dialog. However, you may not know in advance whether or not you want to destroy it, but also don't want to be forced to destroy it after each call. So, modified the logic a bit.

a) If ShowBrowseFolder's optional parameter ReleasePIDL is set to False, then existing logic remains. The class will never destroy the PIDL. You are required to and the PIDL can be retrieved from the new SelectedPIDL() property. Can be destroyed with DestroyPIDL()

b) If ShowBrowseFolder's optional parameter ReleasePIDL is set to True, then existing logic was modified and works this way. The PIDL will be destroyed whenever ShowBrowseFolder is called again. However, if you decide you want the PIDL (possibly to be used for InitialDirectoryPIDL or SetRootFolderPIDL), then you can take ownership of the PIDL and the class will not destroy it. To take ownership, call SelectedPIDL(True). If the optional parameter of that property is set to True, then the class will never destroy the PIDL, but you must, at some point.

Note: SetRootFolderPIDL & InitialDirectoryPIDL will not allow you to use the PIDL returned from the previous call to ShowBrowseFolder unless you took ownership of it.

5. Some properties had their names changed to be more intuitive:
- SelectedItem changed to SelectedFolder
- PIDL_ReturnValue changed to SelectedPIDL

The best helper on this forum is back ??? where have you been man ? I asked many admins about you, no one knew where have you been hiding for years...hope you were fine during all this time