Re: MFC Message Map Problems
"Paul Cheetham" <PAC.News@dsl.pipex.com> wrote in message
news:%230U1u$pOJHA.3748@TK2MSFTNGP04.phx.gbl...
I have inherited an application written in VS6 (VC) and I am attempting to
upgrade it to VS2005.
I have solved most of the issues - mainly relating to superseded function
calls etc, but there are a couple of issues that I am struggling with:
I have the following code:
static const AFX_MSGMAP_ENTRY* GetMessageEntries()
{
static const AFX_MSGMAP_ENTRY Entries[] =
{
ON_WM_MEASUREITEM()
ON_WM_MENUCHAR()
ON_WM_INITMENUPOPUP()
ON_WM_ENTERMENULOOP()
ON_WM_EXITMENULOOP()
ON_WM_TIMER()
ON_WM_CREATE()
ON_WM_NCHITTEST()
ON_WM_DESTROY()
ON_WM_SYSCOLORCHANGE()
#ifdef USE_NEW_DOCK_BAR
ON_WM_NCPAINT()
ON_WM_PAINT()
ON_WM_ACTIVATEAPP()
ON_WM_ACTIVATE()
#endif //USE_NEW_DOCK_BAR
{0, 0, 0, 0, AfxSig_end, (AFX_PMSG)0 }
};
return Entries;
}
This generates the error "error C2653: 'ThisClass' : is not a class or
namespace name" on lines 5 - 10
Looking at the definitions (declared in afxmsg.h) they are declared as
follows:
#define ON_WM_MEASUREITEM() \
{ WM_MEASUREITEM, 0, 0, 0, AfxSig_vOWNER, \
(AFX_PMSG)(AFX_PMSGW) \
(static_cast< void (AFX_MSG_CALL CWnd::*)(int, LPMEASUREITEMSTRUCT) > (
&ThisClass :: OnMeasureItem)) },
Now I know what the error means, but this is defined in one of the
standard header files, so what do I need to do?
Thankyou.
Paul
'ThisClass' is a macro argument. It is normally defined by the
BEGIN_MESSAGE_MAP (x, y)
declaration's x parameter. So it seems you may have a missing
BEGIN_MESSAGE_MAP or, at least, your code must follow that declaration in a
cpp file in order to compile.
--
Scott McPhillips [VC++ MVP]