How to display output window from add-in?

I currently have a visual studio add-in, and I have created a new output window pane that I can successfully write text to. However, when the output window is not open or minimized, it does not open (pop-up window) when I call the Activate () method on the panel. Any ideas how I can achieve this?

+5
source share
1 answer

If you created the add-in using the add-in wizard, you must have the Exec () method, as shown below. I added two lines that open the output window and become visible regardless of whether they were initially closed or minimized. I tested this on VS2008 and VS2010.

public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
{
    handled = false;
    if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
    {
        if(commandName == "AddinTest.Connect.AddinTest")
        {
            // Find the output window.
            Window outputWindow = _applicationObject.Windows.Item(Constants.vsWindowKindOutput);
            // Show the window. (You might want to make sure outputWindow is not null here...)
            outputWindow.Visible = true;

            handled = true;
            return;
        }
    }
} 
+4
source

All Articles