Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

bitmap in a dialog

Posted on 2000-02-23
3
Medium Priority
?
454 Views
Last Modified: 2013-12-03
Hi, Experts!

I would like to implement a bitmap into a dialogfield. The dialog-resource-editor provides the frame for a bitmap or a picture. After renaming the ID it is possible to assign a membervariable that can be of control-type. With this variable it is possible to reach the SetBitmap-function which requires a handle to the desired bitmap. How do I get the handle to my bitmap that is included as a resource in my project and has got an IDB-Id??
0
Comment
Question by:BoogieBoy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
naveenkohli earned 60 total points
ID: 2552463
Make use of CBitmap class.

CBitMap bimap;
bitmap.LoadBitmap (IDB_MYBITMAP);
And then you can make use of HBITMAP operator to get HBITMAP handle.
0
 

Author Comment

by:BoogieBoy
ID: 2554311
Hello, and thanx for your answer.

I implemented this code in the OnInitDialog section:

BOOL CInfoDialog::OnInitDialog()
{

CDialog::OnInitDialog();

//m_progname=arProgInfo[1];

CBitmap satbm;
satbm.LoadBitmap(IDB_BITMAP2);
HBITMAP hbitmap;
hbitmap = satbm;

m_satbitmap.SetBitmap(hbitmap);
return TRUE;
}

But the Bitmap doesnt show up. what is the mistake?
0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 2554486
The problem is that you have declared satbm as local variable and that is valid only within scope of your OnInitDialog function. Define this CBitMap variable as class memeber so that its life is controlled by life of your dialog box.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

721 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