"Reprint" ShowWindow function

Source: Internet
Author: User

ShowWindowof theAPIA function is a display form, but it differs in the first call and subsequent calls. The first call, its input parametersnCmdShowis required to enterWinMainIn the function .nCmdShowThe number of references, not other parameters. function declarations such as the following:WinuserapiBOOLWINAPIShowWindow (__in hwnd hwnd,__in int ncmdshow); hWndis the handle to the form. nCmdShowis the state that the form displays. The values that may be set are as follows:sw_forceminimizeis to force the form to be minimized, primarily using other threads that are not on the main thread of the form. Sw_hideis to display the form as hidden. sw_maximizeis to display the form as maximized. sw_minimizeis to display the form as minimized. Sw_restoreis to restore the form display from the task. Sw_showis the active form for the current form, and is displayed as the current size and position. Sw_showdefaultis the value of the form that is displayed when the process is created. sw_showmaximizedis the active form for the current form, and the display is maximized. sw_showminimizedis the active form for the current form, and the display is minimized. sw_showminnoactiveis to display the form as minimized, but not to activate it as the current form. Sw_shownais displayed as the current size and position, but does not activate it as the current form. sw_shownoactivateis to display the current form, but not activate it as the current form. Sw_shownormalis to display the current form, but the form is minimized or maximized when the form is restored to its original size and position. The real proportions of the call to this function are as follows:#001 BOOL InitInstance (hinstance hinstance, int ncmdshow)#002 {#003 hwnd hwnd;#004#005 hInst = hinstance;//Save the instance handle to the global variable. #006#007 hWnd = CreateWindow (Szwindowclass,#008 SzTitle,#009 Ws_overlappedwindow,#010 Cw_usedefault,#011 0,#012 Cw_usedefault,#013 0,#014 NULL,#015 NULL,#016 hinstance,#017 NULL);#018#019 if (!hwnd)#020 {#021 return FALSE;#022}#023#024 ShowWindow (hWnd, ncmdshow);#025 UpdateWindow (hWnd);#026#027//#028//Cai Junsheng2007/07/14#029//Show form Test. #030 MessageBox (null,_t ("maximized"), _t ("Test"), MB_OK);#031#032//displays the form as maximized. #033 ShowWindow (hWnd, sw_showmaximized);#034#035#036 MessageBox (null,_t ("Original Location"), _t ("Test"), MB_OK);#037#038//The Display form is the original location. #039 ShowWindow (hWnd, SW_SHOWNORMAL);#040#041#042 return TRUE;#043}in section -First call this function to display the form state of the creation process. Section -The line displays the form as maximized. Section theThe line shows the original state of the form.

so you can master the ShowWindow the use of functions.

"Provenance" http://blog.csdn.net/linhong34/archive/2007/08/01/1721829.aspx

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.