Delen via


IVsUIShellOpenDocument.OpenDocumentViaProject Method

Finds an appropriate project to open the document.

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

Syntax

'Declaration
Function OpenDocumentViaProject ( _
    pszMkDocument As String, _
    ByRef rguidLogicalView As Guid, _
    <OutAttribute> ByRef ppSP As IServiceProvider, _
    <OutAttribute> ByRef ppHier As IVsUIHierarchy, _
    <OutAttribute> ByRef pitemid As UInteger, _
    <OutAttribute> ByRef ppWindowFrame As IVsWindowFrame _
) As Integer
int OpenDocumentViaProject(
    string pszMkDocument,
    ref Guid rguidLogicalView,
    out IServiceProvider ppSP,
    out IVsUIHierarchy ppHier,
    out uint pitemid,
    out IVsWindowFrame ppWindowFrame
)
int OpenDocumentViaProject(
    [InAttribute] String^ pszMkDocument, 
    [InAttribute] Guid% rguidLogicalView, 
    [OutAttribute] IServiceProvider^% ppSP, 
    [OutAttribute] IVsUIHierarchy^% ppHier, 
    [OutAttribute] unsigned int% pitemid, 
    [OutAttribute] IVsWindowFrame^% ppWindowFrame
)
abstract OpenDocumentViaProject : 
        pszMkDocument:string * 
        rguidLogicalView:Guid byref * 
        ppSP:IServiceProvider byref * 
        ppHier:IVsUIHierarchy byref * 
        pitemid:uint32 byref * 
        ppWindowFrame:IVsWindowFrame byref -> int
function OpenDocumentViaProject(
    pszMkDocument : String, 
    rguidLogicalView : Guid, 
    ppSP : IServiceProvider, 
    ppHier : IVsUIHierarchy, 
    pitemid : uint, 
    ppWindowFrame : IVsWindowFrame
) : int

Parameters

  • pszMkDocument
    Type: 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.

  • rguidLogicalView
    Type: Guid%

    [in] Unique identifier of the logical view. If the editor implements IVsMultiViewDocumentView on the document view object, then the value passed into the rguidLogicalView parameter determines which view is activated when the editor window is shown, when the editor is instantiated. By specifying the logical view GUID, you can request the specific view that matches the reason you are requesting the view. For example, specify LOGVIEWID_Debugging to get the view appropriate for debugging, or LOGVIEWID_TextView to get the view appropriate for the text editor (that is, a view that implements IVsCodeWindow).

  • pitemid
    Type: UInt32%

    [out] Pointer to the hierarchy item identifier of the document in the project. For more information see VSITEMID.

Return Value

Type: 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::OpenDocumentViaProject(
   [in] LPCOLESTR pszMkDocument,
   [in] REFGUID rguidLogicalView,
   [out] IServiceProvider **ppSP,
   [out] IVsUIHierarchy **ppHier,
   [out] VSITEMID *pitemid,
   [out, retval] IVsWindowFrame **ppWindowFrame
);

IVsUIShellOpenDocument.OpenDocumentViaProject can be called to open any project that is opened through the New Project or Open Project dialog box. In addition, this method is also called to open a document in any project that is added to the solution through AddVirtualProject or AddVirtualProjectEx. One example use of this is the DataView hierarchy, which is currently in Server Explorer. If a DataView hierarchy is added to the solution as a virtual project using AddVirtualProject, then the OpenDocumentViaProject method can open items from DataView hierarchies. This functionality is important as it makes debugging of stored procedures possible.

.NET Framework Security

See Also

Reference

IVsUIShellOpenDocument Interface

Microsoft.VisualStudio.Shell.Interop Namespace