다음을 통해 공유


EditorFactory.CreateEditorInstance 메서드

정의

이 메서드는 지정된 파일이 편집기에서 지원하는 파일인지 확인하고, 그렇다면 핵심 텍스트 편집기를 만들고 언어 서비스를 연결합니다. 파일이 편집기에서 지원하는 파일인지 확인하려면 다음 검사 수행합니다.

이 모든 것이 true이면 IVsTextLines 버퍼를 가져와서 다음과 같이 설정하는 다음 단계를 진행합니다.

마지막으로 CreateEditorView를 호출하여 docView를 만듭니다.

public:
 virtual int CreateEditorInstance(System::UInt32 createDocFlags, System::String ^ moniker, System::String ^ physicalView, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHier, System::UInt32 itemid, IntPtr existingDocData, [Runtime::InteropServices::Out] IntPtr % docView, [Runtime::InteropServices::Out] IntPtr % docData, [Runtime::InteropServices::Out] System::String ^ % editorCaption, [Runtime::InteropServices::Out] Guid % cmdUI, [Runtime::InteropServices::Out] int % cancelled);
public virtual int CreateEditorInstance (uint createDocFlags, string moniker, string physicalView, Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHier, uint itemid, IntPtr existingDocData, out IntPtr docView, out IntPtr docData, out string editorCaption, out Guid cmdUI, out int cancelled);
abstract member CreateEditorInstance : uint32 * string * string * Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * uint32 * nativeint * nativeint * nativeint * string * Guid * int -> int
override this.CreateEditorInstance : uint32 * string * string * Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * uint32 * nativeint * nativeint * nativeint * string * Guid * int -> int
Public Overridable Function CreateEditorInstance (createDocFlags As UInteger, moniker As String, physicalView As String, pHier As IVsHierarchy, itemid As UInteger, existingDocData As IntPtr, ByRef docView As IntPtr, ByRef docData As IntPtr, ByRef editorCaption As String, ByRef cmdUI As Guid, ByRef cancelled As Integer) As Integer

매개 변수

createDocFlags
UInt32

핵심 편집기를 만들 조건을 정의하는 플래그입니다.

moniker
String

프로젝트 시스템에 있는 문서의 모니커 식별자의 문자열 형식입니다. 파일인 문서의 경우 항상 파일의 경로입니다. 이 매개 변수를 사용하여 파일이 아닌 문서를 지정할 수도 있습니다. 예를 들어 데이터베이스 지향 프로젝트에서 이 매개 변수에는 테이블의 레코드를 참조하는 문자열이 포함될 수 있습니다.

physicalView
String

실제 보기의 이름입니다.

pHier
IVsHierarchy

IVsHierarchy 개체입니다.

itemid
UInt32

핵심 편집기 instance 항목 식별자입니다.

existingDocData
IntPtr

nativeint

docData RDT(실행 중인 문서 테이블)에 등록된 개체여야 합니다. 이 매개 변수는 문서 버퍼(문서 데이터 개체)가 이미 만들어졌는지 확인하는 데 사용됩니다. 편집기 팩터리에서 보조 뷰를 만들라는 메시지가 표시되면 이 매개 변수는 문서 버퍼가 없음을 나타내는 매개NULL 변수가 아닙니다.

docView
IntPtr

nativeint

Document View 개체입니다. NULL 외부 편집기가 있으면 를 반환하고, 그렇지 않으면 문서 보기를 반환합니다.

docData
IntPtr

nativeint

Document Data 개체입니다. 문서의 버퍼를 반환합니다.

editorCaption
String

문서 창에 대한 문서 편집기에서 정의한 초기 캡션. 일반적으로 "[Form]"과 같이 대괄호로 묶인 문자열입니다. 이 값은 메서드에 입력 매개 변수로 CreateDocumentWindow(UInt32, String, IVsUIHierarchy, UInt32, IntPtr, IntPtr, Guid, String, Guid, IServiceProvider, String, String, Int32[], IVsWindowFrame) 전달됩니다. 파일이 [ReadOnly]인 경우 파일을 로드하는 동안 캡션 설정됩니다.

cmdUI
Guid

명령 UI GUID를 반환합니다. 이 편집기가 활성화되면 이 GUID가 활성화됩니다. 편집기에서 표시되는 모든 UI 요소는 이 GUID를 사용해야 합니다. 이 GUID는 위성 DLL의 .ctc 파일에서 사용되며 문서가 활성 상태일 때 표시해야 하는 메뉴와 도구 모음을 나타냅니다.

cancelled
Int32

형식 __VSEDITORCREATEDOCWIN의 열거형입니다. 이러한 플래그는 메서드에 CreateDocumentWindow(UInt32, String, IVsUIHierarchy, UInt32, IntPtr, IntPtr, Guid, String, Guid, IServiceProvider, String, String, Int32[], IVsWindowFrame) 전달됩니다. 이 값은 구현에서 로 설정 0 됩니다 EditorFactory .

반환

메서드가 성공하면 S_OK가 반환되고, 그렇지 않으면 오류 코드가 반환됩니다.

구현

설명

이 메서드를 사용하는 방법에 대한 예제는 연습: 핵심 편집기 만들기 및 편집기 파일 형식 등록을 참조하세요.

적용 대상