다음을 통해 공유


IVsExternalFilesManager2.AddDocumentEx Method

Definition

Programmatically informs the Miscellaneous Files project to add a node, allows control over the icon for the node, and provides an opportunity for the editor to query for contextual services.

public:
 int AddDocumentEx(System::UInt32 dwCDW, System::String ^ pszMkDocument, IntPtr punkDocView, IntPtr punkDocData, Guid % rguidEditorType, System::String ^ pszPhysicalView, Guid % rguidCmdUI, System::String ^ pszOwnerCaption, System::String ^ pszEditorCaption, Microsoft::VisualStudio::OLE::Interop::IServiceProvider ^ pspContext, IntPtr hicon, [Runtime::InteropServices::Out] int % pfDefaultPosition, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsWindowFrame ^ % ppWindowFrame);
public int AddDocumentEx (uint dwCDW, string pszMkDocument, IntPtr punkDocView, IntPtr punkDocData, ref Guid rguidEditorType, string pszPhysicalView, ref Guid rguidCmdUI, string pszOwnerCaption, string pszEditorCaption, Microsoft.VisualStudio.OLE.Interop.IServiceProvider pspContext, IntPtr hicon, out int pfDefaultPosition, out Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame ppWindowFrame);
abstract member AddDocumentEx : uint32 * string * nativeint * nativeint * Guid * string * Guid * string * string * Microsoft.VisualStudio.OLE.Interop.IServiceProvider * nativeint * int * IVsWindowFrame -> int
Public Function AddDocumentEx (dwCDW As UInteger, pszMkDocument As String, punkDocView As IntPtr, punkDocData As IntPtr, ByRef rguidEditorType As Guid, pszPhysicalView As String, ByRef rguidCmdUI As Guid, pszOwnerCaption As String, pszEditorCaption As String, pspContext As IServiceProvider, hicon As IntPtr, ByRef pfDefaultPosition As Integer, ByRef ppWindowFrame As IVsWindowFrame) As Integer

Parameters

dwCDW
UInt32

[in] Defines the __VSCREATEDOCWIN flags, which determine how the document window is created.

pszMkDocument
String

[in] Path to the document. This path is used by the environment to register this view in the Running Document Table (RDT).

punkDocView
IntPtr

nativeint

[in] Pointer to the IUnknown interface for the document view object to be displayed within this window.

punkDocData
IntPtr

nativeint

[in] Pointer to the IUnknown interface of an object representing the document data object of this document in situations where there is view or data separation. For example, the core text editor has a text view object (VsTextView Object) and the text buffer object (VsTextBufferObject). This parameter can be null. Passing null causes the environment to create an instance of a default implementation of the punkDocData on the caller's behalf.

rguidEditorType
Guid

[in] Unique identifier of the editor factory that created an instance of the document view and document dataobjects. This should be GUID_NULL if the document is not constructed using an editor factory (that is, an instance is created with private knowledge of a particular project).

pszPhysicalView
String

[in] String to identify the physical view type for the editor.

rguidCmdUI
Guid

[in] Specifies the GUID that indicates which set of menus should be merged into the main menu bar when this document is active. It is used for turning on visibility of commands and tool windows.

pszOwnerCaption
String

[in] Initial caption defined by the document owner (that is, the project) for the document window. This is often of the format: "ProjectName – ItemName."

pszEditorCaption
String

[in] Initial caption defined by the document editor for the document window. This is typically a string enclosed in square brackets (for example, [Read Only]). The initial value of this parameter is returned as an [out] parameter in the CreateEditorInstance(UInt32, String, String, IVsHierarchy, UInt32, IntPtr, IntPtr, IntPtr, String, Guid, Int32) Method.

pspContext
IServiceProvider

[out] Pointer to the IServiceProvider interface. Can be null. This is an additional service provider provided by the caller (the Miscellaneous Files project) making it possible for the caller to provide extra context (by means of services) to the embedded editor. Thus, when the embedded object makes a service request, the frame attempts to satisfy this request. If the service is not provided by the frame, pSP is tried. If the service is not found there, then the environment's global service provider is queried.

hicon
IntPtr

nativeint

[in] Specifies a handle to an icon. Allows you to specify the icon for the Miscellaneous Project node.

pfDefaultPosition
Int32

[out] Can be null if the caller does not desire the default position information for the window. true if the environment did not have any information saved about the last position of this tool window (that is, guidPersistenceSlot was not found), hence it was placed in some default location on the screen. false if this window was placed where the user last located and sized it.

ppWindowFrame
IVsWindowFrame

[out] Pointer to the frame containing this editor, which can be used to manipulate the location, size, caption, and other properties of the window. It can also be used to get the IUnknown interface pointer of the embedding (that is, the punkDocView) or the punkDocData.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsExternalFilesManager2::AddDocumentEx(  
   [in] VSCREATEDOCWIN dwCDW,  
   [in] LPCOLESTR pszMkDocument,  
   [in] IUnknown *punkDocView,  
   [in] IUnknown *punkDocData,  
   [in] REFGUID rguidEditorType,  
   [in] LPCOLESTR pszPhysicalView,  
   [in] REFGUID rguidCmdUI,  
   [in] LPCOLESTR pszOwnerCaption,  
   [in] LPCOLESTR pszEditorCaption,  
   [in] IServiceProvider *pspContext,  
   [in] HICON hIcon,  
   [out] BOOL *pfDefaultPosition,  
   [out] IVsWindowFrame **ppWindowFrame  
);  

Similar to AddDocument Method. Provides the additional functionality of specifying the Miscellaneous Projects icon and provides an opportunity for the editor to query for contextual services.

Applies to