我正在尝试编写一个使用图像来显示旋转结果的老虎机 Win32 应用程序。我知道如何在正常的 LRESULT CALLBACK 框架上显示图像,但是在对话框上显示图像时我迷失了。谁能帮助我解释(深入)我将如何显示图像?对此,我真的非常感激。
我当前的对话框回调:
BOOL CALLBACK DlgProc(HWND hwnd, UINT message,WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG: //dialog created
g_hbmObject = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_OBJECT));
//initialize slotmachine class
Machine.Initialize(time(0));
if(g_hbmObject == NULL) //test if object is loaded correctly
std::cerr << "Could not load ball..";
break;
case WM_COMMAND: //switch command
switch(LOWORD(wParam))
{
case IDC_SPIN: //slot machine spins
//put spin function, decide what to display
//do i put the display image command here? or where?
break;
case IDC_EXIT: //exit button
DeleteObject(g_hbmObject);
EndDialog(hwnd, 0);
break;
}
break;
case WM_CLOSE:
case WM_DESTROY: //case program is exited
DeleteObject(g_hbmObject);
PostQuitMessage(0);
break;
default:
return FALSE;
}
return TRUE;
}