I'm trying to learn how to do some simple things with MFC - I'm not used to the toolkit. I want to load a png image from disk and display it at a chosen location in the program's window, but am getting a debug assertion error: atlimage.h
Line: 1624

Expression: hBitmap == m_hBitmap

The only initialization is:
CImage genericImage;
genericImage.Load(fName);

(it returns normally, with no errors)

Inside the WM_PAINT routine, the code is a simple:

genericImage.Draw( hdc, 0, 0);

Any ideas? It fails to paint anything if I ignore the debug error, and I can't find any suggestions in the documentation or example code, but I admit I find Microsoft's documentation pretty impenetrable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.