COM

COM stands for Component Object Model and lets application expose its object for other applications.

Axapta can use other Application objects via COM class or ActiveX control (download small small demo ). Other application can use axapta through COM with Axapta Business Connector (see developer's documentation)

For ease of use you can generate wrapper for the com type library: Main Menu\Tools\Development toolz\Wizard\COM class wizard

Look in the AOT for documentation of the following classes:
 * \System Documentation\Classes\COM
 * \System Documentation\Classes\COMDispFunction
 * \System Documentation\Classes\COMEnum2Object
 * \System Documentation\Classes\COMEnum2Variant
 * \System Documentation\Classes\COMError
 * \System Documentation\Classes\COMVariant

Mapping COM classes to the axapta classes
These classes map COM (more properly automation objects) to the Axapta objects using the following rules:

x.test('1') becomes x.test('1')
 * methods are methods of axapta

x.test='1' becomes x.test('1')
 * properties are methods of axapta

y=x.test(1) becomes Com collection=x.test; Com y=collection.Item(1); x.test.test becomes Com y=x.test; y.test;
 * collections are properties which return collection objects
 * you can not call methods of return values of other methods directly. Use intermediate variable instead to help Axapta to detect return value types (by the way, if you use Object class you must do the same way)

Handling COM errors
void setInfo {   COMError errorCom; try {            object.SetInfo; }       catch (Exception::Error) {           errorCom = object.error; if (errorCom) throw error(strFmt("Error %1 ('%2')", errorCom.number, WinApi::formatMessage(errorCom.number))); else throw Exception::Error;

} }