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
Solved

How to load bitmap on a command button in VC++How to load bitmap on a command button in VC++

Posted on 2000-03-28
3
622 Views
Last Modified: 2013-12-03
How to load bitmap on a command button in VC++. i have turned on the bitmap property of the command button in design view in dialog.

my code goes like this.

CButton *a;
a= (CButton *)GetDlgItem(IDC_BUTTON1);
a->SetBitmap((HBITMAP)MAKEINTRESOURCE(IDB_BITMAP1));


but nothing happens when this code is executed . am i wrong somewhere??
please reply me immediately. i am using VC6.0
0
Comment
Question by:karthik1979
3 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 2665983
You have to set the IDC_BUTTON1 property to Ownwer_draw and Bitmap
0
 

Author Comment

by:karthik1979
ID: 2671641
I checked it .  i wrote the code on button2 click event  to load bitmap on button1. also i set the BS_OWNERDRAW style as said in MSDN .
but when i click on button 2  . button1  disappeared!! on the dialog box.


0
 

Accepted Solution

by:
pkkn earned 10 total points
ID: 2673038
Hai Karthik,
Try It...

CButton *a;
a= (CButton *)GetDlgItem(IDC_BUTTON1);
HBITMAP hBmp = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1));
a->SetBitmap(hBmp );
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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
Adapt this command to show who installed 29 111
Can someone Identify This font 4 93
format the code in java 6 101
building a service to accessed via telnet client, want colors ? 4 92
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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…
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…

791 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