Solved

bitmap in a dialog

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 147
Font: I need Lato on my Mac 10 110
NotAlone Challenge 20 70
fix34  challenge 9 97
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. …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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…

705 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

16 Experts available now in Live!

Get 1:1 Help Now