PNG resources loading RRS feed

  • Question

  • Hi All,

    How exactly do you go about loading a PNG resource?

    I've tried the CBitmap.LoadBitmap(UINT resourceId), ::LoadImage(..) and even the Gdiplus::Bitmap::FromResource()

    All fail if the image is of type png, which is odd since I distinctly remember reading somewhere the resource loading now supports jpegs, pngs and gifs now.

    My overall aim is to do a splash screen with soft corners, not just a key colour (I've seen the code project/code guru splash screens that use "alpha" but by manually loading two bmp files, one for rgb the other for alpha).

    Tuesday, December 2, 2008 7:45 PM


All replies

    • Marked as answer by Mark Duffill Wednesday, December 3, 2008 1:13 PM
    Tuesday, December 2, 2008 8:54 PM
  • Ah thanks, I didn't know of the existence of that class! Bit of a *Doh* moment!

    Wednesday, December 3, 2008 1:13 PM
  • You shouldn't feel badly at all. I've always used OleLoadPictureEx() in the past because I didn't know this class existed either, until recently.

    Wednesday, December 3, 2008 4:55 PM
  • While I was debugging some MFC code I came across the class CPngImage which seems to be used by the new MFC feature pack to deal with loading png images from resources.

    Just thought I'd mention this for completeness!
    Thursday, December 18, 2008 12:02 PM