views:

799

answers:

1

I'm using the win32 Platform SDK (on XP Pro) to create an app consisting a single main window with a number of child windows.

The styles passed to CreateWindow are WS_OVERLAPPEDWINDOW | WS_VISIBLE (for the main window) and WS_CHILDWINDOW | WS_VISIBLE for the children.

The error I'm seeing is that when another application is dragged on top of my app, the underlying windows are not redrawn. An easy (but kludgy) way to force an update is to 'jiggle' the titlebar.

I'm guessing that I'm missing a windows message or not calling a win32 function correctly. Most of my code is straight from Petzold's 95 book.

If it matters, the main window doesn't need to draw anything: the child windows handle all display duties.

A: 

It sounds like you are not calling DefWindowProc for the WM_PAINT message.

Are you sure you are handling the WM_PAINT event properly? In particular make sure that for this WM_PAINT message that you are calling:

DefWindowProc(hwnd,msg,wParam,lParam);

WM_PAINT will be called when your window needs to be repainted.

If you are trying to handle your own drawing of the window, make sure you are calling BeginPaint and EndPaint in your handler.

Brian R. Bondy