Solved

bitmap in a dialog

Posted on 2000-02-23
3
445 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

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. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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…

756 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