为什么代码没错却不显示Bmp图片??????
代码如下,运行窗体没有错误,窗体正常显示,只是不显示Bmp图片。
switch(message)
{
case WM_CREATE:
g_hbmBall = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_BALL));
if(g_hbmBall == NULL)
MessageBox(hwnd,TEXT("Couldn't load bitmap!"),TEXT("Error"),MB_OK | MB_ICONERROR);
break;
case WM_COMMAND:
wmId = LOWORD(wParm);
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst,MAKEINTRESOURCE(IDD_ABOUTBOX),hwnd,AboutProc);
break;
case IDM_QUIT:
DestroyWindow(hwnd);
break;
default:
return DefWindowProc(hwnd, message, wParm, lParam);
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
BITMAP bm;
HDC hdc = BeginPaint(hwnd, &ps);
HDC hdcMem = CreateCompatibleDC(hdc);
SelectObject(hdcMem,g_hbmBall);
GetObject(g_hbmBall, sizeof(bm), &bm);
BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem,0, 0, SRCCOPY);
DeleteDC(hdcMem);
EndPaint(hwnd, &ps);
break;
}
case WM_DESTROY:
DeleteObject(g_hbmBall);
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,message,wParm,lParam);