I am trying to connect to an application that exposes a COM interface. My VbScript Code looks like this:
Set App = CreateObject( "Starter.Application")
Set Measurement = App.Measurement
WScript.ConnectObject App, "App_"
If Measurement.Running Then
Measurement.Stop
End If
This allows me to Control variables within the Starter-Application.
What I want to do now is connect another application to the same COM interface, to influence other variables within the application. Naturally, when I start the application using the CreateObject command, I get a new instance of the application.
How can I connect to the same instance that was already created with another script?
Q: How can i connect to the same instance that was already created with another script?
A: Make your COM server an "out of process" .exe:
https://msdn.microsoft.com/en-us/library/Aa242100%28v=VS.60%29.aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683835%28v=vs.85%29.aspx
NOTE:
If your COM/ActiveX application is already out of process - but doesn't "share" state like you need, you can create your own VB6 out of process exe to "wrap" the original application.