Click here to Skip to main content
15,885,043 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
Hi...

I am making a program with ATL/COM(vc++) and c# in windows ce platform(wince 5.0).

ATL/COM has the function of ConnectionPoint & event.
and C# is invoked for the events.

ATL/COM------------------------------------------------------------
HRESULT Fire_OnGetAlarmState(BSTR inBstrEventID, 
                             BSTR * outBstrDate, 
                             BSTR * outBstrContent)
{
...
}
HRESULT Fire_OnGetResidentArrival(BSTR inBstrEventID, 
                                  BSTR * outBstrEntranceName, 
                                  BSTR * outBstrEntranceAddr, 
                                  BSTR * outBstrRelationShip)
{
...
}	

If an event method is respectively registered about the two event in C#, there is no problem.
However, if the two event method are registered in C#, a problem arises in ATL/COM.
The problem is an excption error that is involved with IDispatch::Invoke(...).

And the source has no problem in PC platform at all.

Could you tell me how to solve the problem?

[EDIT: email address removed - answer should be posted on the site for the benefit of the community. Also, you don't want a mountain of spam to start filling your inbox!]
Posted
Updated 16-Mar-10 0:40am
v2

1 solution

Hello heedong2.kim,

The first thing that came into my mind would be calling convention. When I googled the calling conventions for ATL/COM(vc++) and c# it was immediately clear that this is the case here. Maybe the text below can help you solve this problem. Good luck!

This answer I found:
To access an ATL COM dll in C#, you must first create the .NET wrapper class for that dll by either using tlbimp command or from the visual studio "Add reference" command and select the dll using Browse. The latter will automatically create the .NET wrapper and add the wrapper's reference, where as after the first option, you will have to
again do the add reference part and select the .NET proxy using the Browse button.


This is the link to the original post[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900