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
601 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tab names are off by one 5 53
sameEnds challenge 3 135
sum67 challenge 35 93
ShiftLeft challenge 21 78
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.
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…

861 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

24 Experts available now in Live!

Get 1:1 Help Now