473,408 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 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 5050
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.