News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Resource File Errors

Started by slippnslide, July 25, 2006, 12:04:39 AM

Previous topic - Next topic

slippnslide

This is the resource script I'm using:
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

Quote from: slippnslide on July 25, 2006, 12:04:39 AM
This is the resource script I'm using:
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

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

Quote from: slippnslide 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.

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

slippnslide

Whoops, I should point out that this is my complete .rc file.  So, line 7 points to the "STYLE" line.

#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

Quote from: slippnslide 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.

#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) Select

#include <windows.h>

slippnslide

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:
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

Quote from: slippnslide 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:
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) Select

#define IDC_STATIC -1

slippnslide

Awesome, thanks! :D  It works fine now.

sethjackson