Get a ts_idispatch object from a ts_variant object to manage programs or program elements via OLE Windows.

Call:

int iret = ts_variant(int iVariantRange,"get_pdispVal", int iIDispatchActiveCell);

Here:

iVariantRange is a handle to an object of type ts_variant that contains the IDispatch control object.

iIDispatchActiveCell is a handle to an object of type ts_idispatch into which to write this IDispatch control.


Example.

Get the inner control of the current cell in an Excel table.


int iIDispatchExcel;

object("create","ts_idispatch",iIDispatchExcel);

ts_idispatch(iIDispatchExcel,"attach","Excel.Application");  // create dispatcher object 


int iVariantRange;

object("create","ts_variant",iVariantRange);   // create variant object to obtain dispatcher object of the current active cell

int ires = ts_idispatch(iIDispatchExcel, "AutoWrap", iVariantRange, "DISPATCH_PROPERTYGET", "ActiveCell", 0);