What is the RIGHT WAY to dispose of COM Server
-
What is the correct method to stop an OLE server? I have a service (A.exe)that creates 3 objects in an OLE full server (B.exe). This causes the server application to be launched. As the various objects are instantiated, they come into existence just fine. When the service stops, it releases the three objects, but the server application doesn't go away. One of the objects in B.exe does have a Stop method that is called by the service as it stops. This is used to stop a bunch of worker threads that live in one of the COM objects. I can cause the program to quit when I A invokes the Stop method in B, but this jerks the objects out from under the service (A) that created them, causing all sorts of ugly things to happen when it tries to release them. Does any one know what the "right way" to do this is? My first thought was that the server .exe would stop when all of its objects were released. This does not appear to be the case (or is something wrong with their destructors, causing them to not release). Should I post a message to the main app's thread? If I do, I still need it to live until the objects have been released (or do I?). Please help, I'm beginning to confuse myself. :confused: Thanks, Bill Thanks for the help, Bill
-
What is the correct method to stop an OLE server? I have a service (A.exe)that creates 3 objects in an OLE full server (B.exe). This causes the server application to be launched. As the various objects are instantiated, they come into existence just fine. When the service stops, it releases the three objects, but the server application doesn't go away. One of the objects in B.exe does have a Stop method that is called by the service as it stops. This is used to stop a bunch of worker threads that live in one of the COM objects. I can cause the program to quit when I A invokes the Stop method in B, but this jerks the objects out from under the service (A) that created them, causing all sorts of ugly things to happen when it tries to release them. Does any one know what the "right way" to do this is? My first thought was that the server .exe would stop when all of its objects were released. This does not appear to be the case (or is something wrong with their destructors, causing them to not release). Should I post a message to the main app's thread? If I do, I still need it to live until the objects have been released (or do I?). Please help, I'm beginning to confuse myself. :confused: Thanks, Bill Thanks for the help, Bill
The server .exe will exit when all instances of all objects are released. Thanks for the help, Bill