Author Topic: Resource File Errors  (Read 8137 times)

slippnslide

  • Guest
Resource File Errors
« on: July 25, 2006, 12:04:39 am »
This is the resource script I'm using:
Code
503 DIALOG 10, 26, 235, 50
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Window Title"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Test line of text", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 15, 12, 165, 8
   CONTROL "Enter #", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 27, 70, 8
   CONTROL "", 201, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 95, 25, 65, 12
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 176, 7, 50, 14
   CONTROL "Quit", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 176, 24, 50, 14
}[/quit]
When I compile this with MinGW, I keep getting errors in the script.  Does anyone see what's wrong with it or how to get it to work?  So far, the only thing I've gotton to work resource-related is icons.

sethjackson

  • Guest
Re: Resource File Errors
« Reply #1 on: July 25, 2006, 01:10:30 am »
This is the resource script I'm using:
Code
503 DIALOG 10, 26, 235, 50
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Window Title"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Test line of text", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 15, 12, 165, 8
   CONTROL "Enter #", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 27, 70, 8
   CONTROL "", 201, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 95, 25, 65, 12
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 176, 7, 50, 14
   CONTROL "Quit", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 176, 24, 50, 14
}
When I compile this with MinGW, I keep getting errors in the script.  Does anyone see what's wrong with it or how to get it to work?  So far, the only thing I've gotton to work resource-related is icons.

What are the errors you get with MinGW?

slippnslide

  • Guest
Re: Resource File Errors
« Reply #2 on: July 25, 2006, 02:37:09 am »
None.  The resource compiler is giving me the errors.  It isn't very specific.  It says there's an error on line 7.  I delete line 7 and re-build.  Same error until I end up deleting the whole script.

sethjackson

  • Guest
Re: Resource File Errors
« Reply #3 on: July 25, 2006, 02:44:18 am »
None.  The resource compiler is giving me the errors.  It isn't very specific.  It says there's an error on line 7.  I delete line 7 and re-build.  Same error until I end up deleting the whole script.

Ok. I think it is because CONTROL isn't defined. :)

slippnslide

  • Guest
Re: Resource File Errors
« Reply #4 on: July 25, 2006, 03:02:16 am »
Whoops, I should point out that this is my complete .rc file.  So, line 7 points to the "STYLE" line.

Code
#include "resource.h"

IDI_MYICON ICON "icon.ico"


503 DIALOG 10, 26, 235, 50
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Window Title"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Test line of text", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 15, 12, 165, 8
   CONTROL "Enter #", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 27, 70, 8
   CONTROL "", 201, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 95, 25, 65, 12
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 176, 7, 50, 14
   CONTROL "Quit", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 176, 24, 50, 14
}

sethjackson

  • Guest
Re: Resource File Errors
« Reply #5 on: July 25, 2006, 03:04:54 am »
Whoops, I should point out that this is my complete .rc file.  So, line 7 points to the "STYLE" line.

Code
#include "resource.h"

IDI_MYICON ICON "icon.ico"


503 DIALOG 10, 26, 235, 50
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Window Title"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
   CONTROL "Test line of text", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 15, 12, 165, 8
   CONTROL "Enter #", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 27, 70, 8
   CONTROL "", 201, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 95, 25, 65, 12
   CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 176, 7, 50, 14
   CONTROL "Quit", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 176, 24, 50, 14
}

Ok.

I think you forgot to

Code: cpp
#include <windows.h>

slippnslide

  • Guest
Re: Resource File Errors
« Reply #6 on: July 25, 2006, 03:30:14 am »
Okay, thanks.  That fixed part of the problem :P  Now, all the "CONTROL"s are coming up with errors.  I tried another program's resource script:
Code
IDD_DIALOG_MAIN DIALOG DISCARDABLE  0, 0, 370, 234
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
    WS_SYSMENU
CAPTION "Check POP Mail"
FONT 8, "MS Sans Serif"
BEGIN
    LTEXT           "POP Server Name",IDC_STATIC,6,8,60,8
    EDITTEXT        IDC_SERVERNAME,6,18,113,13,ES_AUTOHSCROLL
    LTEXT           "User ID",IDC_STATIC,6,39,26,8
    EDITTEXT        IDC_USERID,6,49,113,13,ES_AUTOHSCROLL
    LTEXT           "Password",IDC_STATIC,6,71,32,8
    EDITTEXT        IDC_PASSWORD,6,81,113,13,ES_PASSWORD | ES_AUTOHSCROLL
    DEFPUSHBUTTON   "Check &Mail...",ID_CHECKMAIL,37,111,50,14
    PUSHBUTTON      "&Close",IDCANCEL,37,127,50,14
    EDITTEXT        IDC_EDIT1,135,8,222,216,ES_MULTILINE | ES_AUTOVSCROLL |
                    ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP
END
And this doesn't compile either.  It gives errors on the lines after "BEGIN".  Is there another header I need?

sethjackson

  • Guest
Re: Resource File Errors
« Reply #7 on: July 25, 2006, 03:39:40 am »
Okay, thanks.  That fixed part of the problem :P  Now, all the "CONTROL"s are coming up with errors.  I tried another program's resource script:
Code
IDD_DIALOG_MAIN DIALOG DISCARDABLE  0, 0, 370, 234
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
    WS_SYSMENU
CAPTION "Check POP Mail"
FONT 8, "MS Sans Serif"
BEGIN
    LTEXT           "POP Server Name",IDC_STATIC,6,8,60,8
    EDITTEXT        IDC_SERVERNAME,6,18,113,13,ES_AUTOHSCROLL
    LTEXT           "User ID",IDC_STATIC,6,39,26,8
    EDITTEXT        IDC_USERID,6,49,113,13,ES_AUTOHSCROLL
    LTEXT           "Password",IDC_STATIC,6,71,32,8
    EDITTEXT        IDC_PASSWORD,6,81,113,13,ES_PASSWORD | ES_AUTOHSCROLL
    DEFPUSHBUTTON   "Check &Mail...",ID_CHECKMAIL,37,111,50,14
    PUSHBUTTON      "&Close",IDCANCEL,37,127,50,14
    EDITTEXT        IDC_EDIT1,135,8,222,216,ES_MULTILINE | ES_AUTOVSCROLL |
                    ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP
END
And this doesn't compile either.  It gives errors on the lines after "BEGIN".  Is there another header I need?

I don't think you need another header..... I think the above code doesn't work because MinGW doesn't define IDC_STATIC for you.

Do this

Code: cpp
#define IDC_STATIC -1

slippnslide

  • Guest
Re: Resource File Errors
« Reply #8 on: July 25, 2006, 04:15:59 am »
Awesome, thanks! :D  It works fine now.

sethjackson

  • Guest
Re: Resource File Errors
« Reply #9 on: July 25, 2006, 01:28:21 pm »
Awesome, thanks! :D  It works fine now.

Sure: :D