473,405 Members | 2,444 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,405 software developers and data experts.

getting events into c# app from a COM control - critical path help needed!

Hi, I have a COM control / server I'm trying to get events from in my c#
applications.

1) I'm trying to get events in both c# console apps and in c# winform apps.
2) I can call methods on the COM control / server ok, I just don't receive
any events. The method calls are definitely successful.
3) I have got events and communicated ok with other COM controls from c# -
it's just this one I have a problem with.
4) I can communicate perfectly with the COM control / server from VB and
VC6 - both methods and events work fine.
5) I've tried STA and MTA and have used the control directly and via
tlbimp.exe

It looks like there is a problem with this particular control - is that
possible? I've tried sinking the events via delagates:
objControl.OnDisable += new IControlEvents_OnDisableEventHandler(OnDisable);
objControl.OnEnable += new IControlEvents_OnEnableEventHandler(OnEnable);

and by setting up an event sink:
// Create the object.
ControlProxy objControlProxy = new ControlProxyClass();

// Fix the connection points to fire events.
m_objIConnectionPointContainer =
(UCOMIConnectionPointContainer)objControlProxy;
Guid objGuid = typeof(eventtlbnsp.IControlEvents).GUID;
m_objIConnectionPointContainer.FindConnectionPoint (ref objGuid, out
m_objIConnectionPoint);
m_objIConnectionPoint.Advise(this, out m_nCookie);

Any help is SINCERELY appreciated, I'm really on the critical path on this.
I've looked all over the ng's - people have been asking about this for years
but I can't find any answers which work on this.

Cheers, Dave.
Nov 16 '05 #1
2 1956
Hi Dave,

Delegates are usually the way to go, they work fine for me. You can examine
the interop assembly with ildasm to see whether event arguments were
generated correctly.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"dave" <da**@dave.com> wrote in message
news:lV*****************@newsfe1-gui.ntli.net...
Hi, I have a COM control / server I'm trying to get events from in my c#
applications.

1) I'm trying to get events in both c# console apps and in c# winform
apps.
2) I can call methods on the COM control / server ok, I just don't receive
any events. The method calls are definitely successful.
3) I have got events and communicated ok with other COM controls from c# -
it's just this one I have a problem with.
4) I can communicate perfectly with the COM control / server from VB and
VC6 - both methods and events work fine.
5) I've tried STA and MTA and have used the control directly and via
tlbimp.exe

It looks like there is a problem with this particular control - is that
possible? I've tried sinking the events via delagates:
objControl.OnDisable += new
IControlEvents_OnDisableEventHandler(OnDisable);
objControl.OnEnable += new IControlEvents_OnEnableEventHandler(OnEnable);

and by setting up an event sink:
// Create the object.
ControlProxy objControlProxy = new ControlProxyClass();

// Fix the connection points to fire events.
m_objIConnectionPointContainer =
(UCOMIConnectionPointContainer)objControlProxy;
Guid objGuid = typeof(eventtlbnsp.IControlEvents).GUID;
m_objIConnectionPointContainer.FindConnectionPoint (ref objGuid, out
m_objIConnectionPoint);
m_objIConnectionPoint.Advise(this, out m_nCookie);

Any help is SINCERELY appreciated, I'm really on the critical path on
this.
I've looked all over the ng's - people have been asking about this for
years
but I can't find any answers which work on this.

Cheers, Dave.


Nov 16 '05 #2
They don't work on this I'm afriad.

I think something dodgy is going on inside the control that is incompatible
with the CLR. My VB6 project (which just creates the control and receives
the events - 5 lines of programming) works perfectly, but when I convert it
to VB.Net, it stops working and behaves just like the c# project.

If I create a VB6 control (exe or dll) that wraps the 3rd party control (ie,
feeds method calls straight through, sends events straight out), and use the
VB6 control from c#, it works perfectly. Once I've got some time, I'll write
a VC++ wrapper.
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote
in message news:O2****************@TK2MSFTNGP10.phx.gbl...
Hi Dave,

Delegates are usually the way to go, they work fine for me. You can examine the interop assembly with ildasm to see whether event arguments were
generated correctly.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"dave" <da**@dave.com> wrote in message
news:lV*****************@newsfe1-gui.ntli.net...
Hi, I have a COM control / server I'm trying to get events from in my c#
applications.

1) I'm trying to get events in both c# console apps and in c# winform
apps.
2) I can call methods on the COM control / server ok, I just don't receive any events. The method calls are definitely successful.
3) I have got events and communicated ok with other COM controls from c# - it's just this one I have a problem with.
4) I can communicate perfectly with the COM control / server from VB and
VC6 - both methods and events work fine.
5) I've tried STA and MTA and have used the control directly and via
tlbimp.exe

It looks like there is a problem with this particular control - is that
possible? I've tried sinking the events via delagates:
objControl.OnDisable += new
IControlEvents_OnDisableEventHandler(OnDisable);
objControl.OnEnable += new IControlEvents_OnEnableEventHandler(OnEnable);
and by setting up an event sink:
// Create the object.
ControlProxy objControlProxy = new ControlProxyClass();

// Fix the connection points to fire events.
m_objIConnectionPointContainer =
(UCOMIConnectionPointContainer)objControlProxy;
Guid objGuid = typeof(eventtlbnsp.IControlEvents).GUID;
m_objIConnectionPointContainer.FindConnectionPoint (ref objGuid, out
m_objIConnectionPoint);
m_objIConnectionPoint.Advise(this, out m_nCookie);

Any help is SINCERELY appreciated, I'm really on the critical path on
this.
I've looked all over the ng's - people have been asking about this for
years
but I can't find any answers which work on this.

Cheers, Dave.

Nov 16 '05 #3

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

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
3
by: Bob | last post by:
Is there an interface or events in the system that occurs pre and post garbage collection that one of my objects can attach to? I need to know in my application when garbage collection is about to...
4
by: blue | last post by:
I have a drop-down list, a radio button list and a submit button. I'm adding these controls to a table and I'm adding the table to a Placeholder. I'm adding it to the Placeholder because I don't...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
4
by: planetthoughtful | last post by:
Hi All, I have a relatively simple web user control I've included in a page that simply presents 3 drop down lists and a submit button, that I use as a date picker (ie one list for day, one for...
19
by: amit | last post by:
Hi group, Long story short, I'm new to JavaScript and have started it less than 3 weeks. My question is 1) how can I create a situation that when user clicks on gif or ... image file an event...
33
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...

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.