Hi,
I have a new MDI application.
If I do not load the UI state, when I double-click the title it moves from maximized to restore state with no problem.
If U do save the UI state, when I double-click the title it moves from maximized to restore state, the window becomes hidden, or size 0. I can from the task-bar maximze it again, but when in restored more, its size is probably 0.
What I do is this:
1) In the c’tor of the CMainFrame class I do this:
::memset( &m_dataFrameWP, 0, sizeof(WINDOWPLACEMENT) );
m_dataFrameWP.showCmd = SW_HIDE;
2) When saving my UI state on exit I do this:
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
ASSERT( pApp->m_pszRegistryKey != NULL );
ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
ASSERT( pApp->m_pszProfileName != NULL );
ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
VERIFY(
CExtControlBar::ProfileBarStateSave(
this,
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName,
&m_dataFrameWP
));
VERIFY(
g_CmdManager->SerializeState(
m_strProfileName,
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
true
));
g_CmdManager->ProfileWndRemove( GetSafeHwnd() );
3) When loading the UI state I do this:
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
ASSERT( pApp->m_pszRegistryKey != NULL );
ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
ASSERT( pApp->m_pszProfileName != NULL );
ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
VERIFY(
CExtControlBar::ProfileBarStateLoad(
this,
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName,
&m_dataFrameWP
));
VERIFY(
g_CmdManager->SerializeState(
m_strProfileName,
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
false
));
These are the only locations that the
m_dataFrameWP
is mentioned.
What am I doing wrong?
Thanks,
Ron.