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.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Syntax
‘선언
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 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
)
public:
virtual int CreateEditorInstance(
unsigned int createDocFlags,
String^ moniker,
String^ physicalView,
IVsHierarchy^ pHier,
unsigned int itemid,
IntPtr existingDocData,
[OutAttribute] IntPtr% docView,
[OutAttribute] IntPtr% docData,
[OutAttribute] String^% editorCaption,
[OutAttribute] Guid% cmdUI,
[OutAttribute] int% cancelled
)
abstract CreateEditorInstance :
createDocFlags:uint32 *
moniker:string *
physicalView:string *
pHier:IVsHierarchy *
itemid:uint32 *
existingDocData:IntPtr *
docView:IntPtr byref *
docData:IntPtr byref *
editorCaption:string byref *
cmdUI:Guid byref *
cancelled:int byref -> int
override CreateEditorInstance :
createDocFlags:uint32 *
moniker:string *
physicalView:string *
pHier:IVsHierarchy *
itemid:uint32 *
existingDocData:IntPtr *
docView:IntPtr byref *
docData:IntPtr byref *
editorCaption:string byref *
cmdUI:Guid byref *
cancelled:int byref -> int
public function CreateEditorInstance(
createDocFlags : uint,
moniker : String,
physicalView : String,
pHier : IVsHierarchy,
itemid : uint,
existingDocData : IntPtr,
docView : IntPtr,
docData : IntPtr,
editorCaption : String,
cmdUI : Guid,
cancelled : int
) : int
Parameters
- createDocFlags
Type: System.UInt32
Flags that define the conditions under which to create the core editor.
- moniker
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.
- physicalView
Type: System.String
Name of the physical view.
- pHier
Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchy
An IVsHierarchy object.
- itemid
Type: System.UInt32
Item identifier of the core editor instance.
- existingDocData
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.
- docView
Type: System.IntPtr%
Document View object. Returns NULL if an external editor exists, otherwise returns the view of the document.
- docData
Type: System.IntPtr%
Document Data object. Returns the buffer for the document.
- editorCaption
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.
- cmdUI
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.
- cancelled
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.
Implements
Remarks
The Visual Studio core editor is the primary command handler.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.