Condividi tramite


IVsUIHierarchyWindow.Init(IVsUIHierarchy, UInt32, Object) Method

Definition

Initializes a custom use of a UI hierarchy window.

public:
 int Init(Microsoft::VisualStudio::Shell::Interop::IVsUIHierarchy ^ pUIH, System::UInt32 grfUIHWF, [Runtime::InteropServices::Out] System::Object ^ % ppunkOut);
int Init(Microsoft::VisualStudio::Shell::Interop::IVsUIHierarchy const & pUIH, unsigned int grfUIHWF, [Runtime::InteropServices::Out] winrt::Windows::Foundation::IInspectable const & & ppunkOut);
public int Init (Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy pUIH, uint grfUIHWF, out object ppunkOut);
abstract member Init : Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy * uint32 * obj -> int
Public Function Init (pUIH As IVsUIHierarchy, grfUIHWF As UInteger, ByRef ppunkOut As Object) As Integer

Parameters

pUIH
IVsUIHierarchy

[in] IVsUIHierarchy to initialize.

grfUIHWF
UInt32

[in] Characteristics of the UI hierarchy window. For a list of values, see the __UIHWINFLAGS enumeration.

ppunkOut
Object

[out] Pointer to the IUnknown interface of the IVsWindowFrame object containing the UI hierarchy window.

Returns

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.

Applies to