Since implementing OLE affects most File menu commands and may require loading or saving a file outside the context of those commands, you can isolate the functions that read and write the data structures to a file. The OLESERVER callback function CreateFromTemplate, for example, requires that you open and read the contents of a file as the initial contents of a new document in the server application. The server application may already include functions that create a new document from a file, but CreateFromTemplate also requires that the file be used for initial data and that the file not be kept open.
Also, you can create a single function from which you prompt the user to save changes in a document before creating a new document, opening a new file, or exiting the application. Normally, this function displays a message box and, depending on whether the user chooses Yes, No, or Cancel, it either saves the file, continues with the operation (New/Open/Exit), or cancels the operation.
When starting a server application to edit an embedded object, the text in this message box will change; centralizing this code now simplifies the necessary changes for OLE implementation. For more information on OLE user interface guidelines, see Chapter 3, "The OLE User Interface."