共用方式為


VsShellUtilities.TryOpenDocument Method

Definition

Tries to open a document using the appropriate project.

public:
 static int TryOpenDocument(IServiceProvider ^ provider, System::String ^ fullPath, Guid logicalView, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsUIHierarchy ^ % hierarchy, [Runtime::InteropServices::Out] System::UInt32 % itemID, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsWindowFrame ^ % windowFrame);
public static int TryOpenDocument (IServiceProvider provider, string fullPath, Guid logicalView, out Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy hierarchy, out uint itemID, out Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame windowFrame);
static member TryOpenDocument : IServiceProvider * string * Guid * IVsUIHierarchy * uint32 * IVsWindowFrame -> int
Public Shared Function TryOpenDocument (provider As IServiceProvider, fullPath As String, logicalView As Guid, ByRef hierarchy As IVsUIHierarchy, ByRef itemID As UInteger, ByRef windowFrame As IVsWindowFrame) As Integer
Public Function TryOpenDocument (provider As IServiceProvider, fullPath As String, logicalView As Guid, ByRef hierarchy As IVsUIHierarchy, ByRef itemID As UInteger, ByRef windowFrame As IVsWindowFrame) As Integer

Parameters

provider
IServiceProvider

The service provider.

fullPath
String

Full path to the document.

logicalView
Guid

GUID identifying the logical view.

hierarchy
IVsUIHierarchy

Reference to the IVsUIHierarchy interface of the project that contains the Open document.

itemID
UInt32

Reference to the hierarchy item identifier of the document in the project.

windowFrame
IVsWindowFrame

A reference to the window frame that is mapped to the document.

Returns

VsConstants.S_OK if successful, a failure code otherwise.

Applies to