How to shut down a VB COM server called from VC++ client



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.

In brief:

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.)


riceman0Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shiju SasidharanAssoc Project ManagerCommented:
Hi riceman0
    It is better to raise events from the ActiveXExe regularly to Client application so that u can trace what is actully happening in side the server object. i dont know VC++, but i am sure u can terminate the server object u created from ur Client MFC application properly unless all the internal actions in the server object (ACtiveX Exe) have been completed. Thats y i suggested to keep track of internal process in ActiveXExe regulary and make sure that all internal process are being stopped. that is, if u had written functions inside ActvXExe to terminate actions call them before terminating the server object from VC application.

  one question , whether the Serverobject is created by u? that is u have the source code with u so that u can make changes.

;-)
Shiju    
0
Shiju SasidharanAssoc Project ManagerCommented:
Hi riceman0

  simply saying , try to write  functions inside VB Server component to unload all forms and to stop other activities and make use of these function calls from VC application before deleting instance of VB server component from VC Client application
 i hope u got the idea
;-)
Shiju
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shiju SasidharanAssoc Project ManagerCommented:
Hi
   Glad to know that i was helpful
   Thank u riceman0

;-)
Shiju
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.