Call this function to store information about each control bar owned by the frame window.void SaveBarState( LPCTSTR lpszProfileName ) const; ParameterslpszProfileName Name of a section in the initialization file or a key in the Windows registry where state information is stored.
Res This information can be read from the initialization file using LoadBarState. Information stored includes visibility, horizontal/vertical orientation, docking state, and control bar position.
LPCTSTR lpszProfileName 阐述一下参数,英文看不懂
BOOL CMainFrame::DestroyWindow() { CWinApp* pApp = AfxGetApp();
LPCTSTR lpszProfileName
) const;
ParameterslpszProfileName
Name of a section in the initialization file or a key in the Windows registry where state information is stored.
Res
This information can be read from the initialization file using LoadBarState. Information stored includes visibility, horizontal/vertical orientation, docking state, and control bar position.
阐述一下参数,英文看不懂
{
CWinApp* pApp = AfxGetApp();
CString strText;
BOOL bIconic, bMaximized; WINDOWPLACEMENT wndpl;
wndpl.length = sizeof( WINDOWPLACEMENT ); BOOL bRet = GetWindowPlacement( &wndpl );
if ( wndpl.showCmd == SW_SHOWNORMAL ) {
bIconic = FALSE;
bMaximized = FALSE;
}
else if ( wndpl.showCmd == SW_SHOWMAXIMIZED ) {
bIconic = FALSE;
bMaximized = TRUE;
}
else if ( wndpl.showCmd == SW_SHOWMINIMIZED ) {
bIconic = TRUE;
if ( wndpl.flags ) {
bMaximized = TRUE;
}
else {
bMaximized = FALSE;
}
}
strText.Format("%04d %04d %04d %04d",
wndpl.rcNormalPosition.left,
wndpl.rcNormalPosition.top,
wndpl.rcNormalPosition.right,
wndpl.rcNormalPosition.bottom);
pApp -> WriteProfileString( s_profileHeading,
s_profileRect, strText );
pApp -> WriteProfileInt( s_profileHeading,
s_profileIcon, bIconic );
pApp -> WriteProfileInt( s_profileHeading,
s_profileMax, bMaximized );
SaveBarState( pApp -> m_pszProfileName); m_wndCoolBar.SaveToREG( "目录栏" ); pApp -> WriteProfileInt( s_profileHeading,
return CFrameWnd::DestroyWindow();
}void CMainFrame::ActivateFrame(int nCmdShow)
{
CString strText;
BOOL bIconic, bMaximized;
UINT flags;
WINDOWPLACEMENT wndpl;
CRect rect; CWinApp* pApp = AfxGetApp();
if (m_bFirstTime) {
m_bFirstTime = FALSE;
strText = pApp -> GetProfileString( s_profileHeading,
s_profileRect );
if ( !strText.IsEmpty() ) {
rect.left = atoi( ( const char* ) strText );
rect.top = atoi( ( const char* ) strText + 5 );
rect.right = atoi( ( const char* ) strText + 10 );
rect.bottom = atoi( ( const char* ) strText + 15 );
}
else {
rect = s_rectDefault;
} bIconic = pApp -> GetProfileInt( s_profileHeading,
s_profileIcon, 0 );
bMaximized = pApp -> GetProfileInt( s_profileHeading,
s_profileMax, 0 );
if ( bIconic ) {
nCmdShow = SW_SHOWMINNOACTIVE;
if ( bMaximized ) {
flags = WPF_RESTORETOMAXIMIZED;
}
else {
flags = WPF_SETMINPOSITION;
}
}
else {
if ( bMaximized ) {
nCmdShow = SW_SHOWMAXIMIZED;
flags = WPF_RESTORETOMAXIMIZED;
}
else {
nCmdShow = SW_NORMAL;
flags = WPF_SETMINPOSITION;
}
}
wndpl.length = sizeof( WINDOWPLACEMENT );
wndpl.showCmd = nCmdShow;
wndpl.flags = flags;
wndpl.ptMinPosition = CPoint( 0, 0 );
wndpl.ptMaxPosition =
CPoint( -::GetSystemMetrics(SM_CXBORDER),
-::GetSystemMetrics(SM_CYBORDER) );
wndpl.rcNormalPosition = rect;
LoadBarState( pApp -> m_pszProfileName );
SetWindowPlacement( &wndpl );
// 上次关闭程序时显示的视图,如果不是初始视图,转换一下
m_nCurrentView = pApp -> GetProfileInt( s_profileHeading,
}
CFrameWnd::ActivateFrame(nCmdShow);
}