Original Post
Hello
I need help with loading a bitmap that is a resource. I have it in the .rc script, but i cant load it and blt it to the screen. I dont think that my LoadImage function is correct, but i''m not sure. Please help me.
extern HINSTANCE hinst;
HBITMAP background=NULL;
bool LoadWindow(HWND hwnd)
{
background=(HBITMAP)LoadImage (hinst,"IDB_BITMAP_WINDOW",IMAGE_BITMAP,
NULL,NULL,LR_DEFAULTCOLOR);
////i also tried the macro MAKEINTRESOURCE (IDB_BITMAP_WINDOW), but that didnt work either////
return true;
}
bool DrawWindow(HWND hwnd)
{
HDC hdc=GetDC(hwnd);
HDC whdc=CreateCompatibleDC(hdc);
SelectObject(whdc,background);
BitBlt(hdc,0,0,100,100,whdc,0,0,SRCCOPY);
DeleteDC(whdc);
ReleaseDC(hwnd,hdc);
return true;
}
bool DestroyWindow()
{
DeleteObject(background);
return true;
}