mayfly
05-02-2007, 04:25 AM
When using a MapPoint 2006 control in a VC++ MFC dialog application, setting the Cancel output argument seems to have no effect for me.
The relevant code is:
.h ...
afx_msg void OnBeforeClickMap(long Button, long Shift, long X, long Y, BOOL FAR* Cancel);
DECLARE_EVENTSINK_MAP()
//}}AFX_MSG
.cpp ...
BEGIN_EVENTSINK_MAP(MainDialog, CDialog)
//{{AFX_EVENTSINK_MAP(MainDialog)
ON_EVENT(MainDialog, IDC_MAP_CONTROL, 209 /* BeforeClick */, OnBeforeClickMap, VTS_I4 VTS_I4 VTS_I4 VTS_I4 VTS_PBOOL)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void TestDialog::OnBeforeClickMap(long Button, long Shift, long X, long Y, BOOL FAR* Cancel)
{
*Cancel = TRUE;
}
The callback is entered OK, with Button, Shift, X and Y as expected and *Cancel FALSE, but the control is still responding to the click events.
Judging from other posts, this obviously works with VB and C# etc. Does anyone know why it should be a problem with VC++ (6)?
Thanks.
The relevant code is:
.h ...
afx_msg void OnBeforeClickMap(long Button, long Shift, long X, long Y, BOOL FAR* Cancel);
DECLARE_EVENTSINK_MAP()
//}}AFX_MSG
.cpp ...
BEGIN_EVENTSINK_MAP(MainDialog, CDialog)
//{{AFX_EVENTSINK_MAP(MainDialog)
ON_EVENT(MainDialog, IDC_MAP_CONTROL, 209 /* BeforeClick */, OnBeforeClickMap, VTS_I4 VTS_I4 VTS_I4 VTS_I4 VTS_PBOOL)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void TestDialog::OnBeforeClickMap(long Button, long Shift, long X, long Y, BOOL FAR* Cancel)
{
*Cancel = TRUE;
}
The callback is entered OK, with Button, Shift, X and Y as expected and *Cancel FALSE, but the control is still responding to the click events.
Judging from other posts, this obviously works with VB and C# etc. Does anyone know why it should be a problem with VC++ (6)?
Thanks.