Adding Custom Events to the Circle Control

Circle: ActiveX Control, Lesson 6

Tip   If you prefer working from a printed tutorial, see in MSDN Library Help for details about printing a lesson, a set of topics, or a single topic.

This lesson illustrates how to add custom events to the Circle control. ActiveX controls use events to notify a container that something has happened to a control. Commonly, an event is caused by user interaction, such as mouse or keyboard input, a Windows interaction, or a special condition occurring in the control itself. When one of these actions occur, the control alerts the container by firing an event.

MFC supports two kinds of events: stock and custom. Stock events are those events that class COleControl handles automatically. Custom events require extra work by the developer, but allow a control to notify a container when an action specific to the control occurs.

This lesson shows you how to add the ClickIn and ClickOut custom events. The ClickIn event is fired when the user clicks the left mouse button with the insertion point inside the control circle; ClickOut is fired when the user clicks the left mouse button with the insertion point outside the circle.

Note   You can find a finished example of this lesson's code in the CIRC2 sample source code directory.

In this lesson, you will:

Suggested Reading

  • , Visual C++ Programmer’s Guide