Jump to Case label

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • newguy194
    New Member
    • May 2007
    • 25

    Jump to Case label

    I am currently writing a Win32 application and when I compile I get a "Jump to case label" error and another error tellling me that switch(LOWORD(w Param)) is unreachable in the switch, when I remove the first case IDB_BUTTON it runs fine, but with it there are several compile errors.


    Code:
    LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg,
    			   WPARAM wParam, LPARAM lParam)
    {
        switch(Msg)
        {
        case WM_COMMAND:
             switch(LOWORD(wParam))
             {
                case IDB_BUTTON:
                  int leng = GetWindowTextLength(GetDlgItem(hWnd, IDB_EDITDATA)) + 1;
                    char temp[leng];
                    GetDlgItemText(hWnd, IDB_EDITDATA, temp, leng);
                    toencrypt.assign(temp);
                    delete [] temp;
                    leng = GetWindowTextLength(GetDlgItem(hWnd, IDB_EDIT)) + 1;
                    char temp2[leng];
                    GetDlgItemText(hWnd, IDB_EDIT, temp2, leng);
                    key.assign(temp2);
                    delete [] temp2;
                    encrypt();
                    break;
               case BTE_DECRYPT:
                     int lengh = GetWindowTextLength(GetDlgItem(hWnd, IDB_EDITDATA)) + 1;
                     char tempor[lengh];
                     GetDlgItemText(hWnd, IDB_EDITDATA, tempor, lengh);
                     todecrypt.assign(tempor);
                     delete [] tempor;
                     lengh = GetWindowTextLength(GetDlgItem(hWnd, IDB_EDIT)) + 1;
                     char tempore[lengh];
                     GetDlgItemText(hWnd, IDB_EDIT, tempore, lengh);
                     key.assign(tempore);
                     delete [] tempore;
                     decrypt(); 
                     break;
               default:
                       break;
    
             }
       break;
        case WM_DESTROY:
            // user wants to exit
            PostQuitMessage(WM_QUIT);
            break;
        default:
            // Hand off unprocessed messages to DefWindowProc
            return DefWindowProc(hWnd, Msg, wParam, lParam);
        }
        
        return 0;
    }
  • newguy194
    New Member
    • May 2007
    • 25

    #2
    I would really appreciate help, I can't figure out the problem.

    Comment

    • sicarie
      Recognized Expert Specialist
      • Nov 2006
      • 4677

      #3
      Originally posted by newguy194
      I would really appreciate help, I can't figure out the problem.
      newguy194-

      It's considered rude and annoying to bump a thread only a few hours old. People are looking at it, and they will continue to look at it, but please have some patience.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        It's something else.

        This compiles OK:
        [code=cpp]
        LRESULT CALLBACK WndProcedure(HW ND hWnd, UINT Msg,
        WPARAM wParam, LPARAM lParam)
        {
        switch(Msg)
        {
        case WM_COMMAND:
        switch(LOWORD(w Param))
        {
        case 10:
        break;
        default:
        break;

        }
        break;
        case WM_DESTROY:
        // user wants to exit
        PostQuitMessage (WM_QUIT);
        break;
        default:
        // Hand off unprocessed messages to DefWindowProc
        return DefWindowProc(h Wnd, Msg, wParam, lParam);
        }

        return 0;
        }
        [/code]
        which is basically your code with the switch guts removed and a phony case added.

        Comment

        Working...