Using the DTE, you can customize the UI and user interaction of the VSTA IDE.
Here's a quick snippet that shows how to add a ‘La&unch Something’ menu button to the Tools menu of the VSTA IDE.
CustomizeIDEMenu() is a method in the host application that assumes that VSTA is initialized and a valid reference to the DTE is provided.
public void CustomizeIDEMenu()
{
Object objMissing = System.Reflection.Missing.Value;
DTE dte = mProgram.mVSTAHookup.DesignTimeEnvironment;
CommandBars commandBars = dte.CommandBars as CommandBars;
CommandBarControl control = commandBars["Tools"].Controls.Add(MsoControlType.msoControlButton,
1, objMissing, objMissing, true);
btnLaunchSomething = control as CommandBarButton;
btnLaunchSomething.Caption = "La&unch Something";
//btnLaunchSomething.FaceId
btnLaunchSomething.Click += new _CommandBarButtonEvents_ClickEventHandler(btnLaunchSomething_Click);
}
void btnLaunchSomething_Click(CommandBarButton Ctrl, ref bool CancelDefault)
{
WriteLine("Launch Something!");
}
You can find more information about programming the DTE from the Visual Studio Extensibility forum