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 General Discussion » SerializeState doesnt work anymore Collapse All
Subject Author Date
Jonas Gauffin May 11, 2007 - 3:26 AM

I’m using the following code to serialize the state. Doesn’t work after upgrade from 2.61 to 2.64

    char path[MAX_PATH];
    SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, SHGFP_TYPE_CURRENT, path);

    string fullPath;
    fullPath = path;
    fullPath.append("\\out.tmp");

    try
    {
        CFile _file(fullPath.c_str(), CFile::modeCreate|CFile::modeWrite|CFile::shareExclusive);
        CArchive ar( &_file, CArchive::store);
        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’) );

        CExtControlBar::ProfileBarStateSerialize(ar, this);
        //g_CmdManager->SerializeState(pApp->m_pszProfileName, ar);
        g_CmdManager->SerializeState(__PROF_UIS_PROJECT_CMD_PROFILE_NAME, ar);
    } // try
    catch( CException * pXept )
    {
        CString sErrorDescription;
        pXept->GetErrorMessage(sErrorDescription.GetBuffer(8192), 8192);
        sErrorDescription.ReleaseBuffer();
        ASSERT( !sErrorDescription.IsEmpty() );
        pXept->Delete();
        MessageBox(
            LPCTSTR(sErrorDescription),
            _T("State save failed"),
            MB_ICONERROR
            );
    } // catch( CException * pXept )
    catch( ... )
    {
        MessageBox(_T("Unknown exception caught"),_T("State save failed"),MB_ICONERROR);
        return "";
    } // catch( ... )

Technical Support May 11, 2007 - 9:50 AM

Your code looks correct. Let us know more details about problem. Which problem exactly occurs during serialization?

Jonas Gauffin May 11, 2007 - 10:50 AM

I’ve saved the state to a file and have then base64 encoded it:
AAAAAAAAAAAAAAAAAAAAAAAAAABDgAAAAAAAAA==

No windows positions/controlbars are restored when I loaded the previously saved state.

Technical Support May 13, 2007 - 6:48 AM

Prof-UIS does no deal with the base64 encoding. We guess, if you serialize the UI state into a text file, then everything should work fine. You can send us a test project that demonstrates the problem so we can help you more efficiently.