MFC no blinking hidden window, mfc flashing window
You need to hide the window program today, but if you are in OnInitDialog (), write:
ShowWindow (SW_HIDE );
It is invalid because it is an initialization window function. That is to say, this function is called when the window is not displayed. Therefore, there is no window handle, so it cannot be hidden.
I found a solution on the internet today to solve this problem:
ModifyStyleEx (WS_EX_APPWINDOW, WS_EX_TOOLWINDOW); // remove. SetWindowPos (& wndTop, 0, 0, 0, NULL) from the taskbar );
This method seems to adopt a clever method, first remove the task bar at the bottom of the program, and then set the window position to 0000
You can use either of the following methods to hide the main window of the program when it is started.
ModifyStyleEx (WS_EX_APPWINDOW, WS_EX_TOOLWINDOW); // remove it from the taskbar. WINDOWPLACEMENT wp; wp. length = sizeof (WINDOWPLACEMENT); wp. flags = WPF_RESTORETOMAXIMIZED; wp. showCmd = SW_HIDE; SetWindowPlacement (& wp );
Hope to help ..