is it possible to programmatically dock a tool window?

I'm trying to figure out if it is possible to programmatically dock/tab a tool window the same way that windows such as Solution Explorer and other builtin windows are docked when they are first opened.  I've tried CreateLinkedWindowFrame, but this doesn't seem to do quite what I want.  It does allow multiple windows to be tabbed together, but it creates a floating frame.  I would like to be able to add my tool window into the existing tool windows that are already docked the first time it comes up.

Any ideas


Answer this question

is it possible to programmatically dock a tool window?

  • oerth123

    You should use IVsWindowFrame::SetFramePos

    ms-help://MS.VSCC.v80/MS.VSIPCC.v80/MS.VSIP.v80/dv_iashrf/html/M_Microsoft_VisualStudio_Shell_Interop_IVsWindowFrame_SetFramePos_2_a95d923f.htm




  • Uday5886

    See my article:

    HOWTO: Understanding toolwindow states in Visual Studio

    at:

    http://www.mztools.com/resources_vsnet_addins.htm



  • Chris Niggel

    SetFramePos didn't work for me either. What did work was:

    windowFrame.SetProperty((int)__VSFPROPID.VSFPROPID_FrameMode, VSFRAMEMODE.VSFM_MdiChild);

    The other frame modes are:

    namespace Microsoft.VisualStudio.Shell.Interop
    {
    public enum VSFRAMEMODE
    {
    VSFM_Dock = 0,
    VSFM_Float = 1,
    VSFM_MdiChild = 2,
    VSFM_FloatOnly = 3,
    }
    }

    It worked like a charm for me.



  • Samyag1

    I took the VSIP sample ToolWindow, and tried to modify this to use the SetFramePos.  It still didn't work for me. This is what I did:

    In VsPkg.cs ShowToolWindow(), I added

       Guid viewGuid = Guid.Empty; 
       windowFrame = (IVsWindowFrame)window.Frame;
       windowFrame.SetFramePos(
    VSSETFRAMEPOS.SFP_fDockBottom, 
          ref viewGuid,  0, 0, 0, 0);

    This didn't change the position of the tool window at all.  I also tried various x, y settings.


  • JCS53885

    Hello,

    I would like to know how do you create or get your windowFrame object in your code. Is it possible to get the Frame from a EnvDTE.Window object

    Thanks

  • is it possible to programmatically dock a tool window?