I’ve made a program with a custom non-client area. Instead of handling WM_NCPAINT, i set the client area size to zero in WM_NCCALCSIZE and then simulate the non-client area by handling WM_NCHITTEST. All painting to the window is handled in WM_PAINT. WM_PAINT works fine when i start the program and whenever the program needs repainted. However, once i minimize the program with a call to ShowWindow(hwnd, SW_MINIMIZE), and then restore the program by clicking on it in the task bar, WM_PAINT no longer works. I’ve checked every function call in WM_PAINT and they all return success, but the window just shows up as black. Anybody have any ideas as to why?
Here’s the code for my WM_PAINT handler:
Here’s the output to the console window:
BeginPaint successful
hdcBuffer is valid
MainWindow->hbmBuffer is valid
hdcMem is valid
So, seeing as every function call in my WM_PAINT handler is returning success, why is my entire window showing up as black?
Turns out the problem was with handling the WM_NCCALCSIZE message to remove the non-client area. Here’s the alternative that i used: