Partager via


IVsUIHierarchyWindow.Init Method

Initializes a custom use of a UI hierarchy window.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Déclaration
Function Init ( _
    pUIH As IVsUIHierarchy, _
    grfUIHWF As UInteger, _
    <OutAttribute> ByRef ppunkOut As Object _
) As Integer
'Utilisation
Dim instance As IVsUIHierarchyWindow
Dim pUIH As IVsUIHierarchy
Dim grfUIHWF As UInteger
Dim ppunkOut As Object
Dim returnValue As Integer

returnValue = instance.Init(pUIH, grfUIHWF, _
    ppunkOut)
int Init(
    IVsUIHierarchy pUIH,
    uint grfUIHWF,
    out Object ppunkOut
)
int Init(
    [InAttribute] IVsUIHierarchy^ pUIH, 
    [InAttribute] unsigned int grfUIHWF, 
    [OutAttribute] Object^% ppunkOut
)
abstract Init : 
        pUIH:IVsUIHierarchy * 
        grfUIHWF:uint32 * 
        ppunkOut:Object byref -> int 
function Init(
    pUIH : IVsUIHierarchy, 
    grfUIHWF : uint, 
    ppunkOut : Object
) : int

Parameters

  • grfUIHWF
    Type: System.UInt32
    [in] Characteristics of the UI hierarchy window. For a list of values, see the __UIHWINFLAGS enumeration.
  • ppunkOut
    Type: System.Object%
    [out] Pointer to the IUnknown interface of the IVsWindowFrame object containing the UI hierarchy window.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsUIHierarchyWindow::Init(
   [in] IVsUIHierarchy *pUIH,
   [in] UIHWINFLAGS grfUIHWF,
   [out] IUnknown** ppunkOut
);

The project window of the environment is a reuseable UI element. VSPackages can use an instance of a UI hierarchy window to have a tool window that functions similar to the built-in Project Window. An example use of the UI hierarchy window is the Server Explorer.

A UI hierarchy window is created by passing CLSID_VsUIHierarchyWindow in a call to the method CreateToolWindow. The IVsUIHierarchyWindow interface can be accessed using the interface QueryInterface of the VSFPROPID_DocView object of the tool window returned by this call.

If you must get to any service accessible to the UI hierarchy window (for example, the SID_SVsTrackSelectionEx service or the SID_SUndoManager service), then you can retrieve the VSFPROPID_SPFrame property from the UI hierarchy window's window frame. This returns the IServiceProvider interface of the window frame.

UI hierarchy windows that have multiple top-level nodes require a way to handle selections that include multiple hierarchies. This is because the common parent hierarchy handles commands, if the selection is across hierarchies. To handle such selections, do one of the following:

  • Disallow multiple selection, by setting the value of grfUIHWF to UIHWF_ForceSingleSelect.

  • Have the built in SolutionObject used to handle cross hierarchy selections, by setting the value of grfUIHWF to UIHWF_UseSolutionAsHiddenRootHierarchy.

  • Specify a custom IVsHierarchy object as the hidden root hierarchy node, by setting the value of grfUIHWF to UIHWF_InitWithHiddenRootHierarchy. This root hierarchy cannot have any children, and is only used to handle selections across multiple top-level hierarchies. To specify a hidden root hierarchy that is the parent of top-level nodes, set the value of grfUIHWF to UIHWF_InitWithHiddenParentRoot.

.NET Framework Security

See Also

Reference

IVsUIHierarchyWindow Interface

IVsUIHierarchyWindow Members

Microsoft.VisualStudio.Shell.Interop Namespace