If you want a menu that shows the contents of the My Computer folder, you already know how to do it
Commenter praful asks what to me is a rather confused question, but I’ll try to guess what the real question is.
If you drag My Computer to the Start button in XP, you get an expanding menu that lets you see all files and folders as submenus.
Is this menu available to applications via an API, or do you have to build it yourself? For example, can an application have a pop-up menu, with the My Computer menu in it?
If the My Computer menu is available as an API, is it customisable so that, for example, only folders are displayed and items can be added to the menu?
First of all, if you drag My Computer to the Start button in Windows XP, the result is that the My Computer icon shows up in the pin list as an icon. There is no expanding menu.
You do get an expanding menu if you are using the classic (non-XP) Start menu, so let’s assume that praful really asked about the classic Start menu rather than the Windows XP Start menu. But what’s so special about My Computer? You can just right-click the Start button, select Open, and then start creating folders. And those folders will show up as expanding menus on the classic Start menu.
That’s why I’m confused about this question. It’s taking a general feature and focusing on a specific case. There’s nothing special about My Computer on the Start menu. It expands like any other folder. It’s like asking, “If I create a directory on my floppy drive called
stuff, I can use the
dir command to look at its contents on the screen. Is this textual format of the contents of the
stuff directory available to applications via an API?” What’s so special about the
stuff directory on your floppy drive? This works for any directory, whether it’s on a floppy drive or a hard drive or a network drive.
Anyway, if you want a menu that shows the contents of your My Computer folder, you already know how to do it. It’s just a simple matter of typing. You use the
IShellFolder::EnumObjects method to enumerate the contents of the My Computer folder. (The linked article shows how to enumerate the contents of the desktop; enumerating the contents of the My Computer folder is left as an exercise.) Since you’re in control of the enumeration, you can decide to filter out folders, or show only folders, or show only items whose names end in a vowel. You can show them in a list view, you can show them in a menu, or you can scramble the letters and create a jumble puzzle. It’s up to you.