IVsUIShellOpenDocument.AddStandardPreviewer 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将 Web 浏览器添加到可用预览器列表。
public:
int AddStandardPreviewer(System::String ^ pszExePath, System::String ^ pszDisplayName, int fUseDDE, System::String ^ pszDDEService, System::String ^ pszDDETopicOpenURL, System::String ^ pszDDEItemOpenURL, System::String ^ pszDDETopicActivate, System::String ^ pszDDEItemActivate, System::UInt32 aspAddPreviewerFlags);
public:
int AddStandardPreviewer(Platform::String ^ pszExePath, Platform::String ^ pszDisplayName, int fUseDDE, Platform::String ^ pszDDEService, Platform::String ^ pszDDETopicOpenURL, Platform::String ^ pszDDEItemOpenURL, Platform::String ^ pszDDETopicActivate, Platform::String ^ pszDDEItemActivate, unsigned int aspAddPreviewerFlags);
int AddStandardPreviewer(std::wstring const & pszExePath, std::wstring const & pszDisplayName, int fUseDDE, std::wstring const & pszDDEService, std::wstring const & pszDDETopicOpenURL, std::wstring const & pszDDEItemOpenURL, std::wstring const & pszDDETopicActivate, std::wstring const & pszDDEItemActivate, unsigned int aspAddPreviewerFlags);
public int AddStandardPreviewer (string pszExePath, string pszDisplayName, int fUseDDE, string pszDDEService, string pszDDETopicOpenURL, string pszDDEItemOpenURL, string pszDDETopicActivate, string pszDDEItemActivate, uint aspAddPreviewerFlags);
abstract member AddStandardPreviewer : string * string * int * string * string * string * string * string * uint32 -> int
Public Function AddStandardPreviewer (pszExePath As String, pszDisplayName As String, fUseDDE As Integer, pszDDEService As String, pszDDETopicOpenURL As String, pszDDEItemOpenURL As String, pszDDETopicActivate As String, pszDDEItemActivate As String, aspAddPreviewerFlags As UInteger) As Integer
参数
- pszExePath
- String
中要为预览器启动的可执行文件的完整路径。
- pszDisplayName
- String
中出现在 "浏览方式" 对话框中的名称。
- fUseDDE
- Int32
中设置为 true 可使用动态数据交换 (DDE) 。 有关详细信息,请参阅动态响应动态数据交换 (DDE)
- pszDDEService
- String
中标识 DDE 服务。
- pszDDETopicOpenURL
- String
中标识主题打开 URL。
- pszDDEItemOpenURL
- String
中提供要浏览的文件的路径。
- pszDDETopicActivate
- String
中标识主题激活 URL。
- pszDDEItemActivate
- String
中标识主题 activate string。
- aspAddPreviewerFlags
- UInt32
中将查看器设置为系统默认值之一。 有关详细信息,请参阅 __VSASPFLAGS。
返回
如果该方法成功,则它会返回 S_OK。 如果该方法失败,则会返回错误代码。
注解
COM 签名
从 vsshell:
HRESULT IVsUIShellOpenDocument::AddStandardPreviewer(
[in] LPCOLESTR pszExePath,
[in] LPCOLESTR pszDisplayName,
[in] BOOL fUseDDE,
[in] LPCOLESTR pszDDEService,
[in] LPCOLESTR pszDDETopicOpenURL,
[in] LPCOLESTR pszDDEItemOpenURL,
[in] LPCOLESTR pszDDETopicActivate,
[in] LPCOLESTR pszDDEItemActivate,
[in] VSASPFLAGS aspAddPreviewerFlags
);
此方法将 web 浏览器添加到可通过启动的可用预览器列表 OpenStandardPreviewer 。 添加预览器后,它将保留在 HKEY_CURRENT_USER 下的注册表中。
希望添加标准预览器的 VSPackage 应将注册表项放在 HKEY_LOCAL_MACHINE \ . ..\7.0\AddStandardPreviewer {guidPackage} = "包名称" 子项下。 此名称仅用于调试目的,不实际使用。
在适当的时间,环境会分析注册表项和调用 ResetDefaults ,并传入 PKGRF_ADDSTDPREVIEWER VSPackage 上的参数的值 grfFlags 。 此时,VSPackage 应调用 IVsUIShellOpenDocument::AddStandardPreviewer 。
例如,如果环境未将 Internet Explorer 作为标准预览器提供,则可以添加调用,如下所示:
AddStandardPreviewer(L"c:\\program files\\internet explorer\\iexplore.exe", L"Microsoft Internet Explorer", TRUE, L"IEXPLORE", L"WWW_OpenURL", L"\"%s\",,0xffffffff,3,,,,",
L"WWW_Activate", L"0xffffffff,0", ASP_MakeDefault);
请 ASP_UnsetOldDefaults 谨慎使用,因为您必须将旧的默认值设置为 ASP_MakeDefault ,以便永远不会有零默认值。 此外,如果多个 Vspackage 使用 ASP_UnsetOldDefaults | ASP_MakeDefault ,则最后一个 VSPackage 为默认值。