MFC框架里
union MessageMapFunctions
{
AFX_PMSG pfn; void (CWnd::*pfn_vv)(void);
void (CWnd::*pfn_vw)(UINT);
int (CWnd::*pfn_is)(LPTSTR);
};
处理消息时
const AFX_MSGMAP* pMessageMap;
const AFX_MSGMAP_ENTRY* lpEntry;
for(pMessageMap = GetMessageMap(); pMessageMap != NULL; pMessageMap = pMessageMap->pBaseMap)
{
ASSERT(pMessageMap != pMessageMap->pBaseMap);
if((lpEntry = AfxFindMessageEntry(pMessageMap->pEntries, message, 0, 0)) != NULL)
goto LDispatch;
}
return FALSE;LDispatch:
union MessageMapFunctions mmf;
mmf.pfn = lpEntry->pfn;
switch(lpEntry->nSig)
{
default:
return FALSE;
case AfxSig_vw:
(this->*mmf.pfn_vw)(wParam);
// ((*mmf.pfn_vw))(wParam);这样不行
break;
为什么我去掉this->后不行了呢?编译错误error C2171: '*' : illegal on operands of type 'void (__thiscall CWnd::*)(unsigned int)'
 : error C2064: term does not evaluate to a function
哪位仁兄请指点下小弟