ShowWindow Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long 说明 控制窗口的可见性(在vb里使用:针对vb窗体及控件,请使用对应的vb属性) 返回值 Long,如窗口之前是可见的,则返回TRUE(非零),否则返回FALSE(零) 参数表 参数 类型及说明 hwnd Long,窗口句柄,要向这个窗口应用由nCmdShow指定的命令 nCmdShow Long,为窗口指定可视性方面的一个命令。请用下述任何一个常数
WM_SHOWWINDOW Notification--------------------------------------------------------------------------------The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.A window receives this message through its WindowProc function. SyntaxWM_SHOWWINDOW WPARAM wParam LPARAM lParam;
ParameterswParam Specifies whether a window is being shown. If wParam is TRUE, the window is being shown. If wParam is FALSE, the window is being hidden. lParam Specifies the status of the window being shown. If lParam is zero, the message was sent because of a call to the ShowWindow function; otherwise, lParam is one of the following values. SW_OTHERUNZOOM The window is being uncovered because a maximize window was restored or minimized. SW_OTHERZOOM The window is being covered by another window that has been maximized. SW_PARENTCLOSING The window's owner window is being minimized. SW_PARENTOPENING The window's owner window is being restored. Return ValueIf an application processes this message, it should return zero. ResThe DefWindowProc function hides or shows the window, as specified by the message. If a window has the WS_VISIBLE style when it is created, the window receives this message after it is created, but before it is displayed. A window also receives this message when its visibility state is changed by the ShowWindow or ShowOwnedPopups function. The WM_SHOWWINDOW message is not sent under the following circumstances: When a top-level, overlapped window is created with the WS_MAXIMIZE or WS_MINIMIZE style. When the SW_SHOWNORMAL flag is specified in the call to the ShowWindow function.
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private Const SW_SHOW = 5Private Sub Command1_Click() ShowWindow 控件句柄, SW_SHOW End Sub
ShowWindow hWnd, 0 '隐藏 ShowWindow hWnd, 5 '显示
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private Const SW_SHOW = 5 Private Const SW_HIDE= 0 Private Sub Command1_Click() ShowWindow Form1.hWnd, SW_HIDE End Sub 0 是隐藏,5是显示
控制窗口的可见性(在vb里使用:针对vb窗体及控件,请使用对应的vb属性)
返回值
Long,如窗口之前是可见的,则返回TRUE(非零),否则返回FALSE(零)
参数表
参数 类型及说明
hwnd Long,窗口句柄,要向这个窗口应用由nCmdShow指定的命令
nCmdShow Long,为窗口指定可视性方面的一个命令。请用下述任何一个常数
SW_HIDE 隐藏窗口,活动状态给令一个窗口
SW_MINIMIZE 最小化窗口,活动状态给令一个窗口
SW_RESTORE 用原来的大小和位置显示一个窗口,同时令其进入活动状态
SW_SHOW 用当前的大小和位置显示一个窗口,同时令其进入活动状态
SW_SHOWMAXIMIZED 最大化窗口,并将其激活
SW_SHOWMINIMIZED 最小化窗口,并将其激活
SW_SHOWMINNOACTIVE 最小化一个窗口,同时不改变活动窗口
SW_SHOWNA 用当前的大小和位置显示一个窗口,不改变活动窗口
SW_SHOWNOACTIVATE 用最近的大小和位置显示一个窗口,同时不改变活动窗口
SW_SHOWNORMAL 与SW_RESTORE相同
SyntaxWM_SHOWWINDOW WPARAM wParam
LPARAM lParam;
ParameterswParam
Specifies whether a window is being shown. If wParam is TRUE, the window is being shown. If wParam is FALSE, the window is being hidden.
lParam
Specifies the status of the window being shown. If lParam is zero, the message was sent because of a call to the ShowWindow function; otherwise, lParam is one of the following values.
SW_OTHERUNZOOM
The window is being uncovered because a maximize window was restored or minimized.
SW_OTHERZOOM
The window is being covered by another window that has been maximized.
SW_PARENTCLOSING
The window's owner window is being minimized.
SW_PARENTOPENING
The window's owner window is being restored.
Return ValueIf an application processes this message, it should return zero.
ResThe DefWindowProc function hides or shows the window, as specified by the message. If a window has the WS_VISIBLE style when it is created, the window receives this message after it is created, but before it is displayed. A window also receives this message when its visibility state is changed by the ShowWindow or ShowOwnedPopups function. The WM_SHOWWINDOW message is not sent under the following circumstances:
When a top-level, overlapped window is created with the WS_MAXIMIZE or WS_MINIMIZE style.
When the SW_SHOWNORMAL flag is specified in the call to the ShowWindow function.
Private Const SW_SHOW = 5Private Sub Command1_Click()
ShowWindow 控件句柄, SW_SHOW
End Sub
ShowWindow hWnd, 5 '显示
Private Const SW_SHOW = 5
Private Const SW_HIDE= 0 Private Sub Command1_Click()
ShowWindow Form1.hWnd, SW_HIDE
End Sub
0 是隐藏,5是显示