Freigeben über


IVMRWindowlessControl9::GetCurrentImage method (vmr9.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The GetCurrentImage method retrieves a copy of the current image being displayed by the VMR.

Syntax

HRESULT GetCurrentImage(
  [out] BYTE **lpDib
);

Parameters

[out] lpDib

Address of a pointer to a BYTE that will receive the DIB.

Return value

The method returns an HRESULT. Possible values include those in the following table.

Return code Description
S_OK
The method succeeded.
VFW_E_WRONG_STATE
The VMR is not in windowless mode.

Remarks

This method returns the current image being displayed. The image is returned in the form of packed Windows DIB. The image starts with a BITMAPINFOHEADER structure, possibly including palette entries and/or color masks, followed by the image data.

The VMR allocates the memory for the image and returns a pointer to it in the lpDib variable. The caller must free the memory by calling CoTaskMemFree.

This method can be called at any time, no matter what state the filter is in, whether running, stopped or paused. However, frequent calls to this method will degrade video playback performance.

Include DShow.h and D3d9.h before Vmr9.h.

Examples


BYTE *lpDib = NULL;
hr = pWindowlessControl->GetCurrentImage(&lpDib);
if (SUCCEEDED(hr))
{
    BITMAPINFOHEADER  *pBMIH = (BITMAPINFOHEADER*) lpDib;
    /* .... */
    CoTaskMemFree(lpDib);
}


Requirements

Requirement Value
Minimum supported client Windows XP with SP2 [desktop apps only]
Minimum supported server Windows Server 2003 R2 [desktop apps only]
Target Platform Windows
Header vmr9.h
Library Strmiids.lib

See also

IVMRWindowlessControl9 Interface

Using the Video Mixing Renderer