A VB ActiveX component is a unit of code that follows the COM specification for providing objects. It exposes much of its functionality through one or more interfaces. These software components have a high reusability factor. Though this makes them faster than ActiveX EXE components, who need to be loaded in their own address space, the biggest drawback is that a faulty DLL will crash the client, and in turn, the object. An event can be simply defined as something that occurs during the applications lifetime.
Events allow a class to communicate to other classes and programs.
A component raises an event to notify the client about the completion of some task. This event can be caught by the client, and the client can respond to the event as it sees fit. Custom events provide event-handling capabilities to classes and components. The object that generates the event is known as the event source and the object that responds to an event is known as the event sink . First, we are going to fire a custom event from a VB ActiveX DLL and handle the notification in an MFC client.