Google Search

Saturday, January 29, 2011

SDI Serialization 600459– Visual Programming Anna University lab manual download fourth semester

SDI Serialization 600459– Visual Programming Anna University lab manual download fourth semester

Aim:

          To write a VC++ program to implement SDI Serialization

Logical Description:

Process of saving and restoring objects is called serialization. Implement serialization for SDI applications

Algorithm:

1.      Start the process
2.      Create an object for myapp and invoke a method InitInstance( ) which calls mywin( ).
3.      Write a method to write into a file: OnWrite( ) in mywin class.
4.      Write a method to read from a file : OnRead ( ) in the class mywin.
5.      Map these methods to the members created.
6.      Stop the process


Source Code:

// sdiDoc.cpp : implementation of the CSdiDoc class

#include "stdafx.h"
#include "sdi.h"
#include "sdiDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSdiDoc
IMPLEMENT_DYNCREATE(CSdiDoc, CDocument)
BEGIN_MESSAGE_MAP(CSdiDoc, CDocument)
            //{{AFX_MSG_MAP(CSdiDoc)
                        // NOTE - the ClassWizard will add and remove mapping macros here.
                        //    DO NOT EDIT what you see in these blocks of generated code!
            //}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSdiDoc construction/destruction

CSdiDoc::CSdiDoc()
{
            // TODO: add one-time construction code here
}
CSdiDoc::~CSdiDoc()
{
}

BOOL CSdiDoc::OnNewDocument()
{
            if (!CDocument::OnNewDocument())
                        return FALSE;
            dx=50;
            dy=50;
            // TODO: add reinitialization code here
            // (SDI documents will reuse this document)
            return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CSdiDoc serialization
void CSdiDoc::Serialize(CArchive& ar)
{
            if (ar.IsStoring())
            {
                        // TODO: add storing code here
                        ar<<dx<<dy;
                        //ar>>dx>>dy;
            }
            else
            {
                        // TODO: add loading code here
            //ar<<dx<<dy;
            ar>>dx>>dy;
            }
}
/////////////////////////////////////////////////////////////////////////////
// CSdiDoc diagnostics
#ifdef _DEBUG
void CSdiDoc::AssertValid() const
{
            CDocument::AssertValid();
}
void CSdiDoc::Dump(CDumpContext& dc) const
{
            CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSdiDoc commands

0 comments:

Post a Comment