Using ClassWizard is a simple way to derive a new class from CCmdTarget that implements a new dispatch interface.
To create a new CCmdTarget class with a dispatch interface
The New Class dialog box appears.
CAutoClickPoint
.Notice that all Automation options are now available because these options pertain only to CCmdTarget-derived classes.
You are returned to the ClassWizard dialog box.
x
.
As you will see later, the members of the CAutoClickPoint
dispatch interface class do not need notification functions.
y
property.
Study the CAutoClickPoint
class created by ClassWizard in AutoClickPoint.h and AutoClickPoint.cpp.
Toward the end of AutoClickPoint.h, you’ll find the declaration for the dispatch map:
DECLARE_DISPATCH_MAP()
The AutoClickPoint.cpp file implements the dispatch map, reflecting the two properties you added in ClassWizard, x
and y
.
Tip To jump to the implementation file, from ClassView, right-click any of the members of CAutoClickPoint
, and click Go to Definition.
BEGIN_DISPATCH_MAP(CAutoClickPoint, CCmdTarget)
//{{AFX_DISPATCH_MAP(CAutoClickPoint)
DISP_PROPERTY(CAutoClickPoint, "x", m_x, VT_I2)
DISP_PROPERTY(CAutoClickPoint, "y", m_y, VT_I2)
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()