Link to home
Start Free TrialLog in
Avatar of J_Seaman
J_Seaman

asked on

Urgent and hopefully easy BMP


I am trying to display a BMP using the following in an onpaint event:

            CDC *LogoDC, LogoMemDC;
            CBitmap* OldBMP;
            CBitmap LogoBitmap;
            BITMAP BMPObject;

            LogoDC = m_CLogo.GetDC();
            LogoBitmap.LoadBitmap(IDB_BITMAP1);
            LogoBitmap.GetObject( sizeof(BITMAP), &BMPObject);
            LogoMemDC.CreateCompatibleDC(LogoDC);
            OldBMP = LogoMemDC.SelectObject(&LogoBitmap);
            LogoDC->BitBlt(0, 0, BMPObject.bmWidth, BMPObject.bmHeight, &LogoMemDC, 0,0, SRCCOPY );
            LogoMemDC.SelectObject(OldBMP);

Problem is I only get about 256 colours and need proper resolution - 16 bit I think it is.

How do I do this?!

Thanks a lot

James.
Avatar of Member_2_1001466
Member_2_1001466

Have you tried using LoadImage instead of LoadBitmap?

The other thing: Normally I would load the bitmap at another place into a variable and only display it inside the onpaint handler. It might depend on where the bitmap comes from and if it changes often but here it seems to be a resource.
Avatar of J_Seaman

ASKER

Any chance of some code, really busy at the moment and that's n issue which is considered a bonus. If so you can have the points and a very big thankyou. Already determined the problem is due to the internal BMP stuff being stored in 256 colour.
ASKER CERTIFIED SOLUTION
Avatar of Member_2_1001466
Member_2_1001466

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
Not had a chance to test it yet but thanks a lot - I trust ya!