Solved

How do you load a BMP into CStatic

Posted on 1998-08-19
4
270 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 100 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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
Need to create an automated "sketch" of a photo 3 81
Icon Set from GIMP produces on one icon 3 72
Help with SimpleXML charts with PHP 4 107
Software to generate custom JPGs 12 136
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…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
In this tutorial viewers will learn how to create blended and gradiated shapes in Illustrator using the blend tool Draw two shapes, one of them in a different color: Select both and create a blend by going to Object > Blend > Make: Blends can also b…
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…

733 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