返回例如工厂与特定文件的编辑器 (,文件类型)。
命名空间: Microsoft.VisualStudio.Shell.Interop
程序集: Microsoft.VisualStudio.Shell.Interop(在 Microsoft.VisualStudio.Shell.Interop.dll 中)
语法
声明
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
int GetStandardEditorFactory(
uint dwReserved,
out Guid pguidEditorType,
string pszMkDocument,
ref Guid rguidLogicalView,
out string pbstrPhysicalView,
out IVsEditorFactory ppEF
)
参数
- dwReserved
类型:System.UInt32
[in] 留作未来使用。
- pguidEditorType
类型:System.Guid%
[in, out] 要返回编辑工厂的 GUID。指示应返回哪个编辑工厂,对于 pguidEditorType 或 pszMkDocument指定值。为两个参数不提供值。
- pszMkDocument
类型:System.String
[in] 字符串文档的标记标识符形式对项目系统,例如,完整路径到文件。指示应返回哪个编辑工厂,对于 pszMkDocument 或 pguidEditorType指定值。为两个参数不提供值。
- rguidLogicalView
类型:System.Guid%
[in] 标识逻辑视图的 GUID。有关逻辑上 GUIDS 列表,请参见逻辑视图和物理视图。
- pbstrPhysicalView
类型:System.String%
[out] 使用与逻辑视图 GUID 的视图对应的物理视图字符串。 rguidLogicalView已通过。
- ppEF
类型:Microsoft.VisualStudio.Shell.Interop.IVsEditorFactory%
[out, retval] 为 IVsEditorFactory 实现的指针请求的编辑。
返回值
类型:System.Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。
备注
COM 签名
从 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
);
调用 IVsUIShellOpenDocument.GetStandardEditor ,如果需要以编程方式基础文档编辑数据的访问,但是,您不需要实例化整版窗口。为此,首先需要调用 IVsUIShellOpenDocument.GetStandardEditor 获取指向编辑工厂 (IVsEditorFactory)。一旦具有这种情况,您可以调用 CreateEditorInstance。
如果不拥有编辑工厂因此不知道编辑、 GUID (pguidEditorType 参数),可以通过以下方式之一来获取编辑 GUID:
如果您实例化编辑器前面,可以使用编辑 GUID 值绑定到窗口框架组成,通常可以在确定后已缓存了通过调用 GetProperty 并指定 VSFPROPID_guidEditorType 的值 propid 参数的。
如果您有指向文档数据对象,就可以调用 GetGuidEditorType 访问编辑 GUID。
如果指定编辑 GUID 您是不可能的,则指定路径。文档 (pszMkDocument 参数),环境确定根据文件扩展名的相应标准编辑。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。