Menu

Problem with *.rc, RCData, etc...

Thor
2007-10-02
2012-09-26
  • Thor

    Thor - 2007-10-02

    Hi, I'm doing a simple program with a resource.
    I start new project...add a resource file with this:
    101 RCData "empty.txt"

    Then in main.c I put:
    Resource = FindResource(NULL, MAKEINTRESOURCE(101), RT_RCDATA);
    if(Resource == NULL) printf("Error loading resource");

    And this don't work, it show the error message. But the code is ok, isn't?

    Then I've changed the code to: __
    Resource = FindResource(NULL, MAKEINTRESOURCE(101), "RCDATA");
    if(Resource == NULL) printf("Error loading resource");

    This work good.

    I believe that this is a problem of the "resource compiler", when you compile the project and see the executable file with a resource editor, you can see that the name is "RCDATA" uppercase and another compilers name the resource directory with "RCData".

    I've try change the name of the resource RCDATA to RCData and then the first code work good.

    Is it a problem? or I'm doing something bad.

    Regards.

     
    • Martian Man

      Martian Man - 2007-10-13

      Try to create a header file with 1 line: #define RCDATA 101
      Or if that doesn't work you might be able to use: #define ID_RCDATA 101
      Also, make sure you're including the header file windows.h in your C source file.
      Oh, and make sure the file "empty.txt" is in the same folder as your program.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.