Solved

bitmap in a dialog

Posted on 2000-02-23
3
440 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
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
naveenkohli earned 20 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can someone Identify This font 4 88
C++ BOOL WINAPI ReadFile fails on windows 10 when reading from USB cable 9 428
sum28 challenge 31 111
twoTwo  challenge 35 101
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

785 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