The FlashColor property holds the color value that flashes within the control circle. Windows represents a color as a 32-bit value, defined as a COLORREF type. The ActiveX control classes do not directly support the COLORREF type, but they do support an OLE_COLOR type that can hold the required information. Thus, the FlashColor property is defined as an OLE_COLOR type.
The FlashColor property requires no special processing when its value is changed or accessed. For this reason, FlashColor can be defined as a simple member variable property.
To add the FlashColor property
The Add Property dialog box appears.
FlashColor
.OnFlashColorChanged
and that the Variable name edit control contains m_flashColor
.This returns you to the Automation tab. Notice that the implementation of the FlashColor property appears as:
Implementation:
OLE_COLOR m_flashColor;
void OnFlashColorChanged();
ClassWizard creates the code to add the FlashColor property, modifying both the CCircCtrl
class and the CIRC.ODL file. Because FlashColor is a member variable property type, ClassWizard modifies the CCircCtrl
class's dispatch map in CIRCCTL.CPP to include a DISP_PROPERTY_NOTIFY macro entry:
BEGIN_DISPATCH_MAP(CCircCtrl, COleControl)
//{{AFX_DISPATCH_MAP(CCircCtrl)
DISP_PROPERTY_NOTIFY(CCircCtrl, "FlashColor",
m_flashColor, OnFlashColorChanged, VT_COLOR)
DISP_PROPERTY_NOTIFY(CCircCtrl, "CircleShape",
m_circleShape, OnCircleShapeChanged, VT_BOOL)
DISP_PROPERTY_EX(CCircCtrl, "CircleOffset",
GetCircleOffset, SetCircleOffset, VT_I2)
DISP_STOCKPROP_BACKCOLOR()
//}}AFX_DISPATCH_MAP
DISP_FUNCTION_ID(CCircCtrl, "AboutBox",
DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
END_DISPATCH_MAP()
The DISP_PROPERTY_NOTIFY macro associates the FlashColor property name with the following:
CCircCtrl
class member variableCCircCtrl
class notification function (OnFlashColorChanged
) that is called whenever the value of the FlashColor property is changed
ClassWizard also adds a declaration for the OnFlashColorChanged
notification function in CIRCCTL.H and a function template in CIRCCTL.CPP:
void CCircCtrl::OnFlashColorChanged()
{
// TODO: Add notification handler code
SetModifiedFlag();
}