Partager via


IVsUIShellOpenDocument.AddStandardPreviewer Method

Adds a Web browser to the list of available previewers.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
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
int AddStandardPreviewer(
    string pszExePath,
    string pszDisplayName,
    int fUseDDE,
    string pszDDEService,
    string pszDDETopicOpenURL,
    string pszDDEItemOpenURL,
    string pszDDETopicActivate,
    string pszDDEItemActivate,
    uint aspAddPreviewerFlags
)
int AddStandardPreviewer(
    [InAttribute] String^ pszExePath, 
    [InAttribute] String^ pszDisplayName, 
    [InAttribute] int fUseDDE, 
    [InAttribute] String^ pszDDEService, 
    [InAttribute] String^ pszDDETopicOpenURL, 
    [InAttribute] String^ pszDDEItemOpenURL, 
    [InAttribute] String^ pszDDETopicActivate, 
    [InAttribute] String^ pszDDEItemActivate, 
    [InAttribute] unsigned int aspAddPreviewerFlags
)
abstract AddStandardPreviewer : 
        pszExePath:string * 
        pszDisplayName:string * 
        fUseDDE:int * 
        pszDDEService:string * 
        pszDDETopicOpenURL:string * 
        pszDDEItemOpenURL:string * 
        pszDDETopicActivate:string * 
        pszDDEItemActivate:string * 
        aspAddPreviewerFlags:uint32 -> int
function AddStandardPreviewer(
    pszExePath : String, 
    pszDisplayName : String, 
    fUseDDE : int, 
    pszDDEService : String, 
    pszDDETopicOpenURL : String, 
    pszDDEItemOpenURL : String, 
    pszDDETopicActivate : String, 
    pszDDEItemActivate : String, 
    aspAddPreviewerFlags : uint
) : int

Parameters

  • pszExePath
    Type: String

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

  • pszDisplayName
    Type: String

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

  • fUseDDE
    Type: Int32

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

  • pszDDEService
    Type: String

    [in] Identifies the DDE service.

  • pszDDETopicOpenURL
    Type: String

    [in] Identifies the topic open URL.

  • pszDDEItemOpenURL
    Type: String

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

  • pszDDETopicActivate
    Type: String

    [in] Identifies the topic activate URL.

  • pszDDEItemActivate
    Type: String

    [in] Identifies the topic activate string.

  • aspAddPreviewerFlags
    Type: UInt32

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

Return Value

Type: Int32
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.

.NET Framework Security

See Also

Reference

IVsUIShellOpenDocument Interface

Microsoft.VisualStudio.Shell.Interop Namespace