I have created menu "Run It!". It must create my window. It should be only one in SSMS. All is ok but if window already opened and I click menu I receive an error and window is closed. How I can check if window already exists and do not try to create it but only activate it?
try
{
newWinobj1 = wins2obj.CreateToolWindow2(addinobj, AssemblyLocation,
controlName, controlDescription, controlGuid, ref ctlobj);
newWinobj1.Linkable = false;
newWinobj1.IsFloating = false;
newWinobj1.Visible = true;
}
catch (Exception x)
{
OutputText("My Window [" + controlName +"]:"+x.Message);
}
Solved. Solution: window only is hidden when user clicks x. Need to check and set Visible=true;