Compartilhar via


IVsUIShellOpenDocument.AddStandardPreviewer Method

Definition

Adds a Web browser to the list of available previewers.

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

Parameters

pszExePath
String

[in] Full path to the executable file you want to launch for the previewer.

pszDisplayName
String

[in] Name that appears in the Browse With dialog box.

fUseDDE
Int32

[in] Set to true to use Dynamic Data Exchange (DDE). For more information, see Dynamic Responding to Dynamic Data Exchange (DDE)

pszDDEService
String

[in] Identifies the DDE service.

pszDDETopicOpenURL
String

[in] Identifies the topic open URL.

pszDDEItemOpenURL
String

[in] Provides the path to the file that is being browsed.

pszDDETopicActivate
String

[in] Identifies the topic activate URL.

pszDDEItemActivate
String

[in] Identifies the topic activate string.

aspAddPreviewerFlags
UInt32

[in] Sets the viewer to be one of the system defaults. For more information, see __VSASPFLAGS.

Returns

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

Remarks

COM Signature

From vsshell.idl:

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  
);  

This method adds a web browser to the list of available previewers that can be launched via OpenStandardPreviewer. Once a previewer has been added, it is persisted in the registry under HKEY_CURRENT_USER.

A VSPackage that wishes to add a standard previewer should put a registry entry under HKEY_LOCAL_MACHINE\...\7.0\AddStandardPreviewer {guidPackage} = "Name of Package" subkey. The name is for debugging purpose only and is not actually used.

At the appropriate time, the environment parses the registry entries and calls ResetDefaults, passing in a value of PKGRF_ADDSTDPREVIEWER for the grfFlags parameter on the VSPackage. At that point the VSPackage should call IVsUIShellOpenDocument::AddStandardPreviewer.

For example, if the environment did not provide Internet Explorer as a standard previewer, you could add a call as follows:

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);  

Use ASP_UnsetOldDefaults with care because you have to unset the old defaults with ASP_MakeDefault, so that there are never zero defaults. Also, if multiple VSPackages use ASP_UnsetOldDefaults | ASP_MakeDefault, the last VSPackage is the default.

Applies to