While developing a project I stumbled upon this; imagine you want to handle a WM_CONTEXTMENU message. You place a ON_WM_CONTEXTMENU() in the class message map, right? Then you'll get a
error C2065: 'ON_WM_CONTEXTMENU' : undeclared identifier
I found some references on the net: they say that the context menu message is either not supported or handled by buggy code. I can easily believe this, but what if I want a quick solution to handle the message?
The solution turned out to be extremely simple. The ON_WM_CONTEXTMENU macro is defined in afxmsg_.h, which surely gets included somewhere in your files, but somehow its definition is "lost" somewhere.
So you just copy the following code and paste it into the file with the message map:
#ifndef ON_WM_CONTEXTMENU
#define ON_WM_CONTEXTMENU() \
{ WM_CONTEXTMENU, 0, 0, 0, AfxSig_vWp, \
(AFX_PMSG)(AFX_PMSGW)(void (AFX_MSG_CALL CWnd::*)(CWnd*, CPoint))&OnContextMenu },
#endif
This is exactly the same code in afxmsg_.h so I didn't invent anything. Neither did I connect the brain before adopting and posting this solution. It's just a stupid workaround for another stupid bug in eVC4 / ppc2003. And, quite strange, does work for me :-)
|
|
August '06 |
|
||||
| Mo | Tu | We | Th | Fr | Sa | Su |
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||
2006-2008 Giuseppe 'Cowo' Corbelli | Cowo's homepage | Cowo's photo page | Contact me | Back to top
Design by Andreas Viklund | Serendipity Template by Carl