Terminating VB components.

I create an NT service in Vb,that invokes an ActiveX Exe to do a background process. My problem is, when i stop the service i kill the object of the invoking ActiveX exe by setting it to nothing.(It executes fine, and the instance counter is 0) Even though that object sets to nothing, its still running its process in the back ground. How is this possible. Will this can be solved.
Who is Participating?
TimCotteeConnect With a Mentor Commented:
The reason for this is that you have only terminated the reference to the activeX exe from VB. The exe is still running, you will need to additionally terminate this application. There is some sample code which shows how this can be done in Microsoft KB, article:

HOWTO: Programmatically Close a Separate Application
Article ID: Q176391

Or look into the TerminateProcess API call.
jojiAuthor Commented:
I tried the way given in - HOWTO: Programmatically Close a Separate Application .
In this they are finding the handle of the window using FindWindow Api and then post a message WM_CLOSE to that Window. The FindWindow takes two paramaters (classname,windowname).
Since my program don't have a form (its an Active-x exe object) i can't use the 2nd paramater. And the 1st paramater is the Registered Window ClassName. This is possible only in VC++. I tried giving the class name of my Active-x exe, but still it runs in the backgroud process, after closing it.
jojiAuthor Commented:
Adjusted points to 100
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.

All Courses

From novice to tech pro — start learning today.