Welcome to Windows Shell Programming
The Windows Shell provides a rich set of APIs to integrate applications deeply with the Windows desktop experience. This documentation covers the core concepts, COM interfaces, extension points, and practical examples.
Key Topics
- Shell Namespace – Understanding the virtual file system.
- Shell Extensions – Adding custom UI and functionality.
- COM Interfaces – Core interfaces like IShellFolder, IContextMenu.
- Sample Code – Ready‑to‑run examples.
Quick Sample
Below is a minimal example of implementing a custom IContextMenu
handler.
#include <windows.h>
#include <shlobj.h>
class MyContextMenu : public IContextMenu {
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) { /* ... */ }
STDMETHODIMP_(ULONG) AddRef() { /* ... */ }
STDMETHODIMP_(ULONG) Release() { /* ... */ }
// IContextMenu
STDMETHODIMP GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT *pwReserved,
LPSTR pszName, UINT cchMax) { /* ... */ }
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO pici) { /* ... */ }
STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu,
UINT idCmdFirst, UINT idCmdLast,
UINT uFlags) { /* ... */ }
};