1

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;

JimmyPena
  • 8,694
  • 6
  • 43
  • 64
ZedZip
  • 5,794
  • 15
  • 66
  • 119
  • You should post your solution as an answer, then accept it as the answer, so others can see that the problem was solved. – JimmyPena Jul 11 '12 at 16:58

0 Answers0