I attampted to write a Message Map following a sample in a book.
Here is my code:
typedef struct MsgMapEntry_t {
UINT nMessage;
LONG (*pFunc)(HWND, UINT, WPARAM, LPARAM);
} MsgMapEntry_t;
// Skip Lines
LRESULT CALLBACK CyauShellWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static MsgMapEntry_t OnMsgMap[]=
(
// TODO Register MsgFunc here
WM_DESTROY, ExitApplication
);
Compile it, and the compiler gives out an error:
D:\Projects\cyau\cyau_pre3_20120225\cyau_main.cpp:116:15: warning: left operand of comma operator has no effect [-Wunused-value]
D:\Projects\cyau\cyau_pre3_20120225\cyau_main.cpp:117:2: error: initializer fails to determine size of ‘OnMsgMap’
So, How to correct it, please.
You need two pairs of curly braces (one for the array, one for the struct), instead of a single pair of parentheses.