OverlayBitmap::getDC Method

Returns the device context.
Syntax:
HDC getDC() const;
Return value:

If the method succeeds, the return value identifies the currently used device context of the OverlayBitmap object.

If the function fails, the return value is NULL.

Remarks:

An application can use the returned device context to perform GDI operations that are not provided by a method of the OverlayBitmap class.

Before getDC can be called, an application must call OverlayBitmap::beginPaint. OverlayBitmap::beginPaint creates the device context and selects the bitmap of the OverlayBitmap object in this new device context.

If getDC is called without a preceding call to OverlayBitmap::beginPaint, getDC returns NULL and an exception is thrown.

After all GDI operations have been performed, the OverlayBitmap::endPaint method must be called to release the device context and make the result of the GDI operations visible on the live video.

Sample:

This example demonstrates how to retrieve the device context of the OverlayBitmap object.

smart_ptr<DShowLib::OverlayBitmap> pOverlayBitmap;
HDC hDC;
pOverlayBitmap = m_Grabber.getOverlay( ePP_DEVICE );
pOverlayBitmap->beginPaint();
hDC = pOverlayBitmap->getDC();
if( hDC != NULL)
{
    // Now, perform some GDI functions, using the hDC.
}
pOverlayBitmap->endPaint();

See also: OverlayBitmap, OverlayBitmap::beginPaint, OverlayBitmap::endPaint

<< OverlayBitmap