MFC no blinking hidden window, mfc flashing window

Source: Internet
Author: User

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 ..

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.