releaseComObject()

Releases the COM object.

Synopsis

int releaseComObject(idispatch obj);

Parameter

Parameter Description
obj isdispatch for the generated COM object, for example, "objXLchart"

Return value

In the case of an error, the function returns 0.

Error

Undefined functions, missing or wrong arguments

Description

Releases the created COM object.

Example

In the following example, start the following script with a CTRL manager. The script has to be copied in <proj_path>/scripts. This opens an Excel sheet with a table and afterwards a diagram that rotates:

main()
{
  idispatch objXL;
  idispatch objXLchart;
  idispatch objXLWorkbooks;
  idispatch objXLWorkbook;
  int i;
  dyn_int array;
  anytype dummy;
  array = makeDynInt(1,2,3);
  objXL = createComObject("Excel.Application");
  objXL.Visible = -1;
  objXLWorkbooks = objXL.Workbooks;
  objXLWorkbook = objXLWorkbooks.Add(dummy);
  releaseComObject(objXLWorkbook);
  releaseComObject(objXLWorkbooks);
  objXL.Range("A1:C1", dummy).Value = array;
  objXL.Range("A1:C1", dummy).Select();
  objXLchart = objXL.Charts.Add(dummy, dummy, dummy, dummy);
  objXLchart.Visible = -1;
  objXLchart.Type = -4100; //xl3DColumn 
  //xl3DColumn is an Excel-defined constant of value = -4100.
  for (i = 30; i<=180; i = i + 10)
  {
    delay(0,800);
    objXLchart.Rotation = i;
  }
  objXL.Visible = 0;
  releaseComObject(objXLchart);
  releaseComObject(objXL);
  delay(20);
}

Assignment

Miscellaneous functions

Availability

UI