다음을 통해 공유


IVsUIShellOpenDocument.InitializeEditorInstance Method

Initializes an instance of the document editor.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
Function InitializeEditorInstance ( _
    grfIEI As UInteger, _
    punkDocView As IntPtr, _
    punkDocData As IntPtr, _
    pszMkDocument As String, _
    ByRef rguidEditorType As Guid, _
    pszPhysicalView As String, _
    ByRef rguidLogicalView As Guid, _
    pszOwnerCaption As String, _
    pszEditorCaption As String, _
    pHier As IVsUIHierarchy, _
    itemid As UInteger, _
    punkDocDataExisting As IntPtr, _
    pSPHierContext As IServiceProvider, _
    ByRef rguidCmdUI As Guid, _
    <OutAttribute> ByRef ppWindowFrame As IVsWindowFrame _
) As Integer
int InitializeEditorInstance(
    uint grfIEI,
    IntPtr punkDocView,
    IntPtr punkDocData,
    string pszMkDocument,
    ref Guid rguidEditorType,
    string pszPhysicalView,
    ref Guid rguidLogicalView,
    string pszOwnerCaption,
    string pszEditorCaption,
    IVsUIHierarchy pHier,
    uint itemid,
    IntPtr punkDocDataExisting,
    IServiceProvider pSPHierContext,
    ref Guid rguidCmdUI,
    out IVsWindowFrame ppWindowFrame
)
int InitializeEditorInstance(
    [InAttribute] unsigned int grfIEI, 
    [InAttribute] IntPtr punkDocView, 
    [InAttribute] IntPtr punkDocData, 
    [InAttribute] String^ pszMkDocument, 
    [InAttribute] Guid% rguidEditorType, 
    [InAttribute] String^ pszPhysicalView, 
    [InAttribute] Guid% rguidLogicalView, 
    [InAttribute] String^ pszOwnerCaption, 
    [InAttribute] String^ pszEditorCaption, 
    [InAttribute] IVsUIHierarchy^ pHier, 
    [InAttribute] unsigned int itemid, 
    [InAttribute] IntPtr punkDocDataExisting, 
    [InAttribute] IServiceProvider^ pSPHierContext, 
    [InAttribute] Guid% rguidCmdUI, 
    [OutAttribute] IVsWindowFrame^% ppWindowFrame
)
abstract InitializeEditorInstance : 
        grfIEI:uint32 * 
        punkDocView:IntPtr * 
        punkDocData:IntPtr * 
        pszMkDocument:string * 
        rguidEditorType:Guid byref * 
        pszPhysicalView:string * 
        rguidLogicalView:Guid byref * 
        pszOwnerCaption:string * 
        pszEditorCaption:string * 
        pHier:IVsUIHierarchy * 
        itemid:uint32 * 
        punkDocDataExisting:IntPtr * 
        pSPHierContext:IServiceProvider * 
        rguidCmdUI:Guid byref * 
        ppWindowFrame:IVsWindowFrame byref -> int
function InitializeEditorInstance(
    grfIEI : uint, 
    punkDocView : IntPtr, 
    punkDocData : IntPtr, 
    pszMkDocument : String, 
    rguidEditorType : Guid, 
    pszPhysicalView : String, 
    rguidLogicalView : Guid, 
    pszOwnerCaption : String, 
    pszEditorCaption : String, 
    pHier : IVsUIHierarchy, 
    itemid : uint, 
    punkDocDataExisting : IntPtr, 
    pSPHierContext : IServiceProvider, 
    rguidCmdUI : Guid, 
    ppWindowFrame : IVsWindowFrame
) : int

Parameters

  • grfIEI
    Type: 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: IntPtr

    [in] Pointer to the IUnknown interface of the document data object.

  • punkDocData
    Type: IntPtr

    [in] Pointer to the IUnknown interface of the document data object.

  • pszMkDocument
    Type: 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: Guid%

    [in]GUID of the editor type.

  • pszPhysicalView
    Type: String

    [in] Name of the physical view.

  • rguidLogicalView
    Type: 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: 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: 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.

  • itemid
    Type: UInt32

    [in] UI hierarchy item identifier of the document in the project system. For more information see VSITEMID.

  • punkDocDataExisting
    Type: IntPtr

    [in] Pointer to the IUnknown interface of the document data object if the document data object already exists in the running document table.

  • rguidCmdUI
    Type: Guid%

    [in] Command UI GUID of the commands to display for this editor.

Return Value

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

Remarks

COM Signature

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:

.NET Framework Security

See Also

Reference

IVsUIShellOpenDocument Interface

Microsoft.VisualStudio.Shell.Interop Namespace