Important: Please read the Qt Code of Conduct -

how to implement in-process axserver as singleton

  • I am building an activex control dll running in IE with qt axserver. Is there a way to implement the exported class as singleton, so when IE page got refresh, it won't create new instance?

    I find enum QAxFactory::ServerType has QAxFactory::SingleInstance, but it seems this is used with bool QAxFactory::startServer(QAxFactory::ServerType type = MultipleInstances) which is only effective with out-of-process activex control.

    Is there something equivalent for in-process activex control?

    UPDATE I found a way to achieve it: Using subclass of QAxFactory and reimplement createObject(const QString &key) to create my exported class with singleton pattern. But I have to set static pointer to the single instance to 0 in deconstruction, or idc.exe will fail with read access violation. Still don't know the reason, but it kind works.

Log in to reply