Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do you load a BMP into CStatic

Posted on 1998-08-19
4
Medium Priority
?
273 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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.
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 create interesting presentations by including videos to keep your audience engaged using Prezi. Select "Insert" from the top menu in your Prezi editor: Select "YouTube Video": Paste the video URL into the prompt: "Select "Insert":…
Suggested Courses

636 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