2.7.7 Changing Window Title on File Open/Save As

Most applications that load files display the loaded filename in the title bar of the application along with the application name. When a user opens a file or renames the file with the Save As command, the name of the file in the title bar should change to reflect the new filename. However, the user interface for server applications requires a different title if the server is editing an embedded object. You can isolate the code for manipulating the title bar by creating a function that takes the main window handle, a pointer to a string containing the document name (or filename), and a pointer to a string containing an object name. In stand-alone (or OLE linking) operation, it can simply pass a NULL as the object name and have this function create the string:

<Application Name> - <Filename>

If the function receives a non-NULL object name, use the object name to indicate that the server is editing an embedded object and change the title bar to the appropriate string:

<Application Name> - <ClassName> in <Filename>

The server DLL provides the human-readable ClassName and Filename for an embedded object through the SetHostNames callback function.