open vsta as a modal window...

Latest post 01-11-2007 12:26 AM by patbradley. 4 replies.
  • 01-03-2007 4:54 PM

    open vsta as a modal window...

    is there a function or flag to set to force the vsta ide to open as a modal window?
  • 01-04-2007 12:23 PM In reply to

    • Gary
    • Top 10 Contributor
    • Joined on 07-13-2006
    • Posts 318

    Re: open vsta as a modal window...

    No there isn't.  The VSTA IDE allows the user to also interact with the hosting application while the IDE is open.

    Would you explain why you would like to open the VSTA IDE as a modal window?

  • 01-05-2007 11:41 AM In reply to

    Re: open vsta as a modal window...

    Gary,

    Thanks for the reply.

    What we are trying to do is identify when the IDE closes so we can do processing in our host application.  More specifically, we are persisting the VSTA project out to a blob in our database when the IDE closes.

    Is there an event handler we can implement to catch the "onclose" of VSTA?

    Thanks for any help!

    Pat

  • 01-05-2007 4:34 PM In reply to

    • Gary
    • Top 10 Contributor
    • Joined on 07-13-2006
    • Posts 318

    Re: open vsta as a modal window...

    Hi Pat,

    For complete control of the DTE you should consider creating an in-process host

    ms-help://MS.VSCC.v80/MS.VSIPCC.v80/MS.VSSDK.v80/dv_vstasdk/html/c10b7a28-074d-4450-99ba-d915dfd57a22.htm

    ===

    or try using the DTE.Events like

    ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_envdte/html/T_EnvDTE_Events_Members.htm

    as illustrated in ShapeAppAdvancedCSharp, extension.cs

    private void EnsureIDE()

    {

    if (this.dte == null)

    {

    try

    {

    IDTEProvider dteProvider = (IDTEProvider)new VSTADTEProviderClass();

    this.dte = (EnvDTE.DTE)dteProvider.GetDTE("ShapeAppAdvancedCSharp", 0);

    System.Diagnostics.Debug.Assert(this.dte != null);

    }

    catch

    {

    // If DTEProvider does not work, try co-creating DTE instead.

    object objDTE = new DTE();

    this.dte = (EnvDTE.DTE)objDTE;

    }

    // Save a copy of the event sync locations so they don't get

    // garbage collected.

    this.buildEvents = dte.Events.BuildEvents;

    this.solutionEvents = dte.Events.SolutionEvents;

    this.dteEvents = dte.Events.DTEEvents;

    this.buildEvents.OnBuildDone += new EnvDTE._dispBuildEvents_OnBuildDoneEventHandler(BuildEvents_OnBuildDone);

    this.solutionEvents.AfterClosing += new EnvDTE._dispSolutionEvents_AfterClosingEventHandler(solutionEvents_AfterClosing);

    this.dteEvents.OnBeginShutdown += new EnvDTE._dispDTEEvents_OnBeginShutdownEventHandler(dteEvents_OnBeginShutdown);

    }

    }

    Notice that the DTE object returned by VSTA's GetDTE() provides access to the Full VisualStudio Dev Environment.  The this.dteEvents.OnBeginShutdown event may be useful to you.

    See also

    ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_envdte/html/T_EnvDTE_DTE.htm

    and

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxlrfdteobject.asp

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxlrfonbeginshutdownevent.asp

    You will find more information about using this in the VS SDK and VS Extensibility forums

    Hope this helps.

    Regards,

    Gary

    Filed under: ,
  • 01-11-2007 12:26 AM In reply to

    Re: open vsta as a modal window...

    Gary.

    Thanks for the reply.

    We will eventually be hooking up the in-process host.  Sounds like that will give us much more control.  I discovered that the OnBeginShutdown handler is helpful in that it allows you to set the dte to null after calling dte.quit.

    Pat

Page 1 of 1 (5 items) | RSS
Copyright Summit Software Company, 2008. All rights reserved.