Print Page | Close Window

CXTPControl causing CArchiveException

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=21649
Printed Date: 18 June 2025 at 9:47am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPControl causing CArchiveException
Posted By: johnmichael
Subject: CXTPControl causing CArchiveException
Date Posted: 17 May 2013 at 7:06am
Hi

I've been making a patch to following function:

void CXTPControl::DoPropExchange(CXTPPropExchange* pPX)

I created a new Schema version and set it to the current version in XTPPropExchange.inc

...
#define _XTP_SCHEMA_1350 (0x26)


#define _XTP_SCHEMA_CURRENT _XTP_SCHEMA_1350
....

Inside the DoPropExchange function I added:

...

if (pPX->GetSchema() > _XTP_SCHEMA_1340)
{
if ( pPX->IsStoring() )
{
XTP_SHORTCUTMANAGER_ACCEL command;
command.cmd = m_nId;
pCommandBars->GetShortcutManager()->ResolveCommand(&command,true);
CString idstr(command.cmd_name);
PX_String(pPX, _T("ID_TAG"), idstr, _T(""));
}
else if (pPX->IsLoading())
{
CString idstr;
PX_String(pPX, _T("ID_TAG"), idstr, _T(""));
XTP_SHORTCUTMANAGER_ACCEL command;
_snprintf(command.cmd_name,sizeof(command.cmd_name),"%s",idstr);
pCommandBars->GetShortcutManager()->ResolveCommand(&command,false);
m_nId = command.cmd;
}
}
...


The idea being that storing the numerical number for id is pretty bad since the resource.h file that these ids are defined in can change underneath the toolkit invalidating the registry. So instead I look up and store the actual string tag name, and resolve that back into / from the ID when saving and loading.

However, despite adding a new schema for my specific change I am now getting

CArchiveException thrown, and caught the cause parameter indicates 'badindex'. However I placed breakpoints on everywhere in the xt code I could find the CArchiveException being thrown and I could not find anywhere it was being thrown. Looks like its coming from within microsofts platform libraries.

Any help / better understanding on what I could be doing wrong would be great.

I've debugged my new parameter and it is indeed being resolved correctly. to the string and vice versa. However I cannot check the registry values because they appear to be a compressed byte stream of the objects serialised. This is making it all very hard to debug and understand what has gone wrong.

The only thing I can think off is that I've exceeded some capacity limit on the amount of data the control object can serialize however that seems a rather arbitrary reason.

Has anyone got any experience with this?

Many thanks
Jm



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