다음을 통해 공유


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

‘선언
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
‘사용 방법
Dim instance As IVsUIShellOpenDocument
Dim pszExePath As String
Dim pszDisplayName As String
Dim fUseDDE As Integer
Dim pszDDEService As String
Dim pszDDETopicOpenURL As String
Dim pszDDEItemOpenURL As String
Dim pszDDETopicActivate As String
Dim pszDDEItemActivate As String
Dim aspAddPreviewerFlags As UInteger
Dim returnValue As Integer

returnValue = instance.AddStandardPreviewer(pszExePath, _
    pszDisplayName, fUseDDE, pszDDEService, _
    pszDDETopicOpenURL, pszDDEItemOpenURL, _
    pszDDETopicActivate, pszDDEItemActivate, _
    aspAddPreviewerFlags)
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
)
function AddStandardPreviewer(
    pszExePath : String, 
    pszDisplayName : String, 
    fUseDDE : int, 
    pszDDEService : String, 
    pszDDETopicOpenURL : String, 
    pszDDEItemOpenURL : String, 
    pszDDETopicActivate : String, 
    pszDDEItemActivate : String, 
    aspAddPreviewerFlags : uint
) : int

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.

  • 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.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.

Permissions

See Also

Reference

IVsUIShellOpenDocument Interface

IVsUIShellOpenDocument Members

Microsoft.VisualStudio.Shell.Interop Namespace