-
Book Overview & Buying
-
Table Of Contents
Microsoft Visual C++ Windows Applications by Example
By :
Serialization is the process of writing to and reading from a file. When the user chooses to open or save a file, the framework calls the method Serialize of the document class. Every serialized class must have a default constructor and implement the serial macro. If we read an object of an unknown class, which we do in the Tetris and Draw applications, the class must be a subclass of the MFC root class CObject.
We can store or load values in three ways. If we want to read or write a block of memory (such as an array), we can use the CArchive methods Write and Read to transfer a block between the file and the memory. Read takes the maximum number of bytes (the buffer size) to be read to the buffer and returns the number of bytes actually read.
void Write(const void* pBuffer, UINT uSize); UINT Read(void* pBuffer, UINT uMaxSize);
For the basic types of C++, the stream operators are overloaded. Many classes define their own Serialize; in that case, we just have to call it with the...
Change the font size
Change margin width
Change background colour