次の方法で共有


IVsUIShellOpenDocument.GetStandardEditorFactory Method

Returns the editor factory associated with a specific document (for example, a file type).

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

Syntax

'宣言
Function GetStandardEditorFactory ( _
    dwReserved As UInteger, _
    <OutAttribute> ByRef pguidEditorType As Guid, _
    pszMkDocument As String, _
    ByRef rguidLogicalView As Guid, _
    <OutAttribute> ByRef pbstrPhysicalView As String, _
    <OutAttribute> ByRef ppEF As IVsEditorFactory _
) As Integer
'使用
Dim instance As IVsUIShellOpenDocument
Dim dwReserved As UInteger
Dim pguidEditorType As Guid
Dim pszMkDocument As String
Dim rguidLogicalView As Guid
Dim pbstrPhysicalView As String
Dim ppEF As IVsEditorFactory
Dim returnValue As Integer

returnValue = instance.GetStandardEditorFactory(dwReserved, _
    pguidEditorType, pszMkDocument, _
    rguidLogicalView, pbstrPhysicalView, _
    ppEF)
int GetStandardEditorFactory(
    uint dwReserved,
    out Guid pguidEditorType,
    string pszMkDocument,
    ref Guid rguidLogicalView,
    out string pbstrPhysicalView,
    out IVsEditorFactory ppEF
)
int GetStandardEditorFactory(
    [InAttribute] unsigned int dwReserved, 
    [InAttribute] [OutAttribute] Guid% pguidEditorType, 
    [InAttribute] String^ pszMkDocument, 
    [InAttribute] Guid% rguidLogicalView, 
    [OutAttribute] String^% pbstrPhysicalView, 
    [OutAttribute] IVsEditorFactory^% ppEF
)
function GetStandardEditorFactory(
    dwReserved : uint, 
    pguidEditorType : Guid, 
    pszMkDocument : String, 
    rguidLogicalView : Guid, 
    pbstrPhysicalView : String, 
    ppEF : IVsEditorFactory
) : int

Parameters

  • pguidEditorType
    Type: System.Guid%

    [in, out] GUID of the editor factory you want returned. To indicate which editor factory should be returned, specify a value for pguidEditorType or pszMkDocument. Do not provide values for both parameters.

  • pszMkDocument
    Type: System.String

    [in] String form of the moniker identifier of the document in the project system. If the document is a file, you can simply specify the file extension for this parameter rather than the full path to the file (for example, .bmp or txt). To indicate which editor factory should be returned, specify a value for pszMkDocument or pguidEditorType. Do not provide values for both parameters.

  • pbstrPhysicalView
    Type: System.String%

    [out] Physical view string corresponding to the view that is associated with the logical view GUID passed in rguidLogicalView.

Return Value

Type: System.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::GetStandardEditorFactory(
   [in] DWORD dwReserved,
   [in, out] GUID *pguidEditorType,
   [in] LPCOLESTR pszMkDocument,
   [in] REFGUID rguidLogicalView,
   [out] BSTR *pbstrPhysicalView,
   [out, retval] IVsEditorFactory **ppEF
);

Call IVsUIShellOpenDocument.GetStandardEditor if you need to programmatically access the underlying document data of an editor, but you do not need the full editor window instantiated. To do this, you first need to call IVsUIShellOpenDocument.GetStandardEditor to get a pointer to the editor factory (IVsEditorFactory). Once you have this, you can call CreateEditorInstance.

If you do not own the editor factory and thus do not know the editor GUID (pguidEditorType parameter), you can get the editor GUID in one of the following ways:

  • If you have instantiated the editor before, you can use the editor GUID value attached to the window frame, which you might have cached after determining it by calling GetProperty and specifying a value of VSFPROPID_guidEditorType for the propid parameter.

  • If you have a pointer to the document data object, you can call GetGuidEditorType to access the editor GUID.

If it is not possible for you to specify the editor GUID, then specify the path to the document (pszMkDocument parameter) and the environment determines the appropriate standard editor based on the file extension. If the document is a file, you can just provide the file extension for the pszMkDocument parameter instead of the full document path.

Permissions

See Also

Reference

IVsUIShellOpenDocument Interface

IVsUIShellOpenDocument Members

Microsoft.VisualStudio.Shell.Interop Namespace