发信人: virgo_h()
整理人: wenbobo(2002-12-06 22:20:28), 站内信件
|
【 在 trinket (情静) 的大作中提到: 】
: 当应用程序的状态改变后(如最大化),这时我关掉应用程序。我应该做些
: 什么,以便下次应用程序启动时该应用程序保持上次的状态如最大化。
: 另,在Multidoc的应用程序中,我能否保持ChildForm的状态吗?
: 多谢!
: .......
为主框架增加以下两个消息处理函数
void CFrameWndEx::ActivateFrame(int nCmdShow)
{
if (nCmdShow==-1)
{
CString s = theApp.GetProfileString(m_sName, "WndPL");
if (!s.IsEmpty())
{
sscanf(s, "%d %d %d %d %d %d %d %d %d", &m_wndpl.showCmd,
&m_wndpl.ptMaxPosition.x, &m_wndpl.ptMaxPosition.y,
&m_wndpl.ptMinPosition.x, &m_wndpl.ptMinPosition.y,
&m_wndpl.rcNormalPosition.left, &m_wndpl.rcNormalPosition.right,
&m_wndpl.rcNormalPosition.top, &m_wndpl.rcNormalPosition.bottom);
m_wndpl.length = sizeof(WINDOWPLACEMENT);
m_wndpl.flags = m_wndpl.showCmd==SW_SHOWMINIMIZED?
WPF_RESTORETOMAXIMIZED : WPF_SETMINPOSITION;
SetWindowPlacement(&m_wndpl);
nCmdShow = m_wndpl.showCmd;
theApp.WriteProfileString(m_sName, "WndPL", "");
}
}
CFrameWnd::ActivateFrame(nCmdShow);
}
void CFrameWndEx::OnDestroy()
{
GetWindowPlacement(&m_wndpl);
CFrameWnd::OnDestroy();
CString s;
s.Format("%d %d %d %d %d %d %d %d %d", m_wndpl.showCmd,
m_wndpl.ptMaxPosition.x, m_wndpl.ptMaxPosition.y,
m_wndpl.ptMinPosition.x, m_wndpl.ptMinPosition.y,
m_wndpl.rcNormalPosition.left, m_wndpl.rcNormalPosition.right,
m_wndpl.rcNormalPosition.top, m_wndpl.rcNormalPosition.bottom);
theApp.WriteProfileString(m_sName, "WndPL", s);
}
-- ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.103.129.27]
|
|