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

Interop Events

First time poster, please be gentle :P

I am using a third party ocx control in a C# 2.0 application. The
interop seems to be working fine except for events. When I try and
attach an event, it only succeeds for one event at a time. Examples:

// works by itself
OCXClass.Event1 += new OCXClass.EventHandler(Event1_Sub);

// second call fails
OCXClass.Event1 += new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event2 += new OCXClass.Event2Handler(Event2_Sub);

// works, but Event 2 is only thing available
OCXClass.Event1 += new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event1 -= new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event2 += new OCXClass.Event2Handler(Event2_Sub);

Has anyone seen this type of behavior before? thanks in advance for
any tips.

Jul 26 '06 #1
3 5033
Hi Stryker,
// second call fails
OCXClass.Event1 += new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event2 += new OCXClass.Event2Handler(Event2_Sub);
By "fails" do you mean that an Exception is thrown? If so I'd assume that the error has to do with an implementation detail of the
control and since the control is third-party it's hard to say what could actually be happening. Post the error if you can. You
might want to contact the control's vendor or creator on this one.

--
Dave Sexton

<St***********@gmail.comwrote in message news:11********************@b28g2000cwb.googlegrou ps.com...
First time poster, please be gentle :P

I am using a third party ocx control in a C# 2.0 application. The
interop seems to be working fine except for events. When I try and
attach an event, it only succeeds for one event at a time. Examples:

// works by itself
OCXClass.Event1 += new OCXClass.EventHandler(Event1_Sub);

// second call fails
OCXClass.Event1 += new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event2 += new OCXClass.Event2Handler(Event2_Sub);

// works, but Event 2 is only thing available
OCXClass.Event1 += new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event1 -= new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event2 += new OCXClass.Event2Handler(Event2_Sub);

Has anyone seen this type of behavior before? thanks in advance for
any tips.

Jul 27 '06 #2
Thanks Dave,

I did mean exception thrown. Here it is:

[System.Runtime.InteropServices.COMException] = {"Exception from
HRESULT: 0x80040202"}
StackTrace = " at
System.Runtime.InteropServices.ComTypes.IConnectio nPoint.Advise(Object
pUnkSink, Int32& pdwCookie)\r\n at
WTReaderNet.ILRXReaderNetXEvents_EventProvider.add _OnTagMovedReader(ILRXReaderNetXEvents_OnTagMovedR eaderEventHandler
)\r\n at WTReaderNet.L...

I kind of thought it was too generic to post.

I have contacted the vendor with no response yet, but I have a feeling
it will be "we don't support .Net implementation" since the examples
they give are all in VB6. I was kind of hoping that interop was to
blame, and that someone else had seen a similar problem and had a
workaround.

Dave Sexton wrote:
Hi Stryker,
// second call fails
OCXClass.Event1 += new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event2 += new OCXClass.Event2Handler(Event2_Sub);

By "fails" do you mean that an Exception is thrown? If so I'd assume that the error has to do with an implementation detail of the
control and since the control is third-party it's hard to say what could actually be happening. Post the error if you can. You
might want to contact the control's vendor or creator on this one.

--
Dave Sexton

<St***********@gmail.comwrote in message news:11********************@b28g2000cwb.googlegrou ps.com...
First time poster, please be gentle :P

I am using a third party ocx control in a C# 2.0 application. The
interop seems to be working fine except for events. When I try and
attach an event, it only succeeds for one event at a time. Examples:

// works by itself
OCXClass.Event1 += new OCXClass.EventHandler(Event1_Sub);

// second call fails
OCXClass.Event1 += new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event2 += new OCXClass.Event2Handler(Event2_Sub);

// works, but Event 2 is only thing available
OCXClass.Event1 += new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event1 -= new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event2 += new OCXClass.Event2Handler(Event2_Sub);

Has anyone seen this type of behavior before? thanks in advance for
any tips.
Jul 27 '06 #3
Hi Styrker,

Postng the error info did the trick. I searched for "HRESULT 0x80040202" on groups.google.com and found the following thread that
seems to address your issue (first of the results):

http://groups.google.com/group/micro...924eaec54e3a5b

HTH

--
Dave Sexton

"Stryker" <St***********@gmail.comwrote in message news:11**********************@i3g2000cwc.googlegro ups.com...
Thanks Dave,

I did mean exception thrown. Here it is:

[System.Runtime.InteropServices.COMException] = {"Exception from
HRESULT: 0x80040202"}
StackTrace = " at
System.Runtime.InteropServices.ComTypes.IConnectio nPoint.Advise(Object
pUnkSink, Int32& pdwCookie)\r\n at
WTReaderNet.ILRXReaderNetXEvents_EventProvider.add _OnTagMovedReader(ILRXReaderNetXEvents_OnTagMovedR eaderEventHandler
)\r\n at WTReaderNet.L...

I kind of thought it was too generic to post.

I have contacted the vendor with no response yet, but I have a feeling
it will be "we don't support .Net implementation" since the examples
they give are all in VB6. I was kind of hoping that interop was to
blame, and that someone else had seen a similar problem and had a
workaround.

Dave Sexton wrote:
>Hi Stryker,
// second call fails
OCXClass.Event1 += new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event2 += new OCXClass.Event2Handler(Event2_Sub);

By "fails" do you mean that an Exception is thrown? If so I'd assume that the error has to do with an implementation detail of
the
control and since the control is third-party it's hard to say what could actually be happening. Post the error if you can. You
might want to contact the control's vendor or creator on this one.

--
Dave Sexton

<St***********@gmail.comwrote in message news:11********************@b28g2000cwb.googlegrou ps.com...
First time poster, please be gentle :P

I am using a third party ocx control in a C# 2.0 application. The
interop seems to be working fine except for events. When I try and
attach an event, it only succeeds for one event at a time. Examples:

// works by itself
OCXClass.Event1 += new OCXClass.EventHandler(Event1_Sub);

// second call fails
OCXClass.Event1 += new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event2 += new OCXClass.Event2Handler(Event2_Sub);

// works, but Event 2 is only thing available
OCXClass.Event1 += new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event1 -= new OCXClass.Event1Handler(Event1_Sub);
OCXClass.Event2 += new OCXClass.Event2Handler(Event2_Sub);

Has anyone seen this type of behavior before? thanks in advance for
any tips.

Jul 27 '06 #4

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

Similar topics

6
by: Iain | last post by:
I've got a (VC++ 6.0) com object which does something asynchronously (writes a DVD image, actually). It rasies COM events to indicate progress, including completion. I've got this running in a...
1
by: Iain | last post by:
I raised this a few days ago and Dmitriy helped, but there's been a lot of posts under the bridge since then so I thought I'd start afresh. Basically, I have a COM Dll written in C++ (6). It's...
0
by: Nadav | last post by:
Hi, Introduction: **************** I am writing a component based application, the application is built of several Native COM objects and some .NET classes exposed as COM objects by 'COM...
0
by: Andy Turner | last post by:
I've got an ATL out-of-process COM server, which implements a single CoClass (let's call it MyServer) which I'd like to get events from within a C# front end. I've inserted a reference to the COM...
5
by: ducky | last post by:
Hi everyone, I'm writing a C#.net app that is controlling an automation server. Added a reference to the COM server. Have the interop wrapper classes generated. Have the following code to...
0
by: Ollie Riches | last post by:
I am using COM Interop to access and execute a remote DTS package. I have taken the code from the KB article http://support.microsoft.com/kb/319985/EN-US/ and converted this into C#. I have a...
0
by: Anjali | last post by:
Hi All, I am trying to translates some of my IDLs into interop. All the methods of the IDL I am able to translate but am Getting stucked about how to manage the events that have been exposed by...
9
by: jake.foster | last post by:
All- I have a WinForms app written in C# that's doing some COM interop with Apple iTunes (they have a published COM API). I'm getting a reference to the COM server and registering some event...
0
by: Gobinath | last post by:
Hi, I have a dot net control which raises an event with 2 string arguments. I'm hosting this on a dotnet container and mfc container(via com interop). The entire setup was is .net 2.0 and...
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
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
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
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
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,...

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.