Showwindow and Parameters

Source: Internet
Author: User

[Dllimport ("user32.dll", entrypoint = "showwindow", charset = charset. Auto)]
Public static extern int showwindow (intptr hwnd, int ncmdshow );

Function: This function sets the display status of the specified window.
Parameters:
Hwnd: Window handle.

Ncmdshow: specifies how the window is displayed. If the program sending the application provides the startupinfo structure, this parameter is ignored when the application calls showwindow for the first time. Otherwise, when the showwindow function is called for the first time, the value should be the ncmdshow parameter in the winmain function. In subsequent calls, this parameter can be one of the following values:

Sw_forceminimize: minimizes the window in windownt5.0, even if the thread that owns the window is suspended. This parameter is used when windows are minimized from other threads.

Sw_mioe: Hide the window and activate other windows.

Sw_maximize: Maximize the specified window.

Sw_minimize: minimizes the specified window and activates the next top-level window in the Z sequence.

Sw_restore: activated and displayed in the window. If the window is minimized or maximized, the system restores the window to its original size and position. The flag should be specified by the application when the minimal window is restored.

Sw_show: the original size of the window is used to activate and display the window.

Sw_showdefault: The display status is set based on the sw_flag flag specified in the startupinfo structure. The startupinfo structure is passed to the CreateProcess function by the program that starts the application.

Sw_showmaximized: Activate the window and maximize it.

Sw_showminimized: activates the window and minimizes it.

Sw_showminnoactivate: the window is minimized, and the activation window remains active.

Sw_showna: display the window in the original status. The activation window remains active.

Sw_shownoactivate: displays the last window size and status. The activation window remains active.

Sw_shownomal: Activate and display a window. If the window is minimized or maximized, the system restores it to the original size and size. The application should specify this flag when displaying the window for the first time.

Return Value: if the window is visible before, the return value is non-zero. If the window is hidden before, the return value is zero.

Note: When the application calls showwindow for the first time, the ncmdshow parameter of the winmain function should be used as its ncmdshow parameter. When you call the showwindow function, you must use a given value in the list instead of the value specified by the ncmdshow parameter of the winmain function.

Public const sw_hide = 0
Public const sw_shownormal = 1
 
Public const sw_showminimized = 2
Public const sw_showmaximized = 3
Public const sw_maximize = 3
Public const sw_shownoactivate = 4
Public const sw_show = 5
Public const sw_minimize = 6
Public const sw_showminnoactive = 7
Public const sw_showna = 8
Public const sw_restore = 9

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.