I created a program that, by the way, resizes the console window and removes the window borders from it (basically, setting the window style of WS_POPUP).
Now the application runs on my computer without any problems, but when I run the code on another computer (or in VirtualBox), I get some funky crashes.
Here is an image that shows these glitches that I'm talking about: 
These glitches appear if the user has moved / opened the window on top of the console window, and then again returned the console window to the top.
Naturally, I thought that the easiest way to get rid of this problem is to make the console window always on top, but this did not help, because now the glitches just take their βbackgroundβ from what was there before the new window was moved / opened from above (or rather below) in the console window.
It seems that the glitches are somehow cached / stored somewhere and do not notice that the window has been resized.
GetClientRect(hWnd, &rClnt); rClnt.top += 1; rClnt.bottom -= 2; rClnt.right -= 1; SetWindowRgn(hWnd, CreateRectRgnIndirect(&rClnt), 1); SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP); exStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE); exStyle &= ~WS_EX_CLIENTEDGE; SetWindowLongPtr(hWnd, GWL_EXSTYLE, exStyle); BringWindowToTop(hWnd); SetWindowPos(hWnd, HWND_TOPMOST, ((rScr.right / 2) - rWnd.right / 2) - 1, (rScr.bottom / 2) - rWnd.bottom / 2, 0, 0, SWP_FRAMECHANGED | SWP_DRAWFRAME | SWP_NOSIZE);
user1219742
source share