COM Interop

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Abhi

    #1

    COM Interop

    Hi,

    I need to fire COM events from C# and the client to handle those events is
    in C++.

    Following is the code snippet of the COM events and the dispinterface in C#.

    [Guid("12854E47-AD44-4283-B503-1176CC827A49")]

    public interface Foo1ComInterfac e

    {

    void FireRequest( string str );

    }

    [Guid("073D1766-7969-41fd-B794-8B65B0EADAF3")]

    [InterfaceType(C omInterfaceType .InterfaceIsIDi spatch)]

    public interface Foo1ComEvents

    {

    void FooEvent( string str );

    }

    [ Guid("22EFEC33-5B40-4417-AFF0-DE0C5B7C9E47")]

    [ ClassInterface( ClassInterfaceT ype.None) ]

    [ ComSourceInterf aces(typeof(Foo 1ComEvents))]

    public class BooHoo : Foo1ComInterfac e

    {

    ......

    }

    So far I have generated a tlb file using regasm and did a #import in the C++
    code and am able to

    call the FireRequest function as defined above from C++. But how should I
    handle the event

    fired from the .NET side. Please help!!!

    Thanks,

    Abhi




  • Mattias Sjögren

    #2
    Re: COM Interop

    [color=blue]
    >But how should I handle the event
    >fired from the .NET side. Please help!!![/color]

    That's more of a general C++/COM question, so perhaps you shold post
    to microsoft.publi c.vc.atl or microsoft.publi c.win32.program mer.ole
    instead. A good start would be to read about connection points in
    MSDN.



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org

    Please reply only to the newsgroup.

    Comment

    Working...