Connecting to a third-party Windows program through the OLE mechanism using the GetActiveObject function.

In this case, we can connect to an already open program (for example, to the current Excel spreadsheet).

Call:

int iret = ts_idispatch(int iIDispatchApp,"attach",string appclassname);


Here:


iIDispatchApp - descriptor of the ts_idispatch object where the created program object will be placed;

appclassname - class name of the program object ("Excel.Application" - for Excel);