The New and Send To menu items are simple shell extensions which implement the IContextMenu(2,3)
interfaces. The CLSID of the New shell extension is {D969A300-E7FF-11d0-A93B-00A0C90F2719}
, and the CLSID of the Send To shell extension is {7BA4C740-9E81-11CF-99D3-00AA004AE837}
. So you need to implement the host for IContextMenu
interface.
Create one of the COM objects
Query it for IContextMenu
and IShellExtInit
Call IShellExtInit.Initialize()
Create a temp menu
Call IContextMenu.QueryContextMenu()
In the temp menu, you will have all of the available commands.
- To run a command call
IContextMenu.InvokeCommand()
.
A lot of details you can find in The Old New Thing blog:
How to host an IContextMenu, part 1 - Initial foray
How to host an IContextMenu, part 2 - Displaying the context menu
How to host an IContextMenu, part 3 - Invocation location
How to host an IContextMenu, part 4 - Key context
How to host an IContextMenu, part 5 - Handling menu messages
How to host an IContextMenu, part 6 - Displaying menu help
How to host an IContextMenu, part 7 - Invoking the default verb
How to host an IContextMenu, part 8 - Optimizing for the default command
How to host an IContextMenu, part 9 - Adding custom commands
How to host an IContextMenu, part 10 - Composite extensions - groundwork
How to host an IContextMenu, part 11 - Composite extensions - composition