Function to load the bmp from resources:
HBITMAP LoadPicture(UINT nResID);
Draw in DC:
BOOL DrawPicture(HDC hDC, LPRECT lpRect, HBITMAP hBitmap);
If you will declare a static HBITMAP variable in the file with your window procedure:
HBITMAP s_hBitmap = NULL;
and load the bitmap before you create the dialog:
s_hBitmap = LoadPicture(IDB_BITMAP1);
w
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
and will add WM_PAINT handler:
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
::GetClientRect(hWnd, &rect);
DrawPicture(hdc, &rect, s_hBitmap);
EndPaint(hWnd, &ps);
break;
You will see the image as a background of your window.





by: pgnatyukPosted on 2009-10-07 at 22:58:57ID: 25522585
You posted a diloag procedure. I don't see any code loading the image or creating the picture control you are talking about.
This code will load the image:
HBITMAP hBitmap = (HBITMAP)LoadImage(NULL, _T("sunset.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
same about the loading from the resource:
HBITMAP hBitmap = (HBITMAP)LoadImage(NULL, szResName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
Check LoadImage function in MSND:
http://msdn.microsoft
And here: n32/bitmap .html
http://www.relisoft.com/Wi
http://www.winprog.org/tut orial/bitm aps.html
PNG is only a bit a different story.
We are in C zone. Are you sure that the answer on your question will be related to C programming language? Maybe, better to move this question to Microsft Visual C++, Window Programming?