472,969 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,969 software developers and data experts.

Accessing a running ActiveX C# Exe from WebBrowser

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
Jul 28 '08 #1
1 5034
Tobias,

I think that what you want is the static GetActiveObject on the Marshal
class in the System.Runtime.InteropServices namespace.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tobias Maier" <To**********@web.dewrote in message
news:48**************@web.de...
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

Jul 29 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Noozer | last post by:
I've just installed the Mozilla ActiveX control. I'm trying to replace the Microsoft WebBrowser control with the Mozilla control, but I'm getting a type mismatch error trying to get the browser...
2
by: Lad | last post by:
I would like to use httplib/urllib to download webpages from 3 different websites.From my script I want to open 3 webbrowser windows( 3 threads) and open in each thread( window) pages from a...
4
by: Jaydeep | last post by:
Hello, I am facing a strange problem. Problem accessing remote database from ASP using COM+ server application having VB components (ActiveX DLL) installed. Tier 1 : ASP front End (IIS 5.0) Tire...
18
by: Joe | last post by:
Hi, I am trying to alter the refresh rate of an online webpage in a webbrowser control using MFC. However the Timer ID is stored in a local variable and I don't know how to access it. Is there a...
4
by: Randy | last post by:
Hi, ok, I found a way to connect to a running instance of an (external) Internet Explorer and access - for example - the html source. That works fine! But now I have running application with...
3
by: AdamM | last post by:
Hi all, When I run my VbScript, I get the error: "ActiveX component can't create object: 'getobject'. Error 800A01AD". Any ideas what I did wrong? Here's my VBScript: dim o set...
1
by: kp | last post by:
Hi, I've got a COM (project is a ActiveX exe) in which I've got a User Doc & have a webBrowser control on it. I can't close the COM b/c the webBrowser control won't shutdown. How do I...
10
by: Febronio | last post by:
Can someone tell me how to access the Internet Explorer Document from a vb.net usercontrol hosted in this document ? Me.parent, parentform, findform don't seem to work. Thanks ..
4
by: Jon | last post by:
I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a direct connection to the internet, but on two different PCs with internet access via a proxy, I get...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.