IVsExternalFilesManager.AddDocument Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Programmatically tells the Miscellaneous Files project to add a node.
public:
int AddDocument(System::UInt32 dwCDW, System::String ^ pszMkDocument, IntPtr punkDocView, IntPtr punkDocData, Guid % rguidEditorType, System::String ^ pszPhysicalView, Guid % rguidCmdUI, System::String ^ pszOwnerCaption, System::String ^ pszEditorCaption, [Runtime::InteropServices::Out] int % pfDefaultPosition, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsWindowFrame ^ % ppWindowFrame);
public int AddDocument (uint dwCDW, string pszMkDocument, IntPtr punkDocView, IntPtr punkDocData, ref Guid rguidEditorType, string pszPhysicalView, ref Guid rguidCmdUI, string pszOwnerCaption, string pszEditorCaption, out int pfDefaultPosition, out Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame ppWindowFrame);
abstract member AddDocument : uint32 * string * nativeint * nativeint * Guid * string * Guid * string * string * int * IVsWindowFrame -> int
Public Function AddDocument (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, 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. The environment uses this path to register the 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 the document window.
- punkDocData
-
IntPtr
nativeint
[in] Pointer to the IUnknown
interface of an object representing the document data object of the document that is being added 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 (VsTextBuffer Object). This parameter can be null
. Passing null
causes the environment to create an instance of a default implementation of the punkDocData
on the behalf of the caller.
- rguidEditorType
- Guid
[in] Unique identifier of the editor factory that created an instance of the document view and document data objects. 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 what 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.
- pfDefaultPosition
- Int32
[out] Can be null
if the caller does not want 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 IVsExternalFilesManager::AddDocument(
[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,
[out] BOOL *pfDefaultPosition,
[out] IVsWindowFrame **ppWindowFrame
);
Very similar to CreateDocumentWindow Method. AddDocument
does not include the parameters ItemId
and pUIH
(a pointer to IVsHierarchy) because the Miscellaneous Files project assigns its own ItemId
and the pUIH
pair, and uses the rest of the AddDocument
parameters to create a document window.