Is there an event raised when dte.Solution.SolutionBuild.StartupProjects changes?

I am creating a Visual Studio 2010 add-in for internal use in my company. I would like to adjust the title bar of the main window to display the name of the current launch project. I can set the title bar of the main window with the following code:

            DTE d = GlobalClass.dte2 as DTE;
        IntPtr hWnd = new System.IntPtr(d.MainWindow.HWnd);


        if (d.Solution.SolutionBuild.StartupProjects != null)
        {
            object[] sStartUpProject = (object[])d.Solution.SolutionBuild.StartupProjects;

            string Caption = d.MainWindow.Caption + "Current Project: " + (string)sStartUpProject[0];

            SendMessage(hWnd, WM_SETTEXT, new IntPtr(0), Caption);
        }

I can run this code whenever a window is created or activated, but this does not update Caption if the user changes the launch project in the solution explorer (or my add-in) and does not move to another window in Visual Studio. I want the title updated as soon as the change has been made.

+5
source share

All Articles