Print Page | Close Window

CXTPControl not saving with _XTP_SCHEMA_CURRENT

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=21650
Printed Date: 18 June 2025 at 9:47am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPControl not saving with _XTP_SCHEMA_CURRENT
Posted By: johnmichael
Subject: CXTPControl not saving with _XTP_SCHEMA_CURRENT
Date Posted: 17 May 2013 at 11:00am
Hi,

So I think I found out why this  http://forum.codejock.com/forum_posts.asp?TID=21649&title=cxtpcontrol-causing-carchiveexception" rel="nofollow - http://forum.codejock.com/forum_posts.asp?TID=21649&title=cxtpcontrol-causing-carchiveexception

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?
 



Replies:
Posted By: johnmichael
Date 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?






Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net