Event handling
Event handling is primarily supported for COM classes (C++ classes that implement COM objects, typically using ATL classes or the coclass attribute). For more information, see Event handling in COM.
Event handling is also supported for native C++ classes (C++ classes that don't implement COM objects). Native C++ event handling support is deprecated and will be removed in a future release. For more information, see Event handling in native C++.
Note
Event attributes in native C++ are incompatible with Standard C++. They don't compile when you specify /permissive-
conformance mode.
Event handling supports both single- and multithreaded usage. It protects data from simultaneous multithread access. You can derive subclasses from event source or receiver classes. These subclasses support extended event sourcing and receiving.
The Microsoft C++ compiler includes attributes and keywords for declaring events and event handlers. The event attributes and keywords can be used in CLR programs and in native C++ programs.
Article | Description |
---|---|
event_source |
Creates an event source. |
event_receiver |
Creates an event receiver (sink). |
__event |
Declares an event. |
__raise |
Emphasizes the call site of an event. |
__hook |
Associates a handler method with an event. |
__unhook |
Disassociates a handler method from an event. |