This is due to the problematic message handling for WM_PAINT. See http://www.experts-exchange.com/Microsoft/Development/Q_22767210.html for more details.
The suggested solutions:
hm, it's strange - with some try and error I found it seems to have something to do with the WM_PAINT message handling:
If you
a) comment out the 'case WM_PAINT ... break;' or
b) implement a painting with 'BeginPaint(...);...EndPai
c) call 'return DefWindowProc(hwnd, msg, wparam, lparam);' in the WM_PAINT-case
the message box appears as expected ...
Unfortunateley I can't really tell you why this is - I guess it may have to do something with Windows-internal handling of invalidated regions to draw to ...