Once you have implemented your class extension, registered the DLL, and added the DLL to the ESRI GeoObject Class Extensions component category, you will need a way of applying it to new or existing object classes.
When creating new object classes use one of the following methods to apply your class extension:
The GUID of your class extension can be found in the registry under HKEY_CLASSES_ROOT\<Your ProgID>\CLSID. More simply, look for the GUID in the .reg script generated by the ESRI 'Compile and Register' Visual Basic Add-in.
For existing object classes, apply the class extension by calling IClassSchemaEdit::AlterClassExtensionCLSID as shown below.
' QI for the IClassSchemEdit interfaceDimpClassSchemaEditAsIClassSchemaEditSetpClassSchemaEdit = pObjectClass' set an exclusive lock on the classDimpSchLockAsISchemaLockSetpSchLock = pObjectClass pSchLock.ChangeSchemaLock (esriExclusiveSchemaLock)' create the IUID objectDimpCUIDAsIUIDSetpCUID =NewUID pCUID.Value = "PipeValidation.PipeClassExtension"' alter the class extension for the classpClassSchemaEdit.AlterClassExtensionCLSID pCUID,Nothing' release the exclusive lockpSchLock.ChangeSchemaLock (esriSharedSchemaLock)
The IUID interface will automatically convert a ProgID to the corresponding GUID.
You can remove the class extension by passing `Nothing' as the first parameter to IClassSchemaEdit::AlterClassExtensionCLSID. However, if your class extension is faulty, you may not be able to open the object class and so would not be able to QI to IClassSchemaEdit. In this situation use IFeatureWorkspaceSchemaEdit to clear the class extension CLSID.
Note that an object class can only have one class extension. To combine two class extensions, you will need to merge their source code.
See Also About Class Extensions, PipeValidation Class Extension, Timestamper Class Extension Example, Class Extensions and Relationship Classes, and Class Extensions for Annotation and Dimensions.