Board index » cppbuilder » Event problem towards .NET

Event problem towards .NET


2007-05-08 03:31:52 PM
cppbuilder55
I have a com object with several events that works fine when used for
instance with VB6 or C++. However when trying to use it from a .NET code it
crashes if I add more than 5 event handlers, when creating the object. Note
that it doesn't matter what event handlers, just that there are more than
five handlers and it doesn't work.
The com object was written in BDS2006 environment using C++Builder.
/ Anders
Error message when used from VB.NET.
System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147220991
Message="An event was unable to invoke any of the subscribers (Exception
from HRESULT: 0x80040201)"
Source="mscorlib"
StackTrace:
at
System.Runtime.InteropServices.ComTypes.IConnectionPoint.Advise(Object
pUnkSink, Int32& pdwCookie)
at
BPTITest.ICoBpTiEvents_EventProvider.add_cardDataEvent(ICoBpTiEvents_cardDataEventEventHandler
)
at
BPTITest.ICoBpTiEvents_Event.add_cardDataEvent(ICoBpTiEvents_cardDataEventEventHandler
)
at BPTI_test.frmMain.set_api(CoBpTi WithEventsValue)
at BPTI_test.frmMain.frmMain_Load(Object sender, EventArgs e) in
C:\Documents and Settings\Remuz\My Documents\Visual Studio
2005\Projects\BPTI-test\BPTI-test\frmMain.vb:line 38
 
 

Re:Event problem towards .NET

Has been solved by looking at support.microsoft.com/kb/810228/en-us
Me and others were fooled by VS which showed all the eventd even when threre
was no sink object for it.
A Jarold
"A Jarold" <barf>skrev i meddelandet
Quote
I have a com object with several events that works fine when used for
instance with VB6 or C++. However when trying to use it from a .NET code it
crashes if I add more than 5 event handlers, when creating the object. Note
that it doesn't matter what event handlers, just that there are more than
five handlers and it doesn't work.
The com object was written in BDS2006 environment using C++Builder.

/ Anders

Error message when used from VB.NET.
System.Runtime.InteropServices.COMException was unhandled

ErrorCode=-2147220991

Message="An event was unable to invoke any of the subscribers (Exception
from HRESULT: 0x80040201)"

Source="mscorlib"

StackTrace:

at
System.Runtime.InteropServices.ComTypes.IConnectionPoint.Advise(Object
pUnkSink, Int32& pdwCookie)

at
BPTITest.ICoBpTiEvents_EventProvider.add_cardDataEvent(ICoBpTiEvents_cardDataEventEventHandler
)

at
BPTITest.ICoBpTiEvents_Event.add_cardDataEvent(ICoBpTiEvents_cardDataEventEventHandler
)

at BPTI_test.frmMain.set_api(CoBpTi WithEventsValue)

at BPTI_test.frmMain.frmMain_Load(Object sender, EventArgs e) in
C:\Documents and Settings\Remuz\My Documents\Visual Studio
2005\Projects\BPTI-test\BPTI-test\frmMain.vb:line 38