Link to home
Start Free TrialLog in
Avatar of quosta
quosta

asked on

How do you load a BMP into CStatic

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.
ASKER CERTIFIED SOLUTION
Avatar of Answers2000
Answers2000

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of quosta
quosta

ASKER

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.
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...............




P.S.
My operating system is NT. Is this the reason that it does not work?