IVsUIShellOpenDocument::AddStandardPreviewer Method (String^, String^, Int32, String^, String^, String^, String^, String^, UInt32)
Adds a Web browser to the list of available previewers.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
int AddStandardPreviewer( String^ pszExePath, String^ pszDisplayName, int fUseDDE, String^ pszDDEService, String^ pszDDETopicOpenURL, String^ pszDDEItemOpenURL, String^ pszDDETopicActivate, String^ pszDDEItemActivate, unsigned int aspAddPreviewerFlags )
Parameters
- pszExePath
-
Type:
System::String^
[in] Full path to the executable file you want to launch for the previewer.
- pszDisplayName
-
Type:
System::String^
[in] Name that appears in the Browse With dialog box.
- fUseDDE
-
Type:
System::Int32
[in] Set to true to use Dynamic Data Exchange (DDE). For more information, see Dynamic Responding to Dynamic Data Exchange (DDE)
- pszDDEService
-
Type:
System::String^
[in] Identifies the DDE service.
- pszDDETopicOpenURL
-
Type:
System::String^
[in] Identifies the topic open URL.
- pszDDEItemOpenURL
-
Type:
System::String^
[in] Provides the path to the file that is being browsed.
- pszDDETopicActivate
-
Type:
System::String^
[in] Identifies the topic activate URL.
- pszDDEItemActivate
-
Type:
System::String^
[in] Identifies the topic activate string.
- aspAddPreviewerFlags
-
Type:
System::UInt32
[in] Sets the viewer to be one of the system defaults. For more information, see __VSASPFLAGS.
Return Value
Type: System::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
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.