Starting acquaintance with WinAPI need to do something like a traffic light (three gray squares and one of them should change color in order) I don’t know what condition will help someone to understand?
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static RECT rect1 = { 20,20,200,200 }; static RECT rect2 = { 230,20,420,200 }; static RECT rect3 = { 450,20,640,200 }; static INT id = 0; switch (message) { case WM_COMMAND: { int wmId = LOWORD(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_TIMER: { }break; case WM_PAINT: { id = SetTimer(hWnd, TIMERid, 1000, NULL); PAINTSTRUCT ps; HBRUSH hbr = CreateSolidBrush(RGB(169, 169, 169));//grey FillRect(GetDC(hWnd), &rect1, hbr); FillRect(GetDC(hWnd), &rect2, hbr); FillRect(GetDC(hWnd), &rect3, hbr); EndPaint(hWnd, &ps); } break; case WM_DESTROY: KillTimer(hWnd, TIMERid); PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }