So, I'm having this REALLY weird problem with a switch statement. I'm manually converting code from a MSVC++ 6 application to a .NET 2003 application.
The following code compiles:
Code:
LRESULT CALLBACK DialogProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
{
break;
}
case WM_COMMAND:
{
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
case WM_CLOSE:
{
DestroyWindow(hWnd);
break;
}
default:
{
return FALSE;
}
}
return TRUE;
}
But when I add another case to the switch, like WM_WTF:
(WM_WTF is defined as #define WM_WTF (WM_USER + 20))
Code:
LRESULT CALLBACK DialogProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_WTF:
{
break;
}
case WM_INITDIALOG:
{
break;
}
case WM_COMMAND:
{
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
case WM_CLOSE:
{
DestroyWindow(hWnd);
break;
}
default:
{
return FALSE;
}
}
return TRUE;
}
It breaks everything and gives me the following errors:
error C2143: syntax error : missing ':' before ';'
error C2143: syntax error : missing ';' before ':'
error C2046: illegal case
error C2043: illegal break
...etc
So, wtf is going on?