IVsUIShellOpenDocument.GetStandardEditorFactory 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回与特定文档关联的编辑器工厂 (例如,) 的文件类型。
public:
int GetStandardEditorFactory(System::UInt32 dwReserved, [Runtime::InteropServices::Out] Guid % pguidEditorType, System::String ^ pszMkDocument, Guid % rguidLogicalView, [Runtime::InteropServices::Out] System::String ^ % pbstrPhysicalView, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsEditorFactory ^ % ppEF);
public int GetStandardEditorFactory (uint dwReserved, out Guid pguidEditorType, string pszMkDocument, ref Guid rguidLogicalView, out string pbstrPhysicalView, out Microsoft.VisualStudio.Shell.Interop.IVsEditorFactory ppEF);
abstract member GetStandardEditorFactory : uint32 * Guid * string * Guid * string * IVsEditorFactory -> int
Public Function GetStandardEditorFactory (dwReserved As UInteger, ByRef pguidEditorType As Guid, pszMkDocument As String, ByRef rguidLogicalView As Guid, ByRef pbstrPhysicalView As String, ByRef ppEF As IVsEditorFactory) As Integer
参数
- dwReserved
- UInt32
中保留供将来使用。
- pguidEditorType
- Guid
[in,out]要返回的编辑器工厂的 GUID。 若要指示应返回的编辑器工厂,请为或指定 pguidEditorType 值 pszMkDocument 。 不要为这两个参数都提供值。
- pszMkDocument
- String
中项目系统中文档的名字对象标识符的字符串形式,例如,文件的完整路径。 若要指示应返回的编辑器工厂,请为或指定 pszMkDocument 值 pguidEditorType 。 不要为这两个参数都提供值。
- rguidLogicalView
- Guid
中标识逻辑视图的 GUID。 有关逻辑视图 GUID 的列表,请参阅逻辑视图和物理视图。
- pbstrPhysicalView
- String
弄与传入的逻辑视图 GUID 关联的视图对应的物理视图字符串 rguidLogicalView 。
- ppEF
- IVsEditorFactory
[out,retval]指向所 IVsEditorFactory 请求编辑器的实现的指针。
返回
如果该方法成功,则它会返回 S_OK。 如果该方法失败,则会返回错误代码。
注解
COM 签名
从 vsshell:
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 参数) 并且环境根据文件扩展名确定相应的标准编辑器。