LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { // En-tete habituelle, j'abrège :-) (...etc) while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } return msg.wParam ; }
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc ; int i,j,w=0; PAINTSTRUCT ps ; HBRUSH hBrush ; RECT rect ;
// Ici j'ai des déclarations de variables
switch (message) { case WM_PAINT: {hdc = BeginPaint (hwnd, &ps) ; for (i = 0 ; i <= 600 ; i+=10) {MoveToEx (hdc, 0, i, NULL) ; LineTo (hdc, 800, i) ;} for (j=0; j<= 800; j+=10) {MoveToEx (hdc, j, 0, NULL) ; LineTo (hdc, j, 600) ;} do
{w+=1; SetRect (&rect, 10*px+10, 10*py+10, 10*px, 10*py) ; hBrush = CreateSolidBrush (RGB (50, 200, 100)) ; hdc = GetDC (hwnd) ; SetRect (&rect, 10*Px+10, 10*Py+10, 10*Px, 10*Py) ; hBrush = CreateSolidBrush (RGB (0, 100, 200)) ; hdc = GetDC (hwnd) ; FillRect (hdc, &rect, hBrush) ; ReleaseDC (hwnd, hdc) ; DeleteObject (hBrush) ; /* me demande si c très adroit tout ça, mais ça marche pour l'instant :-/ */ **** c'est ici que j'aimerais bien laisser qqes dixièmes de seconde **** }
while (w<=1000); return 0 ;} } return DefWindowProc (hwnd, message, wParam, lParam) ; }
Merci d'avance!
|