如何让MFC窗口启动时最大化

这两天在网上搜了好多,都不行,因为都是同一篇文章的转载,于是只好自己慢慢摸索。终于,黄天不负苦心人。

只需将App类InitInstance()函数中m_pMainWnd->ShowWindow()的参数改为SW_SHOWMAXIMIZED即可。

微软MSDN网页中有相关介绍:

MFC Library Reference 

CWnd::ShowWindow

Sets the visibility state of the window.

BOOL ShowWindow(
   int nCmdShow 
);
Parameters
nCmdShow

Specifies how the CWnd is to be shown. It must be one of the following values:

  • SW_HIDE   Hides this window and passes activation to another window.
  • SW_MINIMIZE   Minimizes the window and activates the top-level window in the system's list.
  • SW_RESTORE   Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position.
  • SW_SHOW   Activates the window and displays it in its current size and position.
  • SW_SHOWMAXIMIZED   Activates the window and displays it as a maximized window.
  • SW_SHOWMINIMIZED   Activates the window and displays it as an icon.
  • SW_SHOWMINNOACTIVE   Displays the window as an icon. The window that is currently active remains active.
  • SW_SHOWNA   Displays the window in its current state. The window that is currently active remains active.
  • SW_SHOWNOACTIVATE   Displays the window in its most recent size and position. The window that is currently active remains active.
  • SW_SHOWNORMAL   Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position.
Return Value

Nonzero if the window was previously visible; 0 if the CWnd was previously hidden.

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值