Thread: Win32 Resource File Error (C++)

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    3

    Win32 Resource File Error (C++)

    Hello. I'm working on some win32 stuff, and I keep getting a syntax error in my resource file. I can't figure it out, because I'm kind of new to this stuff. Any help would be appreciated.
    Thanks!

    Here's my problem:
    Code:
    #include "resource.h"
    
    IDR_MYMENU MENU
    BEGIN    
             POPUP "&File"
             BEGIN
                  MENUITEM "&New", ID_FILE_NEW
                  MENUITEM "&Save",ID_FILE_SAVE
                  MENUITEM "&Open",ID_FILE_OPEN
                  MENUITEM "&Exit",ID_FILE_EXIT
             END
             POPUP "&Stuff"
             BEGIN 
                   MENUITEM "&Stuff",ID_STUFF_GO
                   MENUITEM "&Go Somewhere Else",0,GRAYED
             END
             POPUP "&Help"
             BEGIN
                   MENUITEM "&About...",IDD_ABOUT
             END
    END
    IDI_MYICON ICON "text.ico"
    
    IDD_ABOUT DIALOG DISCARDABLE 200, 150, 239, 66
    STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    CAPTION "My About Box"
    FONT 8, "MS Sans Serif"
    BEGIN
        DEFPUSHBUTTON   "&OK",IDOK,174,18,50,14
        PUSHBUTTON      "&Cancel",IDCANCEL,174,35,50,14
        GROUPBOX        "About this program...",IDC_STATIC,7,7,225,52
        CTEXT           "An example program showing how to use Dialog Boxes\r\n\r\nby theForger",
                        IDC_STATIC,16,18,144,33
    END
    The bolded line gives me a general syntax error. I'm using Dev-C++.
    Last edited by goldentoa11; 04-06-2011 at 11:54 AM.

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Did you try including <windows.h> as two of my Google results suggested.

    Tim S.

  3. #3
    Registered User
    Join Date
    Apr 2011
    Posts
    3

    Resource Script Error

    Hey, Tim,

    Thanks for your help. Including that file did fix the error. Maybe this sounds really stupid or should be really obvious to me, but why do I need to include <windows.h> in the resource file if it's in my main program?

    Goldentoa11

  4. #4
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    733
    Quote Originally Posted by goldentoa11 View Post
    Hey, Tim,

    Thanks for your help. Including that file did fix the error. Maybe this sounds really stupid or should be really obvious to me, but why do I need to include <windows.h> in the resource file if it's in my main program?

    Goldentoa11
    Because it is a separate translation unit. http://en.wikipedia.org/wiki/Transla...t_(programming)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 11-11-2010, 12:05 PM
  2. Memory Leak in AppWizard-Generated Code
    By jrohde in forum Windows Programming
    Replies: 4
    Last Post: 05-19-2010, 04:24 PM
  3. Can you help me about tolower() in file
    By nctar in forum C Programming
    Replies: 7
    Last Post: 05-12-2010, 10:04 AM
  4. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  5. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM

Tags for this Thread