it should still fix some issue If you're writing a console program and you want to disconnect your program from the console it started with, then call FreeConsole. Ultimately, you probably won't be satisfied with what that function really does, but that's the literal answer to the question you asked. If you're writing a program that you never want to have a console in the first place, then configure your project so that it is not a console program. "Consoleness" is a property of the EXE file. The OS reads that setting and decides whether to allocate a console for your program before any of your code ever runs, so you can't control it within the program. Sometimes a non-console program is called a "GUI program," so you might look for a choice between "console" and "GUI" in the configuration options of your development environment. Setting it to GUI doesn't require that you have any user interface at all, though. The setting merely controls whether your program starts with a console.
about custom window title bar in win32 programming
To fix the issue you can do AFAIK during processing of WM_NCPAINT the client area isn't painted. Did you mean title bar (instead of client area)? If so - it seems you should process the WM_NCPAINT in your custom way, doing what's necessary.
Register window before creating it in win32 programming
I think the issue was by ths following , Your window proc is presumably responding to WM_DESTROY by calling PostQuitMessage. Which brings the process down. You should only call PostQuitMessage when the main window closes. You can do this from a shared window procedure so long as you discriminate using the window handle that is handling the WM_DESTROY message.
What exactly is a top-level window in win32 programming?