Chapter One internal running mechanism of Windows Program (4) WinMain function (cont.)

Source: Internet
Author: User

4. Display and Update window

To make the window appear, you need to call ShowWindow to display the window.

BOOL ShowWindow (     hwnd hwnd,    int  ncmdshow);

The first parameter is the window handle that is returned when the window is created. The second window specifies the status of the window display. Common states are:sw_hide hides the window and activates other windows,sw_show activates and displays the window in its original position, andsw_showmaximized activates and maximizes the window ;sw_showminimized activates the window and minimizes it;sw_shownormal activates and displays the vault.

Update window

After calling the ShowWindow function, call UpdateWindow to refresh the window. The prototype is as follows:

BOOL UpdateWindow (  hwnd hwnd   //  handle to Window);

Its parameter HWND refers to the handle of the window after the window was created successfully. The UpdateWindow function refreshes the window by sending a WM_PAINT message, and UpdateWindow sends theWM_PAINT message directly to the window procedure function for processing without putting it into the message queue example .

Window creation ends.

  

Chapter One internal running mechanism of Windows Program (4) WinMain function (cont.)

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.