Using an Object with Persistence

The next thing to do is create a client application that uses the PersistClass1 control. The example on the CD is named PersistClient1. (It's in the Chapter03 directory under the PersistClient1 subdirectory.)

The PersistClient1 application is a simple MFC single-document program. The only code that was added can be found in the view class's constructor and destructor. A few member variables were added to the .h file, and they can be seen in Listing 4.6.

Code Listing 4.6. PersistClient1View.h—Member Variables Used for Persistent Storage
BOOL m_bCoInitialized;
IUnknown *m_pUnknown;
IPersistStreamInit *m_pPersistStreamInit;
IStream *m_pStream;

At runtime, the program goes through a predictable set of steps to ...

Get COM+ Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.