Trying to set MainWindow.Caption throws an exception. You have to use the Win32 SetWindowText function to change the title, but beware: Visual Studio resets the title bar text at the drop of a hat, so you should implement a Timer to keep setting your desired text. The following code from the Connect
class of the add-in will permanently (or, as long as the add-in is running) keep the title bar text as "Hello World!"
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
resetTitleTimer = new Timer(new TimerCallback(SetMainWindowTitle), "Hello world!", 0, 10);
}
[DllImport("user32.dll")]
private static extern bool SetWindowText(IntPtr hWnd, string lpString);
private void SetMainWindowTitle(object state)
{
IntPtr hWnd = (IntPtr)_applicationObject.MainWindow.HWnd;
SetWindowText(hWnd, "Hello World!");
}