tu as une fuite de ressource dans WM_PAINT. Il faut détruire les objets créés et remettre les anciens dans le DC :
hdc = BeginPaint (hwnd, &ps) ; SetBkMode( hdc, TRANSPARENT); SetBkColor(hdc,RGB(210,0,0));
// création objets HPEN hPenGreen = CreatePen(PS_SOLID, 3, RGB(0, 255, 0)); HBRUSH hBrushRed = CreateSolidBrush(RGB(255,0,0));
HPEN hPenYellow = CreatePen(PS_SOLID, 1, RGB(255, 255, 0)); HBRUSH hBrushYellow =CreateSolidBrush(RGB(255, 255, 0));
HPEN hOldPen = (HPEN)SelectObject(hdc, hPenGreen); HBRUSH hOldBrush = (HBRUSH)SelectObject(hdc, hBrushRed);
Rectangle(hdc,0,0,395,367);
SelectObject(hdc, hBrushYellow); SelectObject(hdc, hPenYellow);
Rectangle(hdc, paddle1.left, paddle1.top, paddle1.right, paddle1.bottom); Rectangle(hdc, paddle2.left, paddle2.top, paddle2.right, paddle2.bottom); Ellipse(hdc, cercle.left, cercle.top, cercle.right, cercle.bottom);
SelectObject(hdc, hOldPen); SelectObject(hdc, hOldBrush);
DeleteObject(hPenGreen); DeletePbject(hPenYellow); DeleteObject(hBrushRed); DeleteObject(hBrushYellow);
EndPaint (hwnd, &ps) ;
|