Dear Dr. GUI,
Thanks for telling us how to browse for a folder. Browsing for a folder seems to me even more common in applications than some of the commdlg(32).dll dialog boxes. But for some reason it was never included in those dynamic-link libraries (DLLs). I am not asking why; we both probably know the answer. Anyway, I am glad that you've pointed out the SHBrowseForFolder() function.
I want to write clean code, so who can explain how to free that identifier?
Thanks,
Vadim Grabovski
Dr. GUI replies:
The good doctor is glad you've found the previous information useful. And he's delighted that you're paying close attention to the documentation. Medicine always goes better when you follow the prescription.
Call the SHGetMalloc() function to get the IMalloc interface pointer to the shell's task allocator. Once you have that pointer call IMalloc::Free() passing the LPITEMIDLIST pointer returned from SHBrowseForFolder().
The concept of a task allocator actually comes from COM/OLE and hence it helps if you are familiar with COM/OLE. The best Component Object Model (COM) book Dr. GUI has seen is Inside COM by Dale Rogerson (Microsoft Press 1996; http://mspress.microsoft.com/). Dr. GUI recommends this book for every programmer who's using COM, regardless of what language you use.
Send feedback on this article. Find support options.
© 2000 Microsoft Corporation. All rights reserved. Terms of use.