RemovePlugInMenuFromRhino doesn't work

Hello

I’m doing the following:

BOOL CPlugIn::OnLoadPlugIn()
{
	m_menu.LoadMenu(IDR_RENDERMENU);
	InsertPlugInMenuToRhinoMenu(m_menu.GetSafeHmenu(), 0);

and

void CPlugIn::OnSetCurrentRenderPlugIn(BOOL bCurrent)
{
	if(!bCurrent)
	{
		RemovePlugInMenuFromRhino(m_menu.GetSafeHmenu()); // !!!!!!! has no effect

If you read the comments for CRhinoPlugIn::InsertPlugInMenuToRhinoMenu, you will see that the method gets a submenu, from the specified menu, by index. Thus, if you want to remove it, you will have to get the handle to the submenu and pass it to CRhinoPlugIn::RemovePlugInMenuFromRhino. I’ve updated the SampleMenu project to demonstrate how to do this.