Broadcast Notification System

The broadcast notification system is an alternative mechanism to the reference message system that calls callback functions when certain events occur. These are events such as the system unit settings changing, system time setting changing, or the user executing File/Reset, File/New, etc.

The header file notify.h contains the list of notification event ID's that can be handled.

The plug-in must creates a callback function to process the notification. The notification callback function pointer (NOTIFYPROC) is defined as follows:

typedef void (* NOTIFYPROC)(void *param, NotifyInfo *info);

The NotifyInfo structure is passed to the NOTIFYPROC function pointer to inform it of what it's being notified about.

The sample code below shows how this system may be used.

class MyPlugIn : public MyPlugInBaseClass
{
  // Declare the callback function
  static void TimeUnitsChanged(void *param, NotifyInfo *info)
  {
    // Handle the units changing...
  }
 
public:
 
  MyPlugIn()
  {
    ...
    // Register the callback
    RegisterNotification(TimeUnitsChanged, this, NOTIFY_TIMEUNITS_CHANGE);
  }
 
  ~MyPlugIn()
  {
    ...
    // When done, unregister the callback
    UnRegisterNotification(TimeUnitsChanged, this, NOTIFY_TIMEUNITS_CHANGE);
  }
 

See also the topic Monitoring the Node Events for an example of using the notification system to respond to node deletion events.