4.6.2 Changing the File Menu for Embedded Objects

Like the changes to the window title bar, changes to the File menu are quite easy to implement; the File menu need only change in three places (using the ModifyMenu API) when the server application starts editing an embedded object.

Change the "Save" command to "Update <Client Document>." The "<Client Document>" string is the name given in the OLESERVERDOC SetHostNames callback function.

Change the "Save As..." command to "Save Copy As..."

Change the "Exit" command to "Exit & Return to <Client Document>."

When the focus in an MDI server application changes from a window that had activated an embedded object to a window that is editing a document that does not contain an embedded object, the File menu's "Update" command should change back to "Save" and the "Save Copy As..." command should change back to "Save As..." For an MDI server application, the changes to the File menu should only be made when the active document is editing an embedded object.

SRVRDEMO.EXE makes these menu changes using the UpdateFileMenu function shown in the preceding code example.