Hi, I tried creating multiple bitmaps on top of each other but cant seem to get the result i want: currently i have one bitmap that is the background and another bitmap that is supposed to be an animal and will be on top of the background.

this is my WM_PAINT

case WM_PAINT:
		{
            BITMAP bm;
			PAINTSTRUCT ps;

			HDC hdc = BeginPaint(hwnd, &ps);

			HDC hdcMem = CreateCompatibleDC(hdc);
			HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmGround);

			GetObject(g_hbmGround, sizeof(bm), &bm);

			BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, MERGECOPY);


            GetObject(g_hbmRed, sizeof(bm), &bm);

			BitBlt(hdc, 20,20, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCPAINT);

			SelectObject(hdcMem, hbmOld);
			DeleteDC(hdcMem);

        }
		break;

i attach a screeny as my current result.

Try SRCCOPY in your first BitBlt. Look into other modes if that doesn't do what you want. Also check out TransparentBlt which allows you to have a transparent rgb color.

Still havent been able to solve it:S checked out all possibilities is it even possible to do this?

Still havent been able to solve it. Is it even possible to do this?

There must be a way to do it.
What exactly are you trying to do.
What exactly is it doing wrong.

Got the bug fixed after a hour of trying different ways to form it

the problem was that bitblt selected the same object g_hbmGround twice and i had one the size of my screen resolution and one 20 by 20 hence the little green square in my thumbnail.

The following fix did it : after painting the background which is g_hbmGround i had to do select a new object into my hdcMem by using SelectObject(hdcmem, g_hbmRed);
and now its fully working=)
hope this helps people who encounter the same problem as me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.