473,386 Members | 1,720 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,386 software developers and data experts.

CREATE ACTIVE X IN C#

I have a third party program that has the ability to control my program
trough ActiveX/COM.

My program is built in c#?
What would I need to do to have the third party program connect to my
program or just execute methods in my program?

IS SOMETHING LIKE THIS THE CORRECT START AND WHATS NEEDED TO FOLLOW?
AB = new ActiveXObject("Bro.method");

Can it be done in c#?
If so, how?
Any examples?
Or links to learn.

Can someone help me with this issue?

THANKS

Nov 16 '05 #1
3 4300
equip200,

Are you trying to have another program access yours through COM, or are
you trying to access another COM object? Also, if another program is trying
to access your program through COM, does it need the running instance, or
can it just create a new one?

Depending on your answers, the solutions will be different.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"equip200" <eq******@discussions.microsoft.com> wrote in message
news:90**********************************@microsof t.com...
I have a third party program that has the ability to control my program
trough ActiveX/COM.

My program is built in c#?
What would I need to do to have the third party program connect to my
program or just execute methods in my program?

IS SOMETHING LIKE THIS THE CORRECT START AND WHATS NEEDED TO FOLLOW?
AB = new ActiveXObject("Bro.method");

Can it be done in c#?
If so, how?
Any examples?
Or links to learn.

Can someone help me with this issue?

THANKS

Nov 16 '05 #2
The general procedure is to build the
C# program without any special changes,
and then register the assembly with the RegAsm
utility. That should do it for the *general* case. I did
some simple tests of this some time ago and they worked
just fine, calling simple public managed methods/properties
from unmanaged code. There are various other considerations
though that may cause some issues, so you need to look ino this further,
what MS calls COM Callabale Wrappers (CCW), Interop
related attributes, and various related considerations. I suspect
this Interop will get trickier as soon you try something more
substantial. Because I've had situations going the other way,
where I has to abandon using the VS generated RCWs,
and use reflection instead.
RayO
"equip200" <eq******@discussions.microsoft.com> wrote in message
news:90**********************************@microsof t.com...
I have a third party program that has the ability to control my program
trough ActiveX/COM.

My program is built in c#?
What would I need to do to have the third party program connect to my
program or just execute methods in my program?

IS SOMETHING LIKE THIS THE CORRECT START AND WHATS NEEDED TO FOLLOW?
AB = new ActiveXObject("Bro.method");

Can it be done in c#?
If so, how?
Any examples?
Or links to learn.

Can someone help me with this issue?

THANKS

Nov 16 '05 #3
equip200,

If you need another program to connect to the running instance of your
program through COM, then you will have quite a bit of work to do.

The first thing you have to do is make sure that whatever object you are
going to make available to the other running program is interoperable with
COM.

Once you do that, when your program runs, you will have to marshal your
interface pointer to the running object table. You can do this by getting
the running object table by calling GetRunningObjectTable through the
P/Invoke layer. This will return to you an IRunningObjectTable
implementation, which is represented in .NET through the
UCOMIRunningObjectTable interface, defined in the
System.Runtime.InteropServices namespace. In .NET 2.0, you should probably
use the IRunningObjectTable interface in the
System.Runtime.InteropServices.ComTypes namespace.

You can then call Register to register your object. You have to pass a
moniker to identify your object. What kind of moniker you create is up to
you, but that's dependent on your application. For example, if you want the
running instance that is hosting a particular file, create a file moniker
(through the CreateFileMoniker function) and pass that to register.

Then, when you want to access the object on the other side, you would
get the running object table again, and call GetObject.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"equip200" <eq******@discussions.microsoft.com> wrote in message
news:AF**********************************@microsof t.com...
On your first QS, I'm trying to have another program access mine trough
COM
or OLE (don't know which does what) but that is the ability the other
program
has.

On the second I have tried to access the other program COM but it does not
have DLL it has EXE. And I could not import into reference. But this is
not
my priority the above is.

It also needs the running instance.(it needs to run the methods of my
program that is already started not on its own , is this what u meant?).

"Nicholas Paldino [.NET/C# MVP]" wrote:
equip200,

Are you trying to have another program access yours through COM, or
are
you trying to access another COM object? Also, if another program is
trying
to access your program through COM, does it need the running instance, or
can it just create a new one?

Depending on your answers, the solutions will be different.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"equip200" <eq******@discussions.microsoft.com> wrote in message
news:90**********************************@microsof t.com...
>I have a third party program that has the ability to control my program
> trough ActiveX/COM.
>
> My program is built in c#?
> What would I need to do to have the third party program connect to my
> program or just execute methods in my program?
>
> IS SOMETHING LIKE THIS THE CORRECT START AND WHATS NEEDED TO FOLLOW?
> AB = new ActiveXObject("Bro.method");
>
> Can it be done in c#?
> If so, how?
> Any examples?
> Or links to learn.
>
> Can someone help me with this issue?
>
> THANKS
>


Nov 16 '05 #4

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

Similar topics

0
by: Sharon | last post by:
Following up, I've found success at last with Aspose, combining both Aspose.Word to create an xml file, and then and Aspose.Pdf to create the pdf file. This works out to be quite a considerable...
0
by: BucRepus | last post by:
I have two XP boxes with 'identical' installs (NO IIS on either). I log in locally with same username with same permissions on each box. I connect to Win2003 Entp Server. I try to create a new...
4
by: I_AM_DON_AND_YOU? | last post by:
There is one more problem I am facing but didn't get the solution. In my Setup Program I am not been able to create 2 things (when the program is intalled on the client machine ) : (1) create...
2
by: Michael | last post by:
Hello, I've created an ASP web page where users in our organization can create Active Directory computer accounts. The web page is running on a Server 2003 SP1 IIS 6 installation. The...
5
by: Michael | last post by:
Hello, I've created an ASP web page where users in our organization can create Active Directory computer accounts. The web page is running on a Server 2003 SP1 IIS 6 installation. The...
14
by: mistral | last post by:
Need php script to create mySQL database programmatically; since hosting configuration may not allow create database from script, script also need eliminate/rewrite all restrictions in appropriate...
15
by: pbd22 | last post by:
Hi. I want to create a tab with a little "active tab" arrow below it to tell the user where they are. An example is here: http://personals.yahoo.com/us/search/dashboard Does anybody know of...
3
by: meettapan | last post by:
I want to create the log file as below:- 2007/03/09 19:12:08 : ~extasc_cdr_20061230.csv.vcdr 2007/03/09 19:23:02 : ~extasc_cdr_20061230.csv.vcdr 2007/03/09 19:42:13 :...
3
by: Supriya | last post by:
Hi , Can anybody give me some information on how to create an activeX Control in C# with a Picturebox. Thank you, Supriya
0
by: Kevinst | last post by:
Hi! Let's say I wanted to create a very simple control that is nothing but a LED. That LED can be active or inactive. Depending on that state its color changes. What is WPFs best practice to do...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.