Partager via


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

'Déclaration
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
'Utilisation
Dim instance As IVsUIShellOpenDocument
Dim pHierCaller As IVsUIHierarchy
Dim itemidCaller As UInteger
Dim pszMkDocument As String
Dim rguidEditorType As Guid
Dim pszPhysicalView As String
Dim grfIDO As UInteger
Dim ppHierOpen As IVsUIHierarchy
Dim pitemidOpen As UInteger
Dim ppWindowFrame As IVsWindowFrame
Dim pfOpen As Integer
Dim returnValue As Integer

returnValue = instance.IsSpecificDocumentViewOpen(pHierCaller, _
    itemidCaller, pszMkDocument, rguidEditorType, _
    pszPhysicalView, grfIDO, ppHierOpen, _
    pitemidOpen, ppWindowFrame, pfOpen)
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
)
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. 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
    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.

Permissions

See Also

Reference

IVsUIShellOpenDocument Interface

IVsUIShellOpenDocument Members

Microsoft.VisualStudio.Shell.Interop Namespace