ActiveQt dynamicCall on COM object "Delete()" function: wrong Collection Count after deleting

  • Hi,
    I use ActiveQt to drive a COM application. When trying to delete an Object from a Collection, the object seems to disappear (it's a text with a graphical representation), but checking later the Count parameter of the Object Collection, the value is not correctly updated (same value before deleting the object). Trying to access to the deleted object causes a severe crash of the controlled COM application.
    I tried with different types of object collection and the behaviour is the same.
    Trying to use the Delete() function internally to the COM application trough VBA scripts works fine.

    Anyone has suggestions? Since the method works fine with VBA, I think it's something related with implementation of dynamicCall or ActiveQt implementation.

    The code example:
    QAxObject *DrwObjects = Layout->querySubObject("DrawingObjects"); // COM Object Collection
    DrwObject= DrwObjects->querySubObject("Item(const int&)",1); // Instantiate the object at index 1
    DrwObject->dynamicCall("Delete()"); // Call method to delete the object

    int DrwObjCount = DrwObjects->dynamicCall("Count()").toInt(); // Wrong Count parameter response as if nothing was deleted

    DrwObject->dynamicCall("anymethod()"); // Cause crash of COM application


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.