Dialog box in win32

This is a discussion on Dialog box in win32 within the C++ Programming forums, part of the General Programming Boards category; Im just learning about windows applications and i was trying to create a dialog box, but i keep getting an ...

  1. #1
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972

    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.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  2. #2
    Registered User matheo917's Avatar
    Join Date
    Sep 2001
    Posts
    279
    wrong forum...........you should post this on Windows Programming Forum....

  3. #3
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    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

  4. #4
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    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.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  5. #5
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    stovellp is right.
    Try enclosing the second switch statement with curly braces.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 01:59 PM
  2. Parent of a BrowseForFolder dialog box
    By @nthony in forum Windows Programming
    Replies: 4
    Last Post: 01-08-2007, 01:54 PM
  3. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 07:00 PM
  4. Dialog Box & Property Sheet :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 08-01-2002, 01:33 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21