Installing an OLE Documents server involves a large number of registry entries, as you might well expect, but you also need to be prepared to handle a previous version of your server or the existence of a server you know how to emulate. In these cases, you'll also need to create the necessary conversion and emulation entries in the registry, not only under your own CLSID but also under those of the other servers. For example, if you install a new version of your own server, you will need to write TreatAs and AutoTreatAs keys under the CLSID of the old server (as described in Chapter 5), depending on whether you overwrote the old server itself. If you install a server that can emulate another server, you can ask whether the user wants to set up an automatic emulation relationship, in which case you can store the necessary registry entries for that other server as well. The user interface guidelines in the OLE Programmer's Reference include additional information about the messages to display to the user in this circumstance.
In addition to the TreatAs and AutoTreatAs keys, a server can also include a registry key named AutoConvertTo that tells functions such as OleLoad to automatically use a different CLSID when loading an object. This key should be accompanied by one named NotInsertable under both the ProgID and the CLSID of the original server. NotInsertable overrides any Insertable keys found there, which means the old object class does not appear in a container's Insert Object dialog box. This is exactly what you want when installing a new version of a server. Over time, it would be silly for the container's Insert Object dialog box to show "Object 1.0," "Object 2.0," "Object 3.0," and so on. NotInsertable allows the latest version to ensure that only it will appear in the list of objects in that dialog.
1 See the file OLE1.WRI on the companion CD for conversion information about OLE 1 versions of compound document servers. |