Solved

How do you load a BMP into CStatic

Posted on 1998-08-19
4
266 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
  • 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I've been using this technique since Adobe CS2, and it should work with any version of Illustrator that includes the appearance panel. In this tutorial we'll create a button using the appearance panel in Adobe Illustrator, and then save it as a r…
Keep your audience engaged and get the most out of your next presentation with these quick Prezi tips.
Learn how to set up basic frames and paths in Prezi and understand the open space that Prezi allows you to create presentations in.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

760 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

16 Experts available now in Live!

Get 1:1 Help Now