Advertisement
anathemizatu

C Error

Jan 6th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.26 KB | None | 0 0
  1. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  2. {
  3.     int wmId, wmEvent;
  4.     PAINTSTRUCT ps;
  5.     HDC hdc;
  6.     BITMAP bm;
  7.     HBITMAP hbmOld;
  8.     HDC hdcMem;
  9.     switch (message)
  10.     {
  11.     case WM_COMMAND:
  12.         wmId    = LOWORD(wParam);
  13.         wmEvent = HIWORD(wParam);
  14.         // Parse the menu selections:
  15.         switch (wmId)
  16.         {
  17.         case IDM_ABOUT:
  18.             DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
  19.             break;
  20.         case IDM_EXIT:
  21.             DestroyWindow(hWnd);
  22.             break;
  23.         default:
  24.             return DefWindowProc(hWnd, message, wParam, lParam);
  25.         }
  26.         break;
  27.     case WM_CREATE:
  28.         g_hbmBall = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(ID_V6));
  29.         if(g_hbmBall == NULL)
  30.             MessageBox(hWnd, L"Could not load IDB_BALL!", L"Error", MB_OK | MB_ICONEXCLAMATION);
  31.         break;
  32.     case WM_PAINT:
  33.             hdc = BeginPaint(hWnd, &ps);
  34.             hdcMem = CreateCompatibleDC(hdc);
  35.             hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmBall);
  36.             GetObject(g_hbmBall, sizeof(bm), &bm);
  37.             BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
  38.             EndPaint(hWnd, &ps);
  39.         break;
  40.     case WM_DESTROY:
  41.         SelectObject(hdcMem, hbmOld);
  42.         DeleteDC(hdcMem);
  43.         PostQuitMessage(0);
  44.         break;
  45.     default:
  46.         return DefWindowProc(hWnd, message, wParam, lParam);
  47.     }
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement