Can you tell me what exactly are you trying to do? There are few issues in that code:
1. The application should not send WM_PAINT messages directly. It will cause strange behaviours in your application. If you need something to be redrawn - call InvalidateRect() and if you need immediate redraw - call UpdateWindow() AFTER InvalidateRect().
2. WM_PAINT message is only for drawing. You cannot call any InvalidateRect() or other refreshing functions there - because they will cause WM_PAINT to be sent again and again - the result is an endless loop of redrawing. Also, BeginPaint/EndPaint brackets are not optional in WM_PAINT - these calls must be there - if you avoid these brackets - you must call DefWindowProc() to force Windows to handle the WM_PAINT message. Otherwise, same result - endless redrawing.
And how exactly are you drawing on MINIMIZED window? Minimized window does not have client area and WM_PAINT is for client area only.
Again, my question is why timer, why 5 seconds and what do you need to do?
: im working on a tiny application.
: but dunno how to overcome this strange problem.
:
: the application starts and does nothing until i hit the minimize
: button on the system menu (upper right corner), the window get's
: minimized and a timer starts. then after 5 secs the window's device
: context should in theory be updated with some draw-text information
: (which it does not!) however, if i maximize the window before the 5
: seconds have gone it updates the device context! so it the drawing
: works when window is maximized and not when its minimized. i've
: tried UpdateWindow and InvalidateRect etc.. when window is minimized
: without any luck. drawing-code looks something like this:
:
: case WM_TIMER:
: update = 1;
:
: window.KillTimer();
: window.ShowBaloonTip();
:
: SendMessage(window.GetHwnd(), WM_PAINT, 0, 0);
: break;
:
: case WM_PAINT:
: if (update == 1)
: {
: window.BeginPaint();
: window.PrintfNL("Test");
: window.PrintfNL("Test 2");
: window.EndPaint();
: }
: InvalidateRect(window.GetHwnd(), &window.rc, TRUE);
: window.UpdateWindow();
: update = 0;
: break;:
:
:
: