次の方法で共有


IVsUIShellOpenDocument.OpenStandardPreviewer Method

Opens a standard web browser for the specified document.

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

Syntax

'宣言
Function OpenStandardPreviewer ( _
    ospOpenDocPreviewer As UInteger, _
    pszURL As String, _
    resolution As VSPREVIEWRESOLUTION, _
    dwReserved As UInteger _
) As Integer
'使用
Dim instance As IVsUIShellOpenDocument
Dim ospOpenDocPreviewer As UInteger
Dim pszURL As String
Dim resolution As VSPREVIEWRESOLUTION
Dim dwReserved As UInteger
Dim returnValue As Integer

returnValue = instance.OpenStandardPreviewer(ospOpenDocPreviewer, _
    pszURL, resolution, dwReserved)
int OpenStandardPreviewer(
    uint ospOpenDocPreviewer,
    string pszURL,
    VSPREVIEWRESOLUTION resolution,
    uint dwReserved
)
int OpenStandardPreviewer(
    [InAttribute] unsigned int ospOpenDocPreviewer, 
    [InAttribute] String^ pszURL, 
    [InAttribute] VSPREVIEWRESOLUTION resolution, 
    [InAttribute] unsigned int dwReserved
)
function OpenStandardPreviewer(
    ospOpenDocPreviewer : uint, 
    pszURL : String, 
    resolution : VSPREVIEWRESOLUTION, 
    dwReserved : uint
) : int

Parameters

  • pszURL
    Type: System.String

    [in] URL of the document to preview.

  • dwReserved
    Type: System.UInt32

    [in] Reserved for future use. Set to a null reference (Nothing in Visual Basic).

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::OpenStandardPreviewer(
   [in] VSOSPFLAGS ospOpenDocPreviewer,
   [in] LPCOLESTR pszURL,
   [in] VSPREVIEWRESOLUTION resolution,
   [in] DWORD dwReserved
);

A project with items that can be previewed (viewed in a browser) is responsible for implementing the IOleCommandTarget command handler. This method should be used in the body of the command handler to cause the browser or browsers to be launched. Call this method to support the Browse With command, which is available from a project system that has enabled the cmdidPreviewInBrowser or cmdidBrowseWith commands. These commands allow the Browse With command to appear if the user attempts to open a file type for which you support opening a browser (previewer).

When a user chooses Browse With, call IVsUIShellOpenDocument.OpenStandardPreviewer to open the Browse With dialog box. The user can select from the list of browsers that are registered. To populate the Browse With dialog box with a specific browser, your VSPackage must call AddStandardPreviewer when the environment calls the ResetDefaults implementation of your VSPackage with a value of PKGRF_ADDSTDPREVIEWER in the grfFlagsparameter. For example, you might want to use this approach to add a special emulator for your product.

The environment supports multiple default browsers. Therefore, this command can cause multiple browsers to be launched. The user controls which browsers is opened using the "Browse With..." dialog box.

Permissions

See Also

Reference

IVsUIShellOpenDocument Interface

IVsUIShellOpenDocument Members

Microsoft.VisualStudio.Shell.Interop Namespace