Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
652 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
[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
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 30 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

636 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