| title | Event Handling | |
|---|---|---|
| ms.date | 05/07/2019 | |
| helpviewer_keywords |
|
|
| ms.assetid | 82de3f9a-2d88-470c-9527-8a5b54c8ced4 |
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 do not implement COM objects), however, that support is deprecated and will be removed in a future release. For more information, see Event Handling in Native C++.
Event handling supports single- and multithreaded usage and protects data from simultaneous multithread access. It also allows you to derive subclasses from event source or receiver classes and support extended event sourcing/receiving in the derived class.
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.
| Topic | 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 | Dissociates a handler method from an event. |