| Products: ArcView: VBA, VB6 Platforms: WindowsMinimum ArcGIS Release: 9.0 |
How to use:
- Paste the code into the ArcCatalog VBA environment.
- Find the CLSID of the class extension you have developed. To do this search the registry for the name of your class and copy the CLSID to the clipboard.
- In ArcCatalog, select the appropriate feature class or object class, then run the script
- Paste in the CLSID, and press OK.
- If you enter the string 'Nothing' instead of a CLSID, any current class extension will be cleared. If you press Cancel, the current CLSID will be shown.
Public SubSetClassExtension()DimpGxAppAsIGxApplicationSetpGxApp = ApplicationDimpGxObjectAsIGxObjectIf(pGxObjectIs Nothing)Then SetpGxObject = pGxApp.SelectedObjectEnd If If Not(TypeOfpGxObjectIsIGxDataset)Then Exit Sub DimpGxDatasetAsIGxDatasetSetpGxDataset = pGxObject' QIIf Not(TypeOfpGxDataset.DatasetIsIClass)Then Exit Sub DimpClassAsIClassSetpClass = pGxDataset.DatasetDimstrGUIDAs StringstrGUID = InputBox("Enter GUID", "Set class extension for " & pGxObject.Name)IfLen(strGUID) <> 38AndUCase(strGUID) <> "NOTHING"Then' Show the current extensionDimstrCurrentAs String IfpClass.EXTCLSIDIs Nothing ThenstrCurrent = "Current class extension is nothing"ElsestrCurrent = "Current class extension is: " & pClass.EXTCLSIDEnd IfMsgBox "No valid GUID entered." & vbNewLine & strCurrentExit Sub End If DimpUIDAs NewUIDIfUCase(strGUID) = "NOTHING"Then SetpUID =Nothing ElsepUID.Value = strGUIDEnd If DimpClassSchemaEditAsIClassSchemaEditSetpClassSchemaEdit = pClassDimpSchemaLockAsISchemaLockSetpSchemaLock = pClassSchemaEdit pSchemaLock.ChangeSchemaLock esriExclusiveSchemaLock pClassSchemaEdit.AlterClassExtensionCLSID pUID,NothingpSchemaLock.ChangeSchemaLock esriSharedSchemaLock MsgBox "Class extension changed for " & pGxObject.NameEnd Sub
