Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Sat Apr 19, 2008 6:20 am Post subject: HOWTO : Insert menu items at a non-default position in the contextmenu using a context menu extension |
|
|
By default, the CShellMenu.AddItem method adds menu items at a position specified by Windows. This position is stored in the startIndex member of the CGetMenuitemsEventArgs instance which is passed to the OnGetMenuItems function.
To add a menu item at another position, use CShellMenu.InsertItem method instead. The last parameter of this function specifies the 0-based position where the menu item will be inserted
void CContextMenuExtension1::OnGetMenuItems(CGetMenuitemsEventArgs& e)
{
e.menu->InsertItem(_T("Menu item A"), _T("menuitemA"), _T("Menu Item A"), 13);
//The last parameter specifies the 0-based position of the menu item in the context menu
} |
|