?
Solved

How do you load a BMP into CStatic

Posted on 1998-08-19
4
Medium Priority
?
272 Views
Last Modified: 2012-06-27
I've been looking at the docs in MSVC++ 5 and can only find rough inferances to the how to's of loading a bitmap into a Cstatic control in a form view.  How do I load this BMP from file and then enter it into the static ctrl?? I need to be able to load dynamically as the bitmap will change as the user inputs data.
0
Comment
Question by:quosta
[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
4 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 400 total points
ID: 1112280
Use the LoadImage API

Params something like:
1. hInst to NULL
2. lpszName to the filename
3. uType to IMAGE_BITMAP
4. cxDesired and cyDesired to 0
5. fuLoad to LR_LOADFROMFILE

When you create the CStatic you must specify it has SS_BITMAP style.  For a static on a form view :-
1. Bring up the dialog template in the resource editor
2. Right click on the control, pick Properties on the popup menu
3. Set the "Type" option on the "General" tab to "Bitmap"

0
 

Author Comment

by:quosta
ID: 1112281
As it turns out, I ended up using just that code... I found it in another modual I had written.  So I am accepting your answer.. but it was there all along.

Thanks for the help.
0
 

Expert Comment

by:kraphics
ID: 1112282
I guess I missed something.

I tried your solution, but I get a compile error that states : error C2039: 'LoadImageA' : is not a member of 'CStatic'

I have a control on my DialogBox with the name of "IDC_Selected_Pic"

In my code I execute the command:

CStatic*  Pic2 = (CStatic*)  GetDlgItem(IDC_Selected_Pic);

Then I execute the statement:

intpBLError = Pic2->LoadImage(NULL,TheFile,IMAGE_BITMAP,cxDIB,cyDIB,LR_LOADFROMFILE);

The above code generates the error: error C2039: 'LoadImageA' : is not a member of 'CStatic'

The control that I placed on the form came from the tool box as a "picture", which I gave the "Type" of "Bitmap" on the "General" tab.

Please help...............




0
 

Expert Comment

by:kraphics
ID: 1112283
P.S.
My operating system is NT. Is this the reason that it does not work?
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Keep your audience engaged and get the most out of your next presentation with these quick Prezi tips.
Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
Learn how to set up basic frames and paths in Prezi and understand the open space that Prezi allows you to create presentations in.
Learn how to download your full Prezi presentation for offline presenting. Prezi doesn’t have to be viewed and shared in a web browser, even with a free account you can download your full presentation to share with others. Be sure to download any vi…
Suggested Courses

800 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