How to shut down a VB COM server called from VC++ client
Posted on 2004-11-15
What is the proper way to shut down a VB server (and associated forms) from a VC++ client?
We are writing a VC++ application that is started and monitors/commands hardware, collects/stores data and does some number-crunching. We are also writing a VB HMI (an ActiveX EXE) that is created (when the user desires a UI) from the VC++ client using the CoCreateInstance command above. So our VC++ engine is a COM client and our VB HMI is a COM Server. They communicate through events and properties we've set up on the VB/HMI/Server side, and an event sink on the VC++/Engine/Client side.
VB 6.0=GUI=out-of-process COM Server / ActiveX EXE (instantiated by engine)
VC++=engine=standard MFC project and COM client (instantiates the GUI when needed)
Basically we are using the standard interface class module that is created when you use the new app wizard and select "ActiveX EXE", and that creates/loads a few GUI forms that accept user input. When the interface class terminates (per request by the engine), I have code that closes all those GUI forms and sets the pointers to nothing.
Unfortunately the GUI EXE remains in the process list after this is done. I can't seem to find the right sequence to kill my GUI dead.
So, what is the proper way to shut down a VB server (and associated forms) from a VC++ client? Is there something special we have to do from the VC++/client side? We are relatively new at COM.
(High point value because it is a specific/deep question, and I have a feeling we're going to require a little education plus some code snippets. Thanks in advance.)