IC Imaging Control C++

OverlayBitmap::getDC Method

OverlayBitmap::getDC Method

Returns the device context.
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.


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.


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

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

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

<< OverlayBitmap

Get in touch with us

About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us