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::ServerTypehasQAxFactory::SingleInstance, but it seems this is used withbool 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
QAxFactoryand reimplementcreateObject(const QString &key)to create my exported class with singleton pattern. But I have to set static pointer to the single instance to0in deconstruction, oridc.exewill fail with read access violation. Still don't know the reason, but it kind works.