i just did up a bitmap (.bmp) in mspaint so i can display on my main window when the program starts up. i first put the bitmap as a resource and then loaded it. in the code i load the bitmap and work with a device context and a memdc so i can display the bitmap on the client area. but when i run the program, the bitmap does not show up on the window like i thought i coded it to.
here's my resource file with the bitmap in it:
Code:
#include <windows.h>
#include "resources.h"
500 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "C:/Dev-C++/Icon/MAINICON.ICO"
MainBMP BITMAP "C:/Progs/WinAPI/WinQuiz/WinQuiz.bmp"
OptDlg DIALOG 5, 5, 150, 100
STYLE DS_MODALFRAME | WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | DS_MODALFRAME
CAPTION "Quizer Options/Settings"
{
DEFPUSHBUTTON "Continue...", IDD_OKAY, 32, 50, 30, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "Exit", IDB_EXIT, 32, 50, 30, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
EDITTEXT IDE_EFILE, 5, 5, 25, 10, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP
GROUPBOX "File Chooser", IDF_FFRAME, 1, 1, 40, 20
PUSHBUTTON "Browse...", IDB_BROWSE, 1, 1, 40, 20, WS_CHILD | WS_VISIBLE | WS_TABSTOP
CTEXT "Recent Files:", IDS_RECLAB, 1, 1, 40, 20, WS_CHILD | WS_VISIBLE
LISTBOX IDL_RECENT, 1, 1, 40, 20, WS_CHILD | LBS_NOTIFY | WS_VISIBLE | WS_BORDER | WS_VSCROLL |WS_TABSTOP
PUSHBUTTON "Add/Remove", IDB_ADDREM, 1, 1, 40, 20, WS_CHILD | WS_VISIBLE | WS_TABSTOP
}
and here's the snippet of code that i use to load and display the bitmap:
Code:
/* get a handle to the bitmap */
hMainBMP = LoadBitmap(hInst, "MainBMP");
if(hMainBMP == NULL)
MessageBox(NULL, TEXT("Couldn't display bitmap!"), TEXT("Error!"), 0);
/* display the bitmap on the window */
hDC = GetDC(hwnd);
memDC = CreateCompatibleDC(hDC);
SelectObject(memDC, hMainBMP);
BitBlt(hDC, 0, 0, 363, 222, memDC, 0, 0, SRCCOPY);
ReleaseDC(hwnd, hDC);
DeleteDC(memDC);
what could i possibly be doing wrong so that the bitmap is not being displayed on the window like i'm expecting it to?
thanks!