Thanks,
I tried it, but get a Exeption in CArchive::WriteClass(pRTC) on line
if (pClassRef->m_wSchema == 0xFFFF)
{ ... AfxThrowNotSupportedException(); ... }
It seems that the Schema is -1.
I noted that the Paintmanager classes are not implemented as IMPLEMENT_SERIAL see:
IMPLEMENT_DYNCREATE( CExtPaintManager, CObject )
IMPLEMENT_DYNCREATE( CExtPaintManagerXP, CExtPaintManager )
IMPLEMENT_DYNCREATE( CExtPaintManagerOffice2003, CExtPaintManagerXP )
IMPLEMENT_DYNCREATE( CExtPaintManagerOffice2003NoThemes, CExtPaintManagerOffice2003 )
IMPLEMENT_DYNCREATE( CExtPaintManagerStudio2005, CExtPaintManagerOffice2003 )
IMPLEMENT_DYNCREATE( CExtPaintManagerNativeXP, CExtPaintManager )
IMPLEMENT_DYNAMIC( CExtPaintManagerOffice2007_Impl, CExtPaintManagerOffice2003 )
IMPLEMENT_DYNCREATE( CExtPaintManagerOffice2007_R1, CExtPaintManagerOffice2007_Impl )
IMPLEMENT_DYNCREATE( CExtPaintManagerOffice2007_R2_LunaBlue, CExtPaintManagerOffice2007_Impl )
IMPLEMENT_DYNCREATE( CExtPaintManagerOffice2007_R2_Obsidian, CExtPaintManagerOffice2007_Impl )
Should’t that be the case ??
Even when I change the Schema to non-zero (break-point and manual change), the WriteClass continues, but my MemFile is still empty.
Any suggestions ?
My full code is:
void CJecadApp::LoadRegTheme() // Called from InitInstance
{ // Load the previous Theme
CMemFile MFile;
CExtCmdManager::FileObjFromRegistry(MFile, _T("Theme"));
if (MFile.GetLength() != 0)
{ // We seem to have a stored Theme setting
CArchive ar(&MFile, CArchive::load);
CExtPaintManager * pPM = g_PaintManager.GetPM();
CRuntimeClass * pRTC = pPM->GetRuntimeClass();
pRTC = ar.ReadClass(pRTC);
g_PaintManager.InstallPaintManager(pRTC);
}
}
void CJecadApp::StoreRegTheme() // Called from ExitInstance
{
CExtPaintManager * pPM = g_PaintManager.GetPM();
CRuntimeClass * pRTC = pPM->GetRuntimeClass();
CMemFile MFile;
CArchive ar(&MFile, CArchive::store);
ar.WriteClass(pRTC);
CExtCmdManager::FileObjToRegistry(MFile, _T("Theme"));
}