2.8.1 Referencing Objects in Files (Client Applications)

OLE gives your client application complete control over where you store objects. The most convenient method is to simply store objects directly into existing document files; however, they can also be stored in their own files, in a database, and so on. In any case, modify your existing application's file format to reference an object with a persistent name that your OLESTREAMVTBL functions can use to locate and load an object. (For more information on OLESTREAMVTBL, see Chapter 7, "Callback Functions and Data Structures.")

Since OLE affects your file format, you can isolate the file read and write functions so that adding an OLE call is trivial. When writing a document file, store a small data structure for every object in the document to identify that object and its location. When a document file is loaded and one of these structures is encountered, the name and location of that object is available allowing it to be reloaded.