Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Problem with restore size of main frame after state of UI saved. Collapse All
Subject Author Date
Offer Har Feb 3, 2009 - 2:01 AM

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.


 

Technical Support Feb 4, 2009 - 1:21 AM

Please remove the m_dataFrameWP property from the main frame class because it’s should be used in the ActivateFrame() which you didn’t implement. Please find all the CExtControlBar::ProfileBarState***() method invocations and replace their &m_dataFrameWP parameters with NULL. If the problem persists, then please send us main frame’s source code.

Offer Har Feb 4, 2009 - 4:12 AM

I see the problem.


If I want to save also the window’s placement (maximized, restored location etc) what do I need to do?