?
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
?
644 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
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…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 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