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)

Syntax

'Declaration
Function IsSpecificDocumentViewOpen ( _
    pHierCaller As IVsUIHierarchy, _
    itemidCaller As UInteger, _
    pszMkDocument As String, _
    ByRef rguidEditorType As Guid, _
    pszPhysicalView As String, _
    grfIDO As UInteger, _
    <OutAttribute> ByRef ppHierOpen As IVsUIHierarchy, _
    <OutAttribute> ByRef pitemidOpen As UInteger, _
    <OutAttribute> ByRef ppWindowFrame As IVsWindowFrame, _
    <OutAttribute> ByRef pfOpen As Integer _
) As Integer
int IsSpecificDocumentViewOpen(
    IVsUIHierarchy pHierCaller,
    uint itemidCaller,
    string pszMkDocument,
    ref Guid rguidEditorType,
    string pszPhysicalView,
    uint grfIDO,
    out IVsUIHierarchy ppHierOpen,
    out uint pitemidOpen,
    out IVsWindowFrame ppWindowFrame,
    out int pfOpen
)
int IsSpecificDocumentViewOpen(
    [InAttribute] IVsUIHierarchy^ pHierCaller, 
    [InAttribute] unsigned int itemidCaller, 
    [InAttribute] String^ pszMkDocument, 
    [InAttribute] Guid% rguidEditorType, 
    [InAttribute] String^ pszPhysicalView, 
    [InAttribute] unsigned int grfIDO, 
    [OutAttribute] IVsUIHierarchy^% ppHierOpen, 
    [OutAttribute] unsigned int% pitemidOpen, 
    [OutAttribute] IVsWindowFrame^% ppWindowFrame, 
    [OutAttribute] int% pfOpen
)
abstract IsSpecificDocumentViewOpen : 
        pHierCaller:IVsUIHierarchy * 
        itemidCaller:uint32 * 
        pszMkDocument:string * 
        rguidEditorType:Guid byref * 
        pszPhysicalView:string * 
        grfIDO:uint32 * 
        ppHierOpen:IVsUIHierarchy byref * 
        pitemidOpen:uint32 byref * 
        ppWindowFrame:IVsWindowFrame byref * 
        pfOpen:int byref -> int 
function IsSpecificDocumentViewOpen(
    pHierCaller : IVsUIHierarchy, 
    itemidCaller : uint, 
    pszMkDocument : String, 
    rguidEditorType : Guid, 
    pszPhysicalView : String, 
    grfIDO : uint, 
    ppHierOpen : IVsUIHierarchy, 
    pitemidOpen : uint, 
    ppWindowFrame : IVsWindowFrame, 
    pfOpen : int
) : int

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

Remarks

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.

.NET Framework Security

See Also

Reference

IVsUIShellOpenDocument Interface

Microsoft.VisualStudio.Shell.Interop Namespace