-
June 27th, 2005, 09:37 PM
#1
Trying to display a bitmap in a dialog.
I can't get a bitmap to display in a dialog. I have a DLL that someone else wrote. It's called cards.dll (not the windows one). I also have a header he included, renamed to "defines.h", which defines names for all the cards in the DLL.
I loaded the DLL in the OnInitDialog() function, but do not understand how to use BitBlt, so I set the HDC crap to NULL for now, hoping someone can both explain this to me, and help me display the bitmap. Also, if there is a better way to go about doing this, explain please, and include source. Keep in mind I do not know VC++ very well, and am learning through trial and error.
My goal is to create a card simulator. It will display cards, and you can move them, flip them, etc...but there are no rules. This way, you can play any game you want. I have a few quirks to work out in the logic, but I need to get the basics of the code down first.
Code:
BOOL CCardsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
HMODULE hModule = LoadLibrary("Cards.dll");
//LOAD THE BITMAP
HBITMAP hBitmpap =
LoadBitmap(hModule,MAKEINTRESOURCE(IDB_H01));
//IDB_H01 IS THE ACE OF HEARTS, WHICH CORRESPONDS TO 4001
BitBlt(NULL,0,0,10,10,NULL,0,0,SRCAND);
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
A_T
Geek isn't just a four-letter word; it's a six-figure income.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|