CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2005
    Posts
    23

    How to include .rc file in another .rc file

    I tried to use the following code to include a resource file in another resource file:
    Code:
    "
    1 TEXTINCLUDE DISCARDABLE 
    BEGIN
        "resource.h\0"
    END
    
    2 TEXTINCLUDE DISCARDABLE 
    BEGIN
        "#include ""afxres.h""\r\n"
        "#include ""..\\..\\..\\common\\resources\\resource.h""\0"
    END
    
    3 TEXTINCLUDE DISCARDABLE 
    BEGIN
        "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
        "#define _AFX_NO_OLE_RESOURCES\r\n"
        "#define _AFX_NO_TRACKER_RESOURCES\r\n"
        "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
        "\r\n"
        "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
        "#ifdef _WIN32\r\n"
        "LANGUAGE 9, 1\r\n"
        "#pragma code_page(1252)\r\n"
        "#endif //_WIN32\r\n"
        "#include ""afxres.rc""         // Standard components\r\n"
        "#include ""..\\..\\..\\common\\resources\\commonEng.rc""\r\n"
        "#endif\r\n"
        "\0"
    END
    ...
    
    "
    All included files are in the proper location. The resource was compiled successfully. But the .res didn't have resources that defined in the included resource file, commonEng.rc. What is problem here?

    Thanks,
    Last edited by Ejaz; September 29th, 2005 at 07:24 AM. Reason: Code tag added

  2. #2
    Join Date
    Jan 2002
    Location
    Houston, TX
    Posts
    1,421

    Re: How to include .rc file in another .rc file

    Not sure if this will help, but try the following:

    Code:
    2 TEXTINCLUDE DISCARDABLE 
    BEGIN
    "#include ""afxres.h""\r\n"
    "#include ""..\\..\\..\\common\\resources\\resource.h""\r\n"
    "\0"
    END
    
    3 TEXTINCLUDE DISCARDABLE 
    BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "#ifdef _WIN32\r\n"
    "LANGUAGE 9, 1\r\n"
    "#pragma code_page(1252)\r\n"
    "#endif //_WIN32\r\n"
    "#include ""afxres.rc"" // Standard components\r\n"
    "#include ""..\\..\\..\\common\\resources\\commonEng.rc"" //common rc\r\n"
    "#endif\r\n"
    "\0"
    END
    Good luck.
    Be sure to rate those who help!
    -------------------------------------------------------------
    Karl - WK5M
    PP-ASEL-IA (N43CS)
    PGP Key: 0xDB02E193
    PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

  3. #3
    Join Date
    May 1999
    Location
    West Sussex, England
    Posts
    1,939

    Re: How to include .rc file in another .rc file

    Are the resources in your included .rc file in a different language? If they are, they will be ignored by the resource compiler.

    You can tell what language your building for by checking your project settings in the "Resources" page.

    Your .rc file will have a line like:

    Code:
    LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
    which is used to define what language the following resources are for.
    Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
    Please remember to rate useful answers. It lets us know when a question has been answered.

  4. #4
    Join Date
    Sep 2005
    Posts
    23

    Re: How to include .rc file in another .rc file

    Thanks, krmed and Roger Allen.

    Finally I found there should be another include line to repeatly include the same file. After I added that line, that is ok.

    Thanks,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured