Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > BOOK: Ivor Horton's Beginning Visual C++ 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 16th, 2007, 12:47 PM
Authorized User
 
Join Date: Feb 2007
Location: , , United Kingdom.
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?

Reply With Quote
  #2 (permalink)  
Old February 20th, 2007, 01:05 PM
Authorized User
 
Join Date: Feb 2007
Location: , , United Kingdom.
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

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 07: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 04:33 PM
JSP web Development ch-18 struts problem wilson_kwan JSP Basics 0 December 12th, 2004 12:17 PM
JSP web Development ch-18 stuts problem wilson_kwan JSP Basics 0 December 12th, 2004 12:13 PM
Problems with Ch. 18 example tomephillips BOOK: Beginning ASP 3.0 5 November 6th, 2003 07:25 AM



All times are GMT -4. The time now is 09:55 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.