IVsUIShellOpenDocument.OpenDocumentViaProject Method

Definition

Finds an appropriate project to open the document.

public:
 int OpenDocumentViaProject(System::String ^ pszMkDocument, Guid % rguidLogicalView, [Runtime::InteropServices::Out] Microsoft::VisualStudio::OLE::Interop::IServiceProvider ^ % ppSP, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsUIHierarchy ^ % ppHier, [Runtime::InteropServices::Out] System::UInt32 % pitemid, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsWindowFrame ^ % ppWindowFrame);
public int OpenDocumentViaProject (string pszMkDocument, ref Guid rguidLogicalView, out Microsoft.VisualStudio.OLE.Interop.IServiceProvider ppSP, out Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy ppHier, out uint pitemid, out Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame ppWindowFrame);
abstract member OpenDocumentViaProject : string * Guid * IServiceProvider * IVsUIHierarchy * uint32 * IVsWindowFrame -> int
Public Function OpenDocumentViaProject (pszMkDocument As String, ByRef rguidLogicalView As Guid, ByRef ppSP As IServiceProvider, ByRef ppHier As IVsUIHierarchy, ByRef pitemid As UInteger, ByRef ppWindowFrame As IVsWindowFrame) As Integer

Parameters

pszMkDocument
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
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).

ppSP
IServiceProvider

[out] Pointer to the IServiceProvideroledbinterfaces_implemented_by_the_provider interface.

ppHier
IVsUIHierarchy

[out] Pointer to the IVsUIHierarchy interface of the project that can open the document.

pitemid
UInt32

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

ppWindowFrame
IVsWindowFrame

[out, retval] Pointer to the window frame that contains the editor. For more information, see IVsWindowFrame.

Returns

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.

Applies to