Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > BOOK: Ivor Horton's Beginning Visual C++ 2005
|
BOOK: Ivor Horton's Beginning Visual C++ 2005
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2005 by Ivor Horton; ISBN: 9780764571978
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 16th, 2007, 01:47 PM
Authorized User
 
Join Date: Feb 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch 18 - Deserialisation problem using dll classes

I was just wondering if anyone else has come across the same deserialisation problem I've found when using the element classes in the dll file. Sketcher seems to work fine with the dll file and will correctly serialise a document. However, when it comes to reading a file back into the program, it claims "Unexpected file format" and looking at the debug trace it's not able to load the appropriate class. It throws "CArchive exception: badClass".

Looking at the list of loaded modules shows that the dll file is amongst them and the program has no problem drawing any of these elements, or serialising them, so I can't understand why it can't seem to find the class.

Looking around on the net I came across this on the Microsoft website, which is exactly the problem I'm having:

http://support.microsoft.com/kb/322621

However, this article was last reviewed in 2005 when it applied to Visual Studio.NET 2002. So the fix for this bug, which was included in service pack 1 for that version, should surely be included in my standard version of Visual Studio 2005 shouldn't it? I've installed SP1 for my version of the program so it should be as up to date as it can be. But the problem still remains.

Has anyone else using Visual Studio 2005 had this problem?

 
Old February 20th, 2007, 02:05 PM
Authorized User
 
Join Date: Feb 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I seem to have found the source of my own problem. Thought I'd post it on here in case anyone else gets frustrated by the same thing.

The problem was that I was using different character sets for the dll project and the Sketcher project. The character set option seems to have a powerful effect on what the linker links to in the project. Looking at the bottom of the 'stdafx.h' file shows that when _UNICODE is defined, the linker links to a different control set. I don't know whether a control set is a different set of MFC or not, but it does seem to change the appearance of the Sketcher program quite substantially. It makes it look much more like XP.

Anyway, the moral of the story is to make sure that in the project properties boxes for both the dll and the program the same character set is selected, whether this is multi-byte or unicode. Just make sure you use the same one for both - that's where I fell down.

I hope this helps someone.

Dan






Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch. 18-4 IE7 solution?? ccreed50 BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 January 9th, 2007 08:35 PM
Ch. 18 Exercise 1, is there a change? horseatingweeds BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 4 November 29th, 2005 05:33 PM
JSP web Development ch-18 struts problem wilson_kwan JSP Basics 0 December 12th, 2004 01:17 PM
JSP web Development ch-18 stuts problem wilson_kwan JSP Basics 0 December 12th, 2004 01:13 PM
Problems with Ch. 18 example tomephillips BOOK: Beginning ASP 3.0 5 November 6th, 2003 08:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.