Resource Error...

This is a discussion on Resource Error... within the Windows Programming forums, part of the Platform Specific Boards category; I'm making a text editor(Yeah, I'm a n00b). I'm trying to add a save option in the menu, however DevC++ ...

  1. #1
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942

    Resource Error...

    I'm making a text editor(Yeah, I'm a n00b). I'm trying to add a save option in the menu, however DevC++ keeps whining about
    some freakin' parse error.

    This is part of the WinProc.
    Code:
        case WM_COMMAND:
        {
            switch(LOWORD(wParam))
            {
                    case ID_FILE_EXIT:
                    {
                            DestroyWindow(hwnd);
                    }
                    break;
                    case ID_FILE_SAVE:
                    {
                            //save stuff here
                    }
                    break;
            }
        }
    This is part of the resource

    Code:
    IDR_MYMENU MENU
    BEGIN
        POPUP "&File"
        BEGIN
            MENUITEM "E&xit", ID_FILE_EXIT
            MENUITEM "S&ave", ID_FILE_SAVE
        END
    There's more stuff, of course, but that's the error part. I'm not sure about how to get the resource to work.

  2. #2
    jasondoucette.com JasonD's Avatar
    Join Date
    Mar 2003
    Posts
    278
    The code looks fine to me. Just one note: For the ID_FILE_SAVE case, you should call SendMessage(hwnd,WM_CLOSE,0,0); instead of calling DestroyWindow() yourself. This is so you can later process WM_CLOSE and ask the user if she wishes to save an unsaved file or not, before the program closes down.

  3. #3
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Are ID_FILE_EXIT and ID_FILE_SAVE defined in your resource file? If not, include the appropriate header.

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    I had a similar problem and to fix it I needed to include windows.h in the resource script.
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. file reading
    By gunghomiller in forum C++ Programming
    Replies: 9
    Last Post: 08-07-2007, 11:55 PM
  2. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 12:54 PM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 09:39 AM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 04:23 PM

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