Handling the File Update command is done as follows:
Call OleSavedServerDoc.
Set the 'dirty' flag to FALSE.
If the server application is running stand-alone and saves a file, it should call OleSavedServerDoc. If the client application does not accept the update of changes through the call to OleSavedServerDoc, the server application receives OLE_ERROR_UPDATE_CLIENT as an error value (for this error value, the server application should display a messge box telling the user that the client application cannot update the changes until the server application terminates).
The following code shows the call to OleSavedServerDoc when the user chooses the File Update command:
case IDM_UPDATE:
switch (OleSavedServerDoc (docMain.lhdoc))
{
// Can't update client now; display message telling user
// object can't be update until server exits
case OLE_ERROR_CANT_UPDATE_CLIENT:
if (!FailedUpdate(hwnd))
ExitApplication(TRUE);
break;
case OLE_OK:
break;
default:
ErrorBox ("Serious Error: Cannot update.");
}
break;