-
Dialog box in win32
Im just learning about windows applications and i was trying to create a dialog box, but i keep getting an error: "127 winapp2.cpp
parse error before `{'"
(using Dev C++ 4)
Heres the code i'm using to create the dialog box:
Code:
BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
{
return TRUE;
}
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
EndDialog(hwnd, IDOK);
break;
case IDCANCEL:
EndDialog(hwnd, IDCANCEL);
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
It might be a problem with another part of my code but if someone can see a problem with this let me know.
-
wrong forum...........you should post this on Windows Programming Forum....
-
It may be because you have a switch statement inside a 'case' for another switch statement. Perhaps try changing it to
Code:
switch(variable)
{
case Number:
{
switch(variable2)
{
case .....
}
}
break;
}
Although I reserve the right to be totally wrong about this
-
I don't immediately see a problem in the code you've posted. post the whole cpp file and we'll have a better shot of helping you. and matheo, the problem appears to be a c++ problem so I guess the thread is ok here.
-
stovellp is right.
Try enclosing the second switch statement with curly braces.