This documentation is archived and is not being maintained.

EditorFactory.CreateEditorInstance Method

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

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

public virtual int CreateEditorInstance(
	uint createDocFlags,
	string moniker,
	string physicalView,
	IVsHierarchy pHier,
	uint itemid,
	IntPtr existingDocData,
	out IntPtr docView,
	out IntPtr docData,
	out string editorCaption,
	out Guid cmdUI,
	out int cancelled


Type: System.UInt32

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

Type: System.String

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.

Type: System.String

Name of the physical view.

Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchy

An IVsHierarchy object.

Type: System.UInt32

Item identifier of the core editor instance.

Type: System.IntPtr

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.

Type: System.IntPtr

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

Type: System.IntPtr

Document Data object. Returns the buffer for the document.

Type: System.String

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.

Type: System.Guid

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.

Type: System.Int32

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

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.


IVsEditorFactory.CreateEditorInstance(UInt32, String, String, IVsHierarchy, UInt32, IntPtr, IntPtr, IntPtr, String, Guid, Int32)