BOOL UpdateWindow(HWND HandleFenetre);
La demande est traitée en synchrone.
#include <windows.h>
#include <winbase.h>
HWND HandleFenetre;
static LRESULT CALLBACK WindowProcedure(HWND HandleFenetre, UINT Message, WPARAM wParam, LPARAM lParam)
{
HDC HandleContexteGraphique;
PAINTSTRUCT PaintStruct;
switch (Msg)
{
case WM_PAINT :
HandleContexteGraphique=BeginPaint(HandleFenetre, &PaintStruct);
if (!HandleContexteGraphique)
{
...
}
...
EndPaint(HandleFenetre, &PaintStruct);
break;
...
}
return(DefWindowProc(HandleFenetre, Message, wParam, lParam));
}
...
if (!InvalidateRect(HandleFenetre, NULL, TRUE))
{
...
}
...
if (!UpdateWindow(HandleFenetre))
{
...
}
...
Il ne faut jamais envoyer le message WM_PAINT directement.