Thread: Lamest .rc problem

  1. #1
    Enthusiastic Beginner balazsbotond's Avatar
    Join Date
    Mar 2007
    Location
    Érd, Hungary
    Posts
    20

    Lamest .rc problem

    I know this is lame, but I've spent the whole night searching for an answer, and found nothing (maybe the problem's with me?...).

    Okay, so here it is:

    Code:
    IDD_ABOUT DIALOG DISCARDABLE  0, 0, 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
    MinGW throws a syntax error at line 2 (STYLE...), and I can't figure out why.

    Thx in advance

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Code:
    #include <Windows.h>
    Try adding this to your resource file (I think). If this is totally wrong, I apologize. Leaving right now and didn't have much of a chance to check this out.

  3. #3
    Enthusiastic Beginner balazsbotond's Avatar
    Join Date
    Mar 2007
    Location
    Érd, Hungary
    Posts
    20
    What a dumb idiot I am. Including windows.h solved it.

    But YET it throws another syntax error at the line with GROUPBOX. Really sorry for these stupid questions, I'm quite new to programming.

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>MinGW<<

    Just #include <afxres.h> - it's a dummy version of the ms header of the same name which just #includes <windows.h> as MacGyver helpfully suggested previously and defines IDC_STATIC for you.

    Alternatively, just:
    Code:
    #include <windows.h>
    #if !defined IDC_STATIC
    #define IDC_STATIC -1
    #endif
    in your resource script.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    Enthusiastic Beginner balazsbotond's Avatar
    Join Date
    Mar 2007
    Location
    Érd, Hungary
    Posts
    20
    Thx, this worked.

  6. #6
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Not to discourage you in the least, but if you're new to programming, I would suggest sticking with practicing writing console based applications before moving on to writing GUI based programs. GUI programming in general requires knowledge and familiarity with lots of concepts and language features, which are considered slightly advanced to a brand new beginner (ie. pointers, dynamic memory, etc....)

    Console programming lets you get good at the language without worrying about too many more details as to what window is doing what when.

  7. #7
    Enthusiastic Beginner balazsbotond's Avatar
    Join Date
    Mar 2007
    Location
    Érd, Hungary
    Posts
    20
    MacGyver,
    I'm trying to make a (very simple) GUI for one of my existing programs, and if I find it too hard, I'll stick with the console of course. And thanks for your advice

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 05:46 PM