Class Object Initialization Timing Issue from ActiveX Server (EXE Server) in VB
-
I have a timing problem with class objects becoming available to external processes from an ActiveX Server (EXE Server) before the Main() function has completed initialization. The EXE Server is set to be single threaded (i.e. thread pool = 1) and the class objects are all multiuse. The class objects require resources initialized by Main() and thus when the external process creates one of these objects, the object's initialization fails because the required resources are not available. This is apparently a well known problem with ActiveX Servers but I am not in a position to rearchitect or rewrite the code - I am stuck with VB 6. My question is this: how can I control the availability of the class objects until AFTER the EXE Server Main() function has completed? I have read articles which state that you can overcome the problem with calls to CoRegisterClassObject() with the REGCLS_SUSPENDED option and then calling CoResumeClassObjects() when initialization is complete, but no samples on how to do this from VB 6. TIA. ...Steve