IVsUIShellOpenDocument::InitializeEditorInstance Method (UInt32, IntPtr, IntPtr, String^, Guid, String^, Guid, String^, String^, IVsUIHierarchy^, UInt32, IntPtr, IServiceProvider^, Guid, IVsWindowFrame^)
Initializes an instance of the document editor.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
int InitializeEditorInstance( unsigned int grfIEI, IntPtr punkDocView, IntPtr punkDocData, String^ pszMkDocument, [InAttribute] Guid% rguidEditorType, String^ pszPhysicalView, [InAttribute] Guid% rguidLogicalView, String^ pszOwnerCaption, String^ pszEditorCaption, IVsUIHierarchy^ pHier, unsigned int itemid, IntPtr punkDocDataExisting, IServiceProvider^ pSPHierContext, [InAttribute] Guid% rguidCmdUI, [OutAttribute] IVsWindowFrame^% ppWindowFrame )
Parameters
- grfIEI
-
Type:
System::UInt32
[in] Flags controlling the initialization of the editor. For a list of enumeration values, see __VSIEIFLAGS. If you specify a value of IEI_DoNotLoadDocData for this parameter, then this method does not attempt to load your DocData by calling LoadDocData.
- punkDocView
-
Type:
System::IntPtr
[in] Pointer to the IUnknown interface of the document data object.
- punkDocData
-
Type:
System::IntPtr
[in] Pointer to the IUnknown interface of the document data object.
- 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]GUID of the editor type.
- pszPhysicalView
-
Type:
System::String^
[in] Name of the physical view.
- rguidLogicalView
-
Type:
System::Guid
[in] GUID identifying the logical view. For a list of logical view GUIDS, see Logical View and Physical View. If you implement IVsMultiViewDocumentView on your document data object, then the value passed into the rguidLogicalView parameter determines which view is activated when the editor window is displayed. The editor window is displayed when the editor is instantiated. By specifying the logical view GUID, the caller of IVsUIShellOpenDocument::InitializeEditorInstance can request the specific view that matches the reason the caller is requesting the view. For example, the caller would specify LOGVIEWID_Debugging to get the view appropriate for debugging view, or LOGVIEWID_TextView to get the view appropriate for the text editor (that is, a view that implements IVsCodeWindow).
- pszOwnerCaption
-
Type:
System::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
-
Type:
System::String^
[in] Initial caption defined by the document editor for the document window. This is typically a string enclosed in square brackets (for example, [Form]). The initial value of this parameter is returned as an [out] parameter in the CreateEditorInstance method.
- pHier
-
Type:
Microsoft.VisualStudio.Shell.Interop::IVsUIHierarchy^
[in] Pointer to the IVsUIHierarchy interface of the project that contains the document.
- itemid
-
Type:
System::UInt32
[in] UI hierarchy item identifier of the document in the project system. For more information see VSITEMID.
- punkDocDataExisting
-
Type:
System::IntPtr
[in] Pointer to the IUnknown interface of the document data object if the document data object already exists in the running document table.
- pSPHierContext
-
Type:
Microsoft.VisualStudio.OLE.Interop::IServiceProvider^
[in] Project-specific service provider. For more information, see IServiceProvider.
- rguidCmdUI
-
Type:
System::Guid
[in] Command UI GUID of the commands to display for this editor.
- ppWindowFrame
-
Type:
Microsoft.VisualStudio.Shell.Interop::IVsWindowFrame^
[out, retval] The window frame that contains the editor. For more information, see IVsWindowFrame.
Return Value
Type: System::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
From vsshell.idl:
HRESULT IVsUIShellOpenDocument::InitializeEditorInstance( [in] VSIEIFLAGS grfIEI, [in] IUnknown *punkDocView, [in] IUnknown *punkDocData, [in] LPCOLESTR pszMkDocument, [in] REFGUID rguidEditorType, [in] LPCOLESTR pszPhysicalView, [in] REFGUID rguidLogicalView, [in] LPCOLESTR pszOwnerCaption, [in] LPCOLESTR pszEditorCaption, [in] IVsUIHierarchy *pHier, [in] VSITEMID itemid, [in] IUnknown *punkDocDataExisting, [in] IServiceProvider *pSPHierContext, [in] REFGUID rguidCmdUI, [out, retval] IVsWindowFrame **ppWindowFrame );
Editors can be initialized for file-based documents and non file-based documents. Because IVsUIShellOpenDocument.InitializeEditorInstance takes pszMkDocumentString as an input parameter, this method supports initializing both file-based and non file-based editors.
IVsUIShellOpenDocument.InitializeEditorInstance is a helper function called by CreateEditorInstance. InitializeEditorInstance calls the following methods in order:
LoadDocData (called unless IEI_DoNotLoadDocData is specified for IVsUIShellOpenDocument::InitializeEditorInstance (grfIEI).
ActivateLogicalView (called only if the document data object implements IVsMultiViewDocumentView).