public void EnumerateMenuControls(DTE_Output InOutput) { CommandBarControls controls = mBar.Controls; foreach (CommandBarControl control in controls) { Microsoft.VisualStudio.CommandBars.MsoControlType msoType = control.Type; InOutput.WriteLine( "Control Caption: " + control.Caption + " type: " + msoType.ToString() + " Enabled: " + control.Enabled.ToString()); InOutput.WriteLine(" DescriptionText: " + control.DescriptionText); InOutput.WriteLine(" TooltipText: " + control.TooltipText); InOutput.WriteLine( " Index: " + control.Index.ToString() + " Id: " + control.Id.ToString()); Command cmd = mMain.Commandsx.Item(control.Id, -1); string cmdName = cmd.Name; if (control.Type == MsoControlType.msoControlButton) { CommandBarButton but = (CommandBarButton)control; DTE_Button dbut = new DTE_Button(mMain, control); InOutput.WriteLine(" " + dbut.Command.Name + " guid: " + dbut.CommandGuid + " LocalizedName:" + dbut.Command.command.LocalizedName); DTE_Addin addin = mMain.FindAddinByGuid(dbut.CommandGuid); if (addin != null) { InOutput.WriteLine(" addin progid:" + addin.ProgId); } } } }
public DTE_Button FindButtonControl(ButtonText InText) { DTE_Button found = null; CommandBarControl control = FindControl(InText.Text); if ((control != null) && (control.Type == MsoControlType.msoControlButton)) { found = new DTE_Button(mMain, control); } return(found); }
public void RemoveButtonControl(ButtonText InText) { DTE_Button button = FindButtonControl(InText); if (button == null) { throw new ArgumentException( "Remove failed. ButtonControl " + InText.Text + " is not found"); } RemoveButtonControl(button); }
public void RemoveButtonControl(DTE_Button InButton) { object temp = null; InButton.Control.Delete(temp); }