Sam Hu wrote:
<snip>
int  DialogFunc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
        switch(msg)
        {
                case WM_COMMAND:
                switch(LOWORD(wParam))
                {
                        case IDOK:
                        EndDialog(hwnd,1);
                        return 1;
                        case IDCANCEL:
                        EndDialog(hwnd,0);
                        return 1;
                }
                break;
                case WM_CLOSE:
                        EndDialog(hwnd,0);
                        return 1;
        }
<snip>

Your problem is right here: In D, switch statements must have default clauses of there's any chance of the value being switched not matching any of the switches. If there isn't, a SwitchError is thrown at runtime. Presumably, the program crashes because there's nothing catching the error before Windows does.

The same applies in the inner switch.

Stewart.

Reply via email to