Load a resource with a string

Posted on 2005-05-12
Last Modified: 2013-11-20
Here is a simple one:  I need to load bitmaps using the string name of the resource ID of the bitmap in my resource file like so:

m_pBitmap->LoadBitmap("IDB_LAKE");    //not working

Of course if I load it using:
m_pBitmap->LoadBitmap(IDB_LAKE);    //works

but the point is I need the former.  Any help appreciated.
Question by:skirmish76
    LVL 3

    Accepted Solution

    Hi when you define the resource , you can use the "IDB_LAKE", see " this mark.
    Go to the properties of resourece and chaneg the ID_LAKE to "ID_LAKE" with quotation make.

    then your first code will work

    Author Comment

    Short, sharp and 100% correct.  Thanks mate.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now