vbpslogo2.gif (19593 bytes)
Brad's VB-32 Programs & Samples

Posted: 08/07/97, last update: 08/07/97

Home

IShellFolder: The SDK example "Using PIDLs and Display Names" ported to VB5

Well it had to happen, a VB5 example.

VB5 offers some new and quite interesting features, one of which is the ability to implement system interfaces through type libraries. System interfaces are inherently difficult to code in their native language C (C++), which makes them that much more of a challenge to implement in VB.

This example is probably as simple a implementation of IShellFolder as you will find. It is the SDK example written in C "Using PIDLs and Display Names" ported as accurately as possible to VB code. It relies on a type library (ODL source included) that exposes the methods of the interfaces IShellFolder, the memory allocator IMalloc, and for completeness, IShellFolder's child interface IEnumIDList.

The example retrieves the pidl (pointer to an item id list) for the Programs folder, binds to the desktop folder by retrieving it's IShellFolder interface, implements the both IShellFolder GetDisplayNameOf and BindToObject member functions to walk through the Programs folder pidl, and does nothing more than print the displayname of each item ID in the Programs folder id list to the Immediate window.

Note: If the directory structure in the zip file is decompressed, the project should find and load the ISHF_Ex.tlb file which it uses, eliminating the need for adding it manually as a reference via the References dialog.

Download ishellex.zip (18kb)