程序的初始最大化和防止启动打开空文档的方法

1.MultiDoc 程序的初始最大化和防止启动打开一个View的方法

(1) 防止启动打开一个View的方法,在App类的InitInstance方法加入以下代码:

   // Parse command line for standard shell commands, DDE, file open

   CCommandLineInfo cmdInfo;

  //防止启动打开一个View的方法

   cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;

   ParseCommandLine(cmdInfo);

 

   // Dispatch commands specified on the command line

   if (!ProcessShellCommand(cmdInfo))

          return FALSE;

 

   // The main window has been initialized, so show and update it.

//程序运行,最大化显示

   m_nCmdShow = SW_MAXIMIZE;

   pMainFrame->ShowWindow(m_nCmdShow);

   pMainFrame->UpdateWindow();

 

(2)改变View的大小

CChildFramePreCreateWindow方法中改变cs属性;

BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)

{

   // TODO: Modify the Window class or styles here by modifying

   //  the CREATESTRUCT cs

     cs.cx = 300;

     cs.cy = 300;

   if( !CMDIChildWnd::PreCreateWindow(cs) )

          return FALSE;

 

   return TRUE;

}

 

 

 

2.Single Doc文件程序的初始最大化

CMainFrame添加ActivateFrame虚函数,加入代码:nCmdShow = SW_MAXIMIZE;即可

void CMainFrame::ActivateFrame(int nCmdShow)

{

   // TODO: Add your specialized code here and/or call the base class

   nCmdShow = SW_MAXIMIZE;

   CFrameWnd::ActivateFrame(nCmdShow);

}

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值