locked
Activating visual studio add-in form, after showing ToolWindow RRS feed

  • Question

  • Hello,   I am currently developing a Visual Studio 2012/2010 add-in.

    When I'm invoking (Exec) my add-in, i'm trying to show a ToolWindow that i've created,
    and then open a WinForm I created.

    Unfortunatly, my form immediately loses focus (deactivates) and the toolWindow is activated,
    although I called Form.Show() AFTER I have done visible=true to the toolWindow.

    I even tried registring to the OnLoad/OnPaint events of the toolWindow's usercontrol and calling:
    Form.Activate() but no luck.

    I want the toolWindow to show, and then my form to be shown, onTop, and activated.

    Thank you.

    Tuesday, July 23, 2013 12:45 PM

Answers

  • Activating windows that the shell knows nothing about, in a non-modal fashion, is a bad idea, generally. The form should either be shown modally (and there are specific things you need to do to ensure this is done correctly), or the form should be a different toolwindow so it is dockable and acts like every other toolwindow in VS.
    Tuesday, July 23, 2013 6:45 PM