Compartir a través de


IVsUIShellOpenDocument.OpenStandardPreviewer Method

Definition

Opens a standard web browser for the specified document.

public:
 int OpenStandardPreviewer(System::UInt32 ospOpenDocPreviewer, System::String ^ pszURL, Microsoft::VisualStudio::Shell::Interop::VSPREVIEWRESOLUTION resolution, System::UInt32 dwReserved);
public:
 int OpenStandardPreviewer(unsigned int ospOpenDocPreviewer, Platform::String ^ pszURL, Microsoft::VisualStudio::Shell::Interop::VSPREVIEWRESOLUTION resolution, unsigned int dwReserved);
int OpenStandardPreviewer(unsigned int ospOpenDocPreviewer, std::wstring const & pszURL, Microsoft::VisualStudio::Shell::Interop::VSPREVIEWRESOLUTION resolution, unsigned int dwReserved);
public int OpenStandardPreviewer (uint ospOpenDocPreviewer, string pszURL, Microsoft.VisualStudio.Shell.Interop.VSPREVIEWRESOLUTION resolution, uint dwReserved);
abstract member OpenStandardPreviewer : uint32 * string * Microsoft.VisualStudio.Shell.Interop.VSPREVIEWRESOLUTION * uint32 -> int
Public Function OpenStandardPreviewer (ospOpenDocPreviewer As UInteger, pszURL As String, resolution As VSPREVIEWRESOLUTION, dwReserved As UInteger) As Integer

Parameters

ospOpenDocPreviewer
UInt32

[in] Bitwise flags that indicate how the previewer is opened. These flags control whether the Browse With dialog box is used (OSP_UsePreviewWithDialog). For more information, see __VSOSPFLAGS.

pszURL
String

[in] URL of the document to preview.

resolution
VSPREVIEWRESOLUTION

[in] Resolution enumeration that determines the resolution in which the browser windows are to be displayed (if supported). Values are taken from the VSPREVIEWRESOLUTION enumeration.

dwReserved
UInt32

[in] Reserved for future use. Set to null.

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

Applies to