菜鸟提问

jackgwf 2005-07-05 10:33:23
ShowWindow(hwnd,nCmdshow) 函数的参数nCmdshow是窗口显示形式标识,
有SW_HIDE,SW_SHOWMAXMIZE的选择,我写成
ShowWindow (hwnd, SW_SHOWMINIMIZE) ;为什么报错?
--------------------Configuration: aa - Win32 Debug--------------------
Compiling...
1.cpp
E:\VC++\aa\1.cpp(149) : error C2065: 'SW_SHOWMINIMIZE' : undeclared identifier
Error executing cl.exe.
'SW_SHOWMINIMIZE' 未定义??????不是系统定义好的吗?
...全文
117 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
an_bachelor 2005-07-06
  • 打赏
  • 举报
回复
ShowWindow
The ShowWindow function sets the specified window's show state.

BOOL ShowWindow(
HWND hWnd, // handle to window
int nCmdShow // show state of window
);

Parameters
hWnd
Handle to the window.
nCmdShow
Specifies how the window is to be shown. This parameter is ignored the first time an application calls ShowWindow, if the program that launched the application provides aSTARTUPINFO structure. Otherwise, the first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter. In subsequent calls, this parameter can be one of the following values: Value Meaning
SW_FORCEMINIMIZE Windows NT 5.0 and later: Minimizes a window, even if the thread that owns the window is hung. This flag should only be used when minimizing windows from a different thread.
SW_HIDE Hides the window and activates another window.
SW_MAXIMIZE Maximizes the specified window.
SW_MINIMIZE Minimizes the specified window and activates the next top-level window in the Z order.
SW_RESTORE Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT Sets the show state based on the SW_ flag specified in theSTARTUPINFO structure passed to theCreateProcess function by the program that started the application.
SW_SHOWMAXIMIZED Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE Displays the window as a minimized window. The active window remains active.
SW_SHOWNA Displays the window in its current state. The active window remains active.
SW_SHOWNOACTIVATE Displays a window in its most recent size and position. The active window remains active.
SW_SHOWNORMAL Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.


Return Values
If the window was previously visible, the return value is nonzero.

If the window was previously hidden, the return value is zero.

Remarks
The first time an application calls ShowWindow, it should use the WinMain function's nCmdShow parameter as its nCmdShow parameter. Subsequent calls to ShowWindow must use one of the values in the given list, instead of the one specified by the WinMain function's nCmdShow parameter.

As noted in the discussion of the nCmdShow parameter, the nCmdShow value is ignored in the first call to ShowWindow if the program that launched the application specifies startup information in theSTARTUPINFO structure. In this case, ShowWindow uses the information specified in the STARTUPINFO structure to show the window. On subsequent calls, the application must call ShowWindow with nCmdShow set to SW_SHOWDEFAULT to use the startup information provided by the program that launched the application. This behavior is designed for the following situations:

Applications create their main window by calling CreateWindow with the WS_VISIBLE flag set.
Applications create their main window by calling CreateWindow with the WS_VISIBLE flag cleared, and later call ShowWindow with the SW_SHOW flag set to make it visible.
Windows CE: The nCmdShow parameter does not support the following values:

SW_MAXIMIZE

SW_MINIMIZE

SW_RESTORE

SW_SHOWDEFAULT

SW_SHOWMAXIMIZED

SW_SHOWMINIMIZED

SW_SHOWMINNOACTIVE

QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h.
Import Library: Use user32.lib.

See Also
Windows Overview, Window Functions,CreateProcess, CreateWindow, ShowOwnedPopups,STARTUPINFO, WinMain


xqk 2005-07-06
  • 打赏
  • 举报
回复
haha
an_bachelor 2005-07-06
  • 打赏
  • 举报
回复
暈 你不會看MSDN然後copy過去嗎?難道你一直靠猜?汗!
jackgwf 2005-07-05
  • 打赏
  • 举报
回复
我书写的好多都不能桶过,帮我改改,谢谢
SW_HIDE
SW_SHOWNORMAL
SW_SHOWMINIMIZE
SW_SHOWMAXMIZE
SW_SHOWNOACTIVE
SW_RESTORE
jackgwf 2005-07-05
  • 打赏
  • 举报
回复
晕,原来是书写错,难怪我试了N次都错
chen18s 2005-07-05
  • 打赏
  • 举报
回复
呵呵!楼上的说对了啊
楼主,应该是SW_SHOWMINIMIZED 才对
an_bachelor 2005-07-05
  • 打赏
  • 举报
回复
SW_SHOWMINIMIZED != SW_SHOWMINIMIZE

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧