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

CXTPControl causing CArchiveException

 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 causing CArchiveException
    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
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.031 seconds.