次の方法で共有


IVsUIShellOpenDocument.OpenDocumentViaProjectWithSpecific Method

Definition

Finds a specified project to open this document.

public:
 int OpenDocumentViaProjectWithSpecific(System::String ^ pszMkDocument, System::UInt32 grfEditorFlags, Guid % rguidEditorType, System::String ^ pszPhysicalView, 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 OpenDocumentViaProjectWithSpecific (string pszMkDocument, uint grfEditorFlags, ref Guid rguidEditorType, string pszPhysicalView, 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 OpenDocumentViaProjectWithSpecific : string * uint32 * Guid * string * Guid * IServiceProvider * IVsUIHierarchy * uint32 * IVsWindowFrame -> int
Public Function OpenDocumentViaProjectWithSpecific (pszMkDocument As String, grfEditorFlags As UInteger, ByRef rguidEditorType As Guid, pszPhysicalView 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.

grfEditorFlags
UInt32

[in] Flags whose values are taken from the __VSSPECIFICEDITORFLAGS enumeration.

rguidEditorType
Guid

[in] Unique identifier of the editor type.

pszPhysicalView
String

[in] Unique identifier of the physical view.

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 IServiceProvider 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::OpenDocumentViaProjectWithSpecific(  
   [in] LPCOLESTR pszMkDocument,  
   [in] VSSPECIFICEDITORFLAGS grfEditorFlags,  
   [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.

Applies to