ArcObjects Library Reference (Framework)  

IApplication.FindExtensionByCLSID Method

Finds an extension by its CLSID.

[Visual Basic .NET]
Public Function FindExtensionByCLSID ( _
    ByVal extensionCLSID As UID _
) As IExtension
[C#]
public IExtension FindExtensionByCLSID (
    UID extensionCLSID
);

Product Availability

Available with ArcGIS Desktop.

Description

 ExtensionCLSID specifies the unique identifier (UID) of an extension.

 

Remarks

COM coclasses are identified by a globally unique identifier (GUID). There are two formats for the GUID for a coclass: a class ID (CLSID) and a ProgID. The ProgID is a text alias for a CLSID. The UID coclass can be used to represent the GUID of an extension object. You can set the IUID.Value property to either the CLSID or the ProgID.

To find the CLSID and ProgID of an ESRI extension, refer to the following technical document:

ArcGIS Developer Help > Technical Documents > Names and IDs > Extensions

For your custom extensions, the ProgID is a string composed of the name of your project used to make the extension and the class name of the extension. For example if you have a Visual Basic project called MyCustomExt and there is a class module for your extension called clsMyExtension in that project, then the ProgID for this command would be "MyCustomExt.clsMyExtension". To find the CLSID for this command, you could search the system registry for this ProgID.

[C#]

The following code finds the Editor extension using its ProgID.

 public void GetExtByCLSID(IApplication app)
 {
   UID editorID = new UIDClass();
   //the ProgID
   editorID.Value = "esriEditor.Editor";
   //or the CLSID
   //editorID.Value = "{F8842F20-BB23-11D0-802B-0000F8037368}";
   IExtension editor = app.FindExtensionByCLSID(editorID);
 }
[Visual Basic .NET]

The following code finds the Editor extension using its ProgID.

 Sub GetExtByCLSID(app As IApplication)
   Dim editor As IExtension
   Dim editorID As UID = New UIDClass
   'the ProgID
   editorID.Value = "esriEditor.Editor"
   'or the CLSID
   'editorID.Value = "{F8842F20-BB23-11D0-802B-0000F8037368}"
   editor = app.FindExtensionByCLSID(editorID)
 End Sub 

See Also

IApplication Interface | IExtension Interface | IUID Interface

.NET Snippets

Display Extension State on Status Bar | Get Editor from ArcMap | Get Extension

.NET Samples

Subset network evaluators (Code Files: SubsetHelperUI)

.NET Related Topics

Animation | How to find an extension | LocationUI