Solved

bitmap in a dialog

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 59
what font behind pdf 32 185
ERP and the other system process verification 5 26
Increment column based of a FK 8 68
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…

759 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