CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2014
    Posts
    31

    CBitmap::LoadBitmap(...) doesn't work

    http://msdn.microsoft.com/en-us/library/wc99t364.aspx

    There must be critical info that is missing in here because simply creating a CBitmap variable and then calling LoadBitmap(....) is not working.

    Can some one explain to me step by step how you load a bitmap from a PNG file with a resource ID of IDB_PNG_HELP - it is a .png file imported into resource editor (res/Help.png)

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: CBitmap::LoadBitmap(...) doesn't work

    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: CBitmap::LoadBitmap(...) doesn't work

    The thing is that LoadBitmap literally means loading bitmap but not png. You need to convert your image to bitmap object on the fly, and only then it can be attached to CBitmap instance. Actually, this is what the sample provided by 2kaud is about.
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured