[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2004-11-16
Medium Priority
Last Modified: 2010-05-02

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

Question by:riceman0
  • 3
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 12602265
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.

LVL 14

Accepted Solution

Shiju Sasidharan earned 2000 total points
ID: 12602796
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
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 12652891
   Glad to know that i was helpful
   Thank u riceman0


Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month19 days, 20 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question