I have this problem with my ( .rc) file i do not know why

#include "digitron_h.h"




MENU_ID MENU 
BEGIN      
POPUP  "&File"
                        {
                        MENUITEM  "E&xit", EXIT_ID
                        }
         
    
POPUP  "&Help"
                        {
                        MENUITEM  "H&elp About", HELP_ID
                        }
END

ID_DIALOGEX DIALOG 0, 0, 98, 52
STYLE  DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "calc"
FONT 8, "MS Sans Serif"
{
}

When i delete row with STYLE the program working .
Thank you for your effort of reading.

Recommended Answers

All 9 Replies

Have you seen this tutorial? You should use the BEGIN and END tags, not the braces you posted.

Yes i sow that and have no difference.
I used that({ }) in my last program .
But anyway that does not slow my problem.

>>I have this problem with my ( .rc) file i do not know why
What exactly is the problem you are having. Won't it compile? If not what errors do you get ? And what compiler are you using?

I am using Dev-C++ with gcc and g++ .

i got this message
22 C:\Documents and Settings\USER\Desktop\New Folder\digitron_rc.rc [Resource error] syntax error
That is on the style selected.

when i delete style then program working .
Here is te ( digitron_c.c)

#include <windows.h>
#include "digitron_h.h"


/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK DialogProc(HWND,UINT ,WPARAM ,LPARAM );

/*  Make the class name into a global variable  */
char szClassName[ ] = "WindowsApp";
HWND  Dialog=NULL;
int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName =MAKEINTRESOURCE(MENU_ID);                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           "Windows App",       /* Title Text */
           WS_OVERLAPPEDWINDOW, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           544,                 /* The programs width */
           375,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );


           
         
    /* Make the window visible on the screen */
    ShowWindow (hwnd, SW_HIDE);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
}


/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                  /* handle the messages */
    {   case WM_CREATE:
        Dialog=CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(ID_DIALOGEX),hwnd,DialogProc);
        ShowWindow(hwnd,SW_SHOW & WS_VISIBLE);
        
        break;
        
       case WM_COMMAND:
        {
        
                                      switch(LOWORD(wParam))
                                        {
                                        case EXIT_ID:
                                        PostMessage(NULL,WM_DESTROY,0,0);
                                        break;
                                        default:
                                        return DefWindowProc (hwnd, message, wParam, lParam);
                                        }
       }
       
        
       case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;
       default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}
BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
   
        return TRUE;
}

The program is not finished so i just copy this
digitron_h.h

#define  MENU_ID  11
#define  EXIT_ID  12
#define  HELP_ID  13

#define  ID_1      1
#define  ID_2      2  
#define  ID_3      3
#define  ID_4      4
#define  ID_5      5
#define  ID_6      6
#define  ID_7      7
#define  ID_8      8
#define  ID_9      9
#define  ID_0      0

#define ID_EDITTEXT   14
#define ID_DIALOGEX   15

And the ( .rc) file is up there.

You might get better help from here. I can replicate the problem but not sure why it occurs.

>I am using Dev-C++ with gcc and g++.

You need to #include <windows.h> in your resource script (digitron_rc.rc) to ensure that all resource definition statements are defined for the resource compiler.

>You need to #include <windows.h> in your resource script (digitron_rc.rc).

Nope. Didn't fix the problem. I copy/paste the dialog box rc stuff from the tutorial and it doesn't compile either.

>Didn't fix the problem

Strange, it should - for good measure I tried it with the code(resource script) supplied in this thread, amended as I described, and it compiles, error free with:

windres -O COFF digitron_h.rc -o digitron_h.res
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.