Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPControl not saving with _XTP_SCHEMA_CURRENT
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPControl not saving with _XTP_SCHEMA_CURRENT

 Post Reply Post Reply
Author
Message
johnmichael View Drop Down
Groupie
Groupie


Joined: 30 June 2009
Location: United Kingdom
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote johnmichael Quote  Post ReplyReply Direct Link To This Post Topic: CXTPControl not saving with _XTP_SCHEMA_CURRENT
    Posted: 17 May 2013 at 11:00am
Hi,


Is blowing up, so the control that is serialised to the registry when being loaded back in still has

_XTP_SCHEMA_1340

instead of my new schema

_XTP_SCHEMA_1350

even thought 

#define _XTP_SCHEMA_CURRENT _XTP_SCHEMA_1350

So I decided to do some digging I changed the actual value for 

#define _XTP_SCHEMA_1340 (0x25)

to 

#define _XTP_SCHEMA_1340 (0x27)

and my new define to 


#define _XTP_SCHEMA_1350 (0x28)


#define _XTP_SCHEMA_CURRENT _XTP_SCHEMA_1350

resaved a clean registry and reloaded 

on save the m_nSchema is definitly 40 = 0x28

however on loading the control back from the registry it still = 37 even though I changed the old 

#define _XTP_SCHEMA_1340 (0x25) to be 39 

What have I missed? why is the schema value not the new schema number when I load from the registry? What is changing it?

If I ignore the schema being wrong or hard code it back to my correct schema number it serialises my new data value correctly and doesnt throw any issues.

Looks like there is a hard coded issue somewhere?

Any help?
 
Back to Top
johnmichael View Drop Down
Groupie
Groupie


Joined: 30 June 2009
Location: United Kingdom
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote johnmichael Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2013 at 12:01pm
Hi,

So I found that if I detect the borqued schema number at the point is serialises the runtime class, I can tweak that back to the correct version and then serialise without error. Everything works great. However this is not a good fix because it would inevitably break if someone had the old schema version and serialised it with my new code. 



BOOL CXTPPropExchangeArchive::ExchangeRuntimeClass(LPCTSTR /*pszPropName*/, CRuntimeClass*& pClass, CRuntimeClass* pDefaultClass)
{
if (!OnBeforeExchange())
return FALSE;

if (!IsLoading())
{
m_ar.WriteClass(pClass);
}
else
{
pClass = m_ar.ReadClass(pDefaultClass, &m_nSchema);

if (m_nSchema == 37)
m_nSchema = _XTP_SCHEMA_CURRENT;

if (!pClass)
return FALSE;
}
return TRUE;
}

Q: How and Why is the schema ending up as a 'hardcoded' 37 when from my debugging _XTP_SCHEMA_CURRENT and those controls m_nSchema  is 40 when the objects are saved to the archive?



Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.