views:

53

answers:

2

My application has a standard top level window for the application. I need to force a repaint of the window chrome (otherwise known as the non-client area of the window). I do not care if the client area is also repainted or not but the chrome itself needs to be forced to repaint.

In particular I need this to work on Windows 7. Whether it works on other OS versions does not matter in my particular case. The solution can be C, C++, C# or any other language.

A: 

maybe you could send the WM_NCPAINT message to the window

http://msdn.microsoft.com/en-us/library/dd145212%28VS.85%29.aspx

camilin87
Sorry, but this message is sent by the operating system when it has already decided it needs to have the window painted. Sending this message to the window will not cause the chrome to be updated on the screen but merely get the code to draw into a DC that I would have to supply myself.
Phil Wright
+2  A: 

According to MSDN, it seems that

RedrawWindow( hWnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME );

is what you are looking for.

RDW_FRAME causes any part of the nonclient area of the window that intersects the update region to receive a WM_NCPAINT message. The RDW_INVALIDATE flag must also be specified; otherwise, RDW_FRAME has no effect. The WM_NCPAINT message is typically not sent during the execution of RedrawWindow unless either RDW_UPDATENOW or RDW_ERASENOW is specified.
MerickOWA