Accessing COM Interfaces from ObjectARX

Some APIs are available only as ActiveX, so in order to access them from ObjectARX, you need to use COM from C++. This section explains the two methods you can use to do so. The first method uses Microsoft Foundation Classes (MFC) and the Visual C++ Add Class From Typelib Wizard to read the AutoCAD type library. This type library, acax24enu.tlb, contains the AutoCAD Object Model. The second method uses the QueryInterface API to access COM interfaces directly. This method requires a bit more coding, but doesn't use MFC.

The samples in this section are built as ObjectARX applications. However, the AutoCAD ActiveX Automation interfaces also may be accessed by standard clients that do not use ObjectARX.

Note: Most project frameworks described in this chapter are provided if you use the ObjectARX Wizard. To download and install the wizard, go to AutoCAD Developer Center page.