Link to home
Start Free TrialLog in
Avatar of fredsmullin
fredsmullin

asked on

CImage ReleaseDC Exception Mystery

I have been applying the CImage class within a Visual C++/MFC DLL.  I am experiencing a mysterious exception in atlimage.h line 1217 when I call CImage::GetPixel(0,0).  The offending statement is:

hBitmap = HBITMAP( ::SelectObject( m_hDC, m_hOldBitmap ) );
ATLASSERT( hBitmap == m_hBitmap );

I have successfully loaded an 8x13 jpg 24 bpp image from disk and the pixel value is successfully read, yet the m_hOldBitmap member is null and thus SelectObject returns null.  The m_hBitmap member is valid and thus does not match hBitmap.

Has anyone experienced this error and found a solution?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of fredsmullin
fredsmullin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial