Send Events from VC++ to C#

  • Thread starter Thread starter Tao Liu
  • Start date Start date
T

Tao Liu

hi.. group,

does anyone have any clue how to send an event (or events) from an unmanaged
VC++ code to managed C# code.

thanks.
 
Tao Liu said:
hi.. group,

does anyone have any clue how to send an event (or events) from an
unmanaged VC++ code to managed C# code.

Two ways:
managed C++/CLI wrapper (typesafe, debuggable, etc).
P/Invoke


You can break P/Invoke down into asynchronous messages delivered to a window
procedure via PostMessage (solves cross-thread callback problems) or
synchronous callback to a .NET delegate which is automatically compiled to a
native function pointer by the marshaller.
 
Back
Top