Visual C++ Bitmaps

I've created a Bitmap using the resource editor and I'm wanting to use that bitmap as the title of my display which was drawn using DirectDraw.  The application has not been written using the App Wizard.  However, when I try and use the LoadBitmap using
LoadBitmap(hInstance, "TITLE") function to load my bitmap, it displays nothing on the screen! Thats all I've done.  But why does it not do anything.  All I want to do is display it... surely it shouldn't be that too difficult.
I don't know what else to do.. Please help!!

Who is Participating?
BudVVeezerConnect With a Mentor Commented:
First off, if you are going to draw the bitmap using DirectDraw, then it's a different approach, so I can tell you that one too.  But here's how you load and draw a bitmap to a window in C.

HDC hDc = CreateCompatibleDC(GetDC(hWnd));
SelectObject(hDc, hBit);

BitBlt(GetDC(hWnd), 0, 0, x, y, hDc, 0, 0, SRCCOPY);

In the load bitmap, the first parameter is the HINSTANCE of the app, the second is a LPSTR of the resource.  In VC, it assigns IDD_BITMAP1, but you can rename it to whatever you want.  In give it the DC of the window, which you get with GetDC.  THen you select the bitmap into the DC.  BitBlt is the part where it actually draws the bitmap to the screen.  If you have any questions, just ask!

MonkeyDoylesAuthor Commented:
Thank you and ..... thank you!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.