WindowConfiguration Interface
TOC
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

WindowConfiguration Interface

The WindowConfiguration object represents the layout and configuration of all windows in the Visual Studio environment.

Namespace: EnvDTE
Assembly: EnvDTE (in envdte.dll)

'Declaration
<GuidAttribute("41D02413-8A67-4C28-A980-AD7539ED415D")> _
Public Interface WindowConfiguration
'Usage
Dim instance As WindowConfiguration

/** @attribute GuidAttribute("41D02413-8A67-4C28-A980-AD7539ED415D") */ 
public interface WindowConfiguration
GuidAttribute("41D02413-8A67-4C28-A980-AD7539ED415D") 
public interface WindowConfiguration

You can save your current window layout in the Visual Studio environment as a named window configuration. The WindowConfiguration object represents this configuration, which you can later recall by using the Apply method.

Sub WinConfigExample1(ByVal dte As DTE)
    ' This example lists all currently available named window 
    ' configurations.
    ' Set references to all necessary objects.
    Dim colWinConfig As WindowConfigurations
    Dim objWinConfig As WindowConfiguration

    colWinConfig = dte.WindowConfigurations

    MsgBox("Number of configurations: " & colWinConfig.Count)
    ' List all saved named window configurations.
    FillMsg(colWinConfig)
    ' Create a new window configuration.
    objWinConfig = colWinConfig.Add("NewLayout")
    FillMsg(colWinConfig)
    ' Get rid of the new window configuration.
    objWinConfig.Delete()
    MsgBox("Number of configurations: " & colWinConfig.Count)
    FillMsg(colWinConfig)
End Sub

Sub FillMsg(ByVal colWinConfig As Object)
    ' Lists all currently available named window configurations.
    Dim lCtr As Integer
    Dim strMsg As String

    For lCtr = 1 To colWinConfig.Count
    strMsg = strMsg & "Configuration name " & lCtr & ": " & _
    colWinConfig.Item(lCtr).Name & vbCr
    Next lCtr
    strMsg = "Current Configurations: " & vbCr & strMsg
    MsgBox(strMsg)
End Sub
Show:
© 2016 Microsoft