C++ programming: How does Shell Context Menu Work ? – Part 2

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

In part 1 we understood what a context menu was and how Visual studio helps to create one at the design time and runtime level on a windows form.
In this tutorial we are going touch base on some of the key aspects of Context Menu controlled and generated by the shell explorer with the help of the demo code included with this article.

You should have observed that the context menu items change wrt to the object or context on which a right click is performed. These activities are actually controlled by Windows Shell Explorer.

The Shell Explorer is also called the file manager that is shipped with every release of Windows Operating system. It provides a graphical user interface for managing files. The process that host the Shell Explorer is the explorer.exe

Here’s a list of operations Shell Explorer is responsible for

  1. Render the graphics for the taskbar and the desktop
  2. Render the graphics for windows, folders, icons, file menu’s, toolbars
  3. Render the graphics for the start menu
  4. Render the graphics to display the tree structure of your file system, which is also called the explorer
  5. It provides the search engine feature for your file system
  6. And most important and the topic of this article – the context menu

(Try this: On your computer kill the explorer.exe process. You would observe that the task bar disappears, the desktop shows no sign of any icons. Active windows on your desktop would still be visible, minimizing the same would make them disappear.

Note that following the above step will not crash or delete data from your computer. You can bring back your desktop by launching the Task Manager, goto File->New Task, and then type explorer.)

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read