WM_PAINT function, how to call again?
Ok here is the situation. I loaded a bitmap to the screen using windows GDI. I did this in the WM_PAINT function. Now what I want to do is when a user clicks on a file menu, the screen must become all clear. My question is how do I call the WM_PAINT function again to clear the screen? If I just write:
Code:
case ID_FILE_NEW:
WM_PAINT;
{
// Just a note, never use a MessageBox from inside WM_PAINT
// The box will cause more WM_PAINT messages and you'll probably end up
// stuck in a loop
BITMAP bm;
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = SelectObject(hdcMem, Logobmp);
GetObject(Logobmp, sizeof(bm), &bm);
BitBlt(hdc, 100, 50, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
BitBlt(hdc, 0, 0, 800, 600,hdc, 0, 0, WHITENESS);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
EndPaint(hwnd, &ps);
}
nothing happens, the white background does't copy over the picture. However if I write the same code in the WM_PAINT function than it does.