4.7 Saving and Updating Data

When a server application carries out the File New, File Open, File Save As, and File Save/Update commands, it must inform the server DLL about what is happening to its documents.

In an MDI server application, the New or Open commands do not affect the window containing an embedded object as they simply create a new window. This eliminates the need to prompt the user to update the object. The user can continue to work with the server application after choosing one of these commands; however, when the user closes the server application, the focus does not necessarily return to the client application.

In an SDI server application, the File New and File Open commands break the link between the client application and the document in the server application. In this case, the server application should display a message asking the user whether to update the object in the container document. If the user chooses the Save As command, the server should call the OleRenameServerDoc function. If the user responds to the message by choosing to save changes to the object before renaming the document, the server should call OleSavedServerDoc before calling OleRenameServerDoc.

For embedded objects, choosing the Save As command causes the connection with the client application to be broken, because this command reassociates a document in memory with the specified new file. For linked objects, calling OleRenameServerDoc when the user chooses the Save As command allows the client application to associate the link with the new file.