This documentation is archived and is not being maintained.

IVsUIShellOpenDocument.IsSpecificDocumentViewOpen Method

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 (
	[InAttribute] IVsUIHierarchy pHierCaller,
	[InAttribute] uint itemidCaller,
	[InAttribute] string pszMkDocument,
	[InAttribute] ref Guid rguidEditorType,
	[InAttribute] string pszPhysicalView,
	[InAttribute] uint grfIDO,
	out IVsUIHierarchy ppHierOpen,
	out uint pitemidOpen,
	out IVsWindowFrame ppWindowFrame,
	out int pfOpen
)
int IsSpecificDocumentViewOpen (
	/** @attribute InAttribute() */ IVsUIHierarchy pHierCaller, 
	/** @attribute InAttribute() */ UInt32 itemidCaller, 
	/** @attribute InAttribute() */ String pszMkDocument, 
	/** @attribute InAttribute() */ /** @ref */ Guid rguidEditorType, 
	/** @attribute InAttribute() */ String pszPhysicalView, 
	/** @attribute InAttribute() */ UInt32 grfIDO, 
	/** @attribute OutAttribute() */ /** @ref */ IVsUIHierarchy ppHierOpen, 
	/** @attribute OutAttribute() */ /** @ref */ UInt32 pitemidOpen, 
	/** @attribute OutAttribute() */ /** @ref */ IVsWindowFrame ppWindowFrame, 
	/** @attribute OutAttribute() */ /** @ref */ int pfOpen
)
JScript does not support passing value-type arguments by reference.

Parameters

pHierCaller

[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

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

pszMkDocument

[in] String form of the unique moniker identifier of the document in the project system. If the document is a file, you can simply specify the file extension for this parameter rather than the full path to the file (for example, .bmp or txt). In non-file cases, this identifier is often in the form of a URL.

rguidEditorType

[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

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

grfIDO

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

ppHierOpen

[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 a null reference (Nothing in Visual Basic).

pitemidOpen

[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 a null reference (Nothing in Visual Basic). For more information see VSITEMID.

ppWindowFrame

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

pfOpen

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

Return Value

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

COM Signature

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.

Show: