The sample we'll use here is an ActiveX control that monitors message traffic through a hook procedure, displaying a real-time graph of the message flow over time. The control renders its graph to the screen and has incoming interfaces, so the container can tell the control to start and stop the graph. The control supports both the graph line color and message interval length as properties that can be persisted. Finally, the control supports a default event set for notifying the container how many messages are processed within a certain interval.
The control manages a window hook procedure that keeps track of the number of messages coming through the system over regular intervals. Then the control examines the total number of messages over the interval and draws a little graph to show the amount of message traffic. Figure 10-2 shows the control in action—sampling the message traffic and sending notifications to the client application.
Figure 10-2. The message traffic control in action.