Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- int wmId, wmEvent;
- PAINTSTRUCT ps;
- HDC hdc;
- BITMAP bm;
- HBITMAP hbmOld;
- HDC hdcMem;
- switch (message)
- {
- case WM_COMMAND:
- wmId = LOWORD(wParam);
- wmEvent = HIWORD(wParam);
- // Parse the menu selections:
- switch (wmId)
- {
- case IDM_ABOUT:
- DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
- break;
- case IDM_EXIT:
- DestroyWindow(hWnd);
- break;
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- }
- break;
- case WM_CREATE:
- g_hbmBall = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(ID_V6));
- if(g_hbmBall == NULL)
- MessageBox(hWnd, L"Could not load IDB_BALL!", L"Error", MB_OK | MB_ICONEXCLAMATION);
- break;
- case WM_PAINT:
- hdc = BeginPaint(hWnd, &ps);
- hdcMem = CreateCompatibleDC(hdc);
- hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmBall);
- GetObject(g_hbmBall, sizeof(bm), &bm);
- BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
- EndPaint(hWnd, &ps);
- break;
- case WM_DESTROY:
- SelectObject(hdcMem, hbmOld);
- DeleteDC(hdcMem);
- PostQuitMessage(0);
- break;
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement