Re: How to serialize Mfc template dialog class ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I find it stunning how often you declare something as "unusable" or "worthless" or "needlessly complex", when that very thing you criticize is something I have been using successfully for years. I think you quite often judge quickly and give up too easily.

Joseph M. Newcomer wrote:
It wouldn't make sense to serialize a dialog. Nor does it make much sense to have a
dialog class created by a template. If you need some kind of templating, it most likely
applies to data *within* the dialog, and therefore you should create a templated class to
hold your data.

I do not believe you can derive a template class from CObject, because of how the macros
work. You did not say which version of VS you are using.

Generally, MFC serialization is among the worst possible ways to implement persistent
memory of information. It is needlessly complex (in spite of the claims otherwise)
because it is exceptionally fragile under what is known as "schema migration". Change
anything in the class, such as adding or deleting a member variable, or changing its type,
and all existing files are rendered unreadable. I would suggest avoiding it entirely. I
tend to use either simple text files or XML files if I have complex structured data. I
have studiously avoided using MFC serialization for 15 years (we had implemented the
equivalent of MFC serialization in 1977 and knew exactly what was wrong with it, and when
I saw MFC serialization, all I could do was shake my head and say "how could they DO
something this bad when we knew almost 20 years ago [I looked at this in 1996] that it
cannot work". Our sollution, by the way, was to have an XML file we wrote out, along with
the binary. If the binary file had a different version than the program could read, we
ignored the binary form of the file and read the XML form [yes, I helped invent XML in
1977; it looked much better than the current XML, was more powerful, and the second
generation, done ca. 1980, and known as IDL, was even better. But it was not yet time to
build steam engines, so our work was ignored and then badly reinvented by the XML
designers. We documented our work in a 1989 book].
joe

On Fri, 4 Sep 2009 02:06:01 -0700, Elizabeta <Elizabeta@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Hello

How can I serialize Mfc template dialog class , I can't use DECLARE_SERIAL and IMPLEMENT_SERIAL for this . I noticed that IMPLEMENT_SERIAL_T macro exist, but it is not documented and there is no corresponding DECLARE_SERAIL_T.

Thanks
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: How to serialize Mfc template dialog class ?
    ... MFC serialization used, there have either been serious problems or amazing complexity. ... chnages are easy, but complex structures are hard to maintain long-term, particularly when ... I do not believe you can derive a template class from CObject, ... tend to use either simple text files or XML files if I have complex structured data. ...
    (microsoft.public.vc.mfc)
  • Re: How to serialize Mfc template dialog class ?
    ... I do not believe you can derive a template class from CObject, ... MFC serialization is among the worst possible ways to implement persistent ... tend to use either simple text files or XML files if I have complex structured data. ...
    (microsoft.public.vc.mfc)
  • Re: edit xml file.
    ... should know that Nokogiri is widely considered the best Ruby XML library ... you might consider using Nokogiri over REXML. ... don't think it is a good idea to modify your template. ... If you decide you want to do that, the Sinatra code below should talk about ...
    (comp.lang.ruby)
  • Re: MSSQLError overwriting returning XML
    ... results of the template to strip out the errors. ... > MSSQLError processing instructions but to also return a XML that I'm ... > some tables and the stored procedure will always return some other data ... > generates a new value for AuthNo and adds it into the table again. ...
    (microsoft.public.sqlserver.xml)
  • Re: tab and return in mail merge
    ... I don't know about Content Control facilities and I don't see where the .net ... My "template" is saved in Word XML format. ... I am wondering what you mean by a "template" in CRM. ...
    (microsoft.public.word.vba.general)