IVsUIShellOpenDocument.OpenDocumentViaProjectWithSpecific Method

Finds a specified project to open this document.

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


Function OpenDocumentViaProjectWithSpecific ( _
    pszMkDocument As String, _
    grfEditorFlags As UInteger, _
    ByRef rguidEditorType As Guid, _
    pszPhysicalView 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
‘사용 방법
Dim instance As IVsUIShellOpenDocument
Dim pszMkDocument As String
Dim grfEditorFlags As UInteger
Dim rguidEditorType As Guid
Dim pszPhysicalView As String
Dim rguidLogicalView As Guid
Dim ppSP As IServiceProvider
Dim ppHier As IVsUIHierarchy
Dim pitemid As UInteger
Dim ppWindowFrame As IVsWindowFrame
Dim returnValue As Integer

returnValue = instance.OpenDocumentViaProjectWithSpecific(pszMkDocument, _
    grfEditorFlags, rguidEditorType, _
    pszPhysicalView, rguidLogicalView, _
    ppSP, ppHier, pitemid, ppWindowFrame)
int OpenDocumentViaProjectWithSpecific(
    string pszMkDocument,
    uint grfEditorFlags,
    ref Guid rguidEditorType,
    string pszPhysicalView,
    ref Guid rguidLogicalView,
    out IServiceProvider ppSP,
    out IVsUIHierarchy ppHier,
    out uint pitemid,
    out IVsWindowFrame ppWindowFrame
int OpenDocumentViaProjectWithSpecific(
    [InAttribute] String^ pszMkDocument, 
    [InAttribute] unsigned int grfEditorFlags, 
    [InAttribute] Guid% rguidEditorType, 
    [InAttribute] String^ pszPhysicalView, 
    [InAttribute] Guid% rguidLogicalView, 
    [OutAttribute] IServiceProvider^% ppSP, 
    [OutAttribute] IVsUIHierarchy^% ppHier, 
    [OutAttribute] unsigned int% pitemid, 
    [OutAttribute] IVsWindowFrame^% ppWindowFrame
abstract OpenDocumentViaProjectWithSpecific : 
        pszMkDocument:string * 
        grfEditorFlags:uint32 * 
        rguidEditorType:Guid byref * 
        pszPhysicalView:string * 
        rguidLogicalView:Guid byref * 
        ppSP:IServiceProvider byref * 
        ppHier:IVsUIHierarchy byref * 
        pitemid:uint32 byref * 
        ppWindowFrame:IVsWindowFrame byref -> int 
function OpenDocumentViaProjectWithSpecific(
    pszMkDocument : String, 
    grfEditorFlags : uint, 
    rguidEditorType : Guid, 
    pszPhysicalView : String, 
    rguidLogicalView : Guid, 
    ppSP : IServiceProvider, 
    ppHier : IVsUIHierarchy, 
    pitemid : uint, 
    ppWindowFrame : IVsWindowFrame
) : int


  • 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] Unique identifier of the editor type.
  • pszPhysicalView
    Type: System.String
    [in] Unique identifier of the physical view.
  • rguidLogicalView
    Type: System.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: System.UInt32%
    [out] Pointer to the hierarchy item identifier of the document in the project. For more information see VSITEMID.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.


COM Signature

From vsshell.idl:

HRESULT IVsUIShellOpenDocument::OpenDocumentViaProjectWithSpecific(
   [in] LPCOLESTR pszMkDocument,
   [in] REFGUID rguidEditorType,
   [in] LPCOLESTR pszPhysicalView,
   [in] REFGUID rguidLogicalView,
   [out] IServiceProvider **ppSP,
   [out] IVsUIHierarchy **ppHier,
   [out] VSITEMID *pitemid,
   [out, retval] IVsWindowFrame **ppWindowFrame

This method is used by VSPackages that are not projects that need to open a document in a specific editor, but do not care which project opens the file. To call this method from your VSPackage, you need to know exactly which editor factory you want and exactly which window you want the editor factory to create (that is, the physical view). The logical view specified in the rguidLogicalView parameter further allows you to specify which tab should be displayed by the editor if the editor implements IVsMultiViewDocumentView.

This method calls OpenItem. If no project can service the file and the Miscellaneous Files project is not already present, the environment then creates the Miscellaneous Files project and tries again.

.NET Framework Security

See Also


IVsUIShellOpenDocument Interface

IVsUIShellOpenDocument Members

Microsoft.VisualStudio.Shell.Interop Namespace