程序的初始最大化和防止启动打开空文档的方法
2008-04-20 21:31
381 查看
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的大小
在CChildFrame的PreCreateWindow方法中改变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);
}
(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的大小
在CChildFrame的PreCreateWindow方法中改变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);
}
相关文章推荐
- 防止程序启动两次的方法CreateMutex()
- 当程序用ado的jet4.0方式连接的时候,对于设有access数据库密码的mdb的访问居然报错“无法启动应用程序,工作组信息文件丢失,或是已被其他用户已独占方式打开”,而用odbc方式不报错,小阴沟里翻船,郁闷中然后查文档解决之
- 如何防止一个MDI应用程序在启动时打开一个新(空)文档?(新)
- VC文档程序启动时窗口最大化问题
- 防止程序启动两次的方法CreateMutex()
- 防止程序启动两次的方法CreateMutex()
- MFC单文档程序启动时窗口最大化
- 有独占要求的程序 防止程序启动多次的方法
- 防止程序启动两次的方法CreateMutex()
- 文档对话框程序启动时默认打开文件
- 防止程序启动两次的方法CreateMutex()
- 防止程序启动两次的方法CreateMutex()
- 防止程序启动两次的方法CreateMutex()
- 当程序用ado的jet4.0方式连接的时候,对于设有access数据库密码的mdb的访问居然报错“无法启动应用程序,工作组信息文件丢失,或是已被其他用户已独占方式打开”,而用odbc方式不报错,小阴沟里翻船,郁闷中然后查文档解决之
- 防止程序启动两次的方法CreateMutex()
- 防止程序启动两次的方法CreateMutex()
- 防止程序启动两次的方法CreateMutex()
- 多文档的一些操作:启动时不自动打开一个空文档、启动时主窗体最大化显示、打开一个子窗体时最大化显示
- 防止程序启动两次的方法CreateMutex()
- 防止程序启动两次的方法CreateMutex()