IVsUIShellOpenDocument::IsSpecificDocumentViewOpen Method (IVsUIHierarchy^, UInt32, String^, Guid, String^, UInt32, IVsUIHierarchy^, UInt32, IVsWindowFrame^, Int32)

 

Determines whether a specified document view is open.

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

int IsSpecificDocumentViewOpen(
	IVsUIHierarchy^ pHierCaller,
	unsigned int itemidCaller,
	String^ pszMkDocument,
	[InAttribute] Guid% rguidEditorType,
	String^ pszPhysicalView,
	unsigned int grfIDO,
	[OutAttribute] IVsUIHierarchy^% ppHierOpen,
	[OutAttribute] unsigned int% pitemidOpen,
	[OutAttribute] IVsWindowFrame^% ppWindowFrame,
	[OutAttribute] int% pfOpen
)

Parameters

pHierCaller
Type: Microsoft.VisualStudio.Shell.Interop::IVsUIHierarchy^

[in] Hierarchy identifier of the caller passed as a pointer to the caller's IVsUIHierarchy implementation. This parameter is used by the environment's implementation of IsSpecificDocumentViewOpen if the caller specifies a value of IDO_ActivateIfOpen for the grfIDO parameter..

itemidCaller
Type: System::UInt32

[in] UI hierarchy item identifier of the caller. Used with IDO_ActivateIfOpen. For more information see VSITEMID.

pszMkDocument
Type: System::String^

[in] String form of the unique moniker identifier of the document in the project system, for example, the full path to the file. In non-file cases, this identifier is often in the form of a URL.

rguidEditorType
Type: System::Guid

[in] GUID of the editor factory. This value, in combination with pszPhysicalView is used to create the unique identifier of the specified document view.

pszPhysicalView
Type: System::String^

[in] Physical view string. This value, in combination with rguidEditorType, is used to create the unique identifier of the specified document view.

grfIDO
Type: System::UInt32

[in] Flags that control what actions are performed on the open document. For a list of values, see __VSIDOFLAGS.

ppHierOpen
Type: Microsoft.VisualStudio.Shell.Interop::IVsUIHierarchy^

[out] If pfOpen is true, then this parameter is a pointer to the IVsUIHierarchy implementation of the IVsHierarchy that owns the view. If pfOpen is false, then this parameter is null.

pitemidOpen
Type: System::UInt32

[out] If pfOpen is true, then this parameter is a pointer to the UI hierarchy item identifier of the open document that is represented by the specified view. If pfOpen is false, then this parameter is null. For more information see VSITEMID.

ppWindowFrame
Type: Microsoft.VisualStudio.Shell.Interop::IVsWindowFrame^

[out] If pfOpen is true, then this parameter is a pointer to the IVsWindowFrame containing the specified view.

pfOpen
Type: System::Int32

[out, retval] true if the specified document view is open. false if the specified document view is not open.

Return Value

Type: System::Int32

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

From vsshell.idl:

HRESULT IVsUIShellOpenDocument::IsSpecificDocumentViewOpen(
   [in] IVsUIHierarchy *pHierCaller,
   [in] VSITEMID itemidCaller,
   [in] LPCOLESTR pszMkDocument,
   [in] REFGUID rguidEditorType,
   [in] LPCOLESTR pszPhysicalView,
   [in] VSIDOFLAGS grfIDO,
   [out] IVsUIHierarchy **ppHierOpen,
   [out] VSITEMID *pitemidOpen,
   [out] IVsWindowFrame **ppWindowFrame,
   [out, retval] BOOL *pfOpen
);

IsSpecificDocumentViewOpen takes a hierarchy/itemID pair as input that identifies the caller that wants to know whether the view is open. If the specified document view is open in the IDE, this method compares this hierarchy/itemID pair to the hierarchy/itemID pair that currently owns the open document (that is, the owning hierarchy) to determine if the hierarchies are different.

If a different hierarchy has the document view open and that hierarchy implements IVsSupportItemHandoff, then the IVsUIShellOpenDocument::IsSpecificDocumentViewOpen implementation calls the hierarchy's IVsSupportItemHandoff implementation and passes the hierarchy/itemID pair for the calling hierarchy (pHierCaller/itemidCaller).The document is then handed off to the calling hierarchy. If the hierarchy does not implement IVsSupportItemHandoff, then a message box is displayed with the following text, "The document is opened by another project.", The document view is not transferred to the calling hierarchy, and the existing document view is brought forward in the context of the owning hierarchy.

Return to top
Show: