Question

I'm using VB.NET for a web-application that starts some process using CreateObject, like this:

Dim AVObject = CreateObject("avwin.application")

After all is done everything get closed down en stopped using the proper release functions, however, for some reason the process remains.

Is there some way in which I can get the process id of the started process, in order to explicitly kill it just before termination?

Thanks

Was it helpful?

Solution

I never come across a specific solution to this problem, but logically I will create a workaround using below pseudo logic (I think it should work in a controlled environment)

  • Wrap the CreateObject in say CustomCreateObject(...)
  • In the method implements below in the same sequence
  • Call System.Diagnostics.Process.GetProcessesByName(nameOfYourProcess), stores all the process ids
  • Call CreateObject (...)
  • Call GetProcessesByName again and now get the new list of process ids
  • Process id that is in the later list and not in the first one, will be the one you are after. Return that so that the caller know the process id to monitor.

OTHER TIPS

After all is done everything get closed down en stopped using the proper release functions, however, for some reason the process remains.

Have you tried to force a GC or called ReleaseCOMObject() method?

Best

Adriano

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top