Q:
I would like to add some menu items to the Help menu on the AutoCAD window title bar. Is there a way to do this?
A:
There are two ways to do this:
1) Through the registry on a per profile basis:
You can add a registry key for each of your menu item under the "Help Button" AutoCAD registry key and then populate them with information similar to the example below. The "Help Button" Key will not exist by default so you may need to add it. All of the entries are strings. (With regedit use New > "String Value")
[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.0\ACAD-8001:409\Profiles\<<Unnamed Profile>>\Help Button\MyHelp]
"Text"="Test Help"
"InsertBefore"="AcHelpAbout"
"Command"="_LINE"
"Separator"="After"
Note: "Command" is interpreted as a Help Topic, not an actual AutoCAD "command", so "_LINE" will not start the line command, but will display the LINE help topic instead. You can use acedSetFunHelp() to associate the topic with a specific help file if you wish.
"InsertBefore" requires the id of the menu item that should follow your item. E.g. it is "AcHelpAbout" for "ABOUT".
2) Programmatically, using the Ribbon Runtime API
public class MyCommandHandler : System.Windows.Input.ICommand
{
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
public void Execute(object parameter)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
ed.WriteMessage("\nMy Help Item got clicked!");
}
}
[CommandMethod("AddMyHelpMenuItem")]
static public void AddMyHelpMenuItem()
{
RibbonMenuItem helpItem = new Autodesk.Windows.RibbonMenuItem();
helpItem.Text = "My Help Item";
helpItem.CommandHandler = new MyCommandHandler();
RibbonMenuButton helpButton = ComponentManager.HelpButton;
helpButton.Items.Insert(0, helpItem);
}
