This documentation is archived and is not being maintained.

EditorFactory.CreateEditorInstance Method

Used by the EditorFactory class to create the Visual Studio core editor, an editor that supports data/view separation.

This method is not CLS-compliant.  

Namespace: Microsoft.VisualStudio.Package
Assembly: Microsoft.VisualStudio.Package.LanguageService (in microsoft.visualstudio.package.languageservice.dll)

Public Overridable Function CreateEditorInstance ( _
	createDocFlags As UInteger, _
	moniker As String, _
	physicalView As String, _
	pHier As IVsHierarchy, _
	itemid As UInteger, _
	existingDocData As IntPtr, _
	<OutAttribute> ByRef docView As IntPtr, _
	<OutAttribute> ByRef docData As IntPtr, _
	<OutAttribute> ByRef editorCaption As String, _
	<OutAttribute> ByRef cmdUI As Guid, _
	<OutAttribute> ByRef cancelled As Integer _
) As Integer
Dim instance As EditorFactory
Dim createDocFlags As UInteger
Dim moniker As String
Dim physicalView As String
Dim pHier As IVsHierarchy
Dim itemid As UInteger
Dim existingDocData As IntPtr
Dim docView As IntPtr
Dim docData As IntPtr
Dim editorCaption As String
Dim cmdUI As Guid
Dim cancelled As Integer
Dim returnValue As Integer

returnValue = instance.CreateEditorInstance(createDocFlags, moniker, physicalView, pHier, itemid, existingDocData, docView, docData, editorCaption, cmdUI, cancelled)
public int CreateEditorInstance (
	UInt32 createDocFlags, 
	String moniker, 
	String physicalView, 
	IVsHierarchy pHier, 
	UInt32 itemid, 
	IntPtr existingDocData, 
	/** @attribute OutAttribute() */ /** @ref */ IntPtr docView, 
	/** @attribute OutAttribute() */ /** @ref */ IntPtr docData, 
	/** @attribute OutAttribute() */ /** @ref */ String editorCaption, 
	/** @attribute OutAttribute() */ /** @ref */ Guid cmdUI, 
	/** @attribute OutAttribute() */ /** @ref */ int cancelled
JScript does not support passing value-type arguments by reference.



Flags that define the conditions under which to create the core editor.


String form of the moniker identifier of the document in the project system. In the case of documents that are files, this is always the path to the file. This parameter can also be used to specify documents that are not files. For example, in a database-oriented project, this parameter could contain a string that refers to records in a table.


Name of the physical view.


An IVsHierarchy object.


Item identifier of the core editor instance.


Must be the docData object that is registered in the Running Document Table (RDT). This parameter is used to determine if a document buffer (Document Data object) has already been created. When an editor factory is asked to create a secondary view, then this parameter will be non-NULL indicating that there is no document buffer.


Document View object. Returns NULL if an external editor exists, otherwise returns the view of the document.


Document Data object. Returns the buffer for the document.


Initial caption defined by the document editor for the document window. This is typically a string enclosed in square brackets, such as "[Form]". This value is passed as an input parameter to the CreateDocumentWindow method. If the file is [ReadOnly] the caption will be set during load of the file.


Returns the Command UI GUID. This GUID is active when this editor is activated. Any UI element that is visible in the editor has to use this GUID. This GUID is used in the .ctc file in the satellite DLL where it indicates which menus and toolbars should be displayed when the document is active.


Enumeration of type __VSEDITORCREATEDOCWIN. These flags are passed to CreateDocumentWindow Method. This value is set to 0 in EditorFactory implementation.

Return Value

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

The Visual Studio core editor is the primary command handler.