I got itLRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HDC hdcScreen;
static HBRUSH hBrush;
switch (message)
{
case WM_CREATE:
hdcScreen = GetDC(0);
SetTimer(hwnd, 1, 20, NULL);
hBrush = CreateSolidBrush(RGB(255, 0, 0));
SelectObject(hdcScreen, (HGDIOBJ)hBrush);
return 0;
case WM_TIMER:
Rectangle(hdcScreen, 0, 0, 100, 200);
return 0;
case WM_DESTROY:
KillTimer(hwnd, 1);
DeleteObject((HGDIOBJ)hBrush);
ReleaseDC(0,hdcScreen);
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
|