共用方式為


IVsUIShellOpenDocument2.GetDefaultPreviewers Method

Definition

Provides a list of Default Previewers. This is the list of previewers that would be launched if IVsUIShellOpenDocument::OpenStandardPreviewer(NULL) is called.

public:
 int GetDefaultPreviewers(System::UInt32 celt, cli::array <Microsoft::VisualStudio::Shell::Interop::VSDEFAULTPREVIEWER> ^ rgDefaultPreviewers, [Runtime::InteropServices::Out] System::UInt32 % pcActual);
int GetDefaultPreviewers(unsigned int celt, std::Array <Microsoft::VisualStudio::Shell::Interop::VSDEFAULTPREVIEWER> const & rgDefaultPreviewers, [Runtime::InteropServices::Out] unsigned int & pcActual);
public int GetDefaultPreviewers (uint celt, Microsoft.VisualStudio.Shell.Interop.VSDEFAULTPREVIEWER[] rgDefaultPreviewers, out uint pcActual);
abstract member GetDefaultPreviewers : uint32 * Microsoft.VisualStudio.Shell.Interop.VSDEFAULTPREVIEWER[] * uint32 -> int
Public Function GetDefaultPreviewers (celt As UInteger, rgDefaultPreviewers As VSDEFAULTPREVIEWER(), ByRef pcActual As UInteger) As Integer

Parameters

celt
UInt32
rgDefaultPreviewers
VSDEFAULTPREVIEWER[]

[Out] An array of objects of type VSDEFAULTPREVIEWER.

pcActual
UInt32

[Out] A pointer to an unsigned long value.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

If celt is zero and pcActual is not NULL, the number of standard previewers is returned in *pcActual. If celt is not zero, rgDefaultPreviewers must not be NULL, or E_POINTER is returned.

A common pattern is something like the following (omitting error checks for readability):

hr = pIVsUIShellOpenDocument2->GetDefaultPreviewers(0, NULL, &cExpected);

prgpDefViewers = ::CoTaskMemAlloc(cExpected * sizeof(VSDEFAULTPREVIEWER));

hr = pIVsUIShellOpenDocument2->GetDefaultPreviewers(cExpected, prgpDefViewers, &cActual);

Applies to