Hi
I want to start a C# ActiveX Exe with a parameter.
Now, start a WebBrowser. Within Html/javascript I initiate my component
und want to retrieve the parameter from the startet exe.
I have done this in VB6 with new ActiveXObject("name") and all works
correct.
Using C# or Vb.net it works different:
- When the WenBroser calls the Exe, it starts its own process (the 2't
exe is not shown in the Taskmanager, only in ProcessExplorer).
- It return on this problem the empty value
- in the Browser Instance I can use this 2't exe instance (can set and
get new value)
What can I do to get the parameter from the startet exe outside the
browser instance? (the instance with the given paramter)
I have not found how to implement GetObject. this could solve also my
problem.
Sample Javascript code:
var oCorrespondenceControl;
oCorrespondenceControl = new ActiveXObject("AppPort.PortHolder");
oCorrespondenceControl.Display();
Classes of the Project:
Program:
[STAThread]
public static void Main(string[] args)
ActiveXObject.PORT = arg.Trim().Substring(6);
Thread.CurrentThread.SetApartmentState(ApartmentSt ate.STA);
Application.Run();
}
ActiveXObject:
[ProgId("AppPort.PortHolder")]
[ClassInterface(ClassInterfaceType.AutoDual),
ComSourceInterfaces(typeof(ControlEvents))] //Implementing interface
that will be visible from JS
[Guid("121C3E0E-DC6E-45dc-952B-A6617F0FAB42")]
[ComVisible(true)]
public class ActiveXObject : IObjectSafetyImpl
public ActiveXObject()
{
Thread.CurrentThread.SetApartmentState(ApartmentSt ate.STA);
}
[ComVisible(true)]
public void Display()
{
MessageBox.Show(PORT);
}
Thank you
tobias