Announcement

Collapse
No announcement yet.

Multiple resource files?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple resource files?

    I've got a lot of animated gif's I'm putting in this app, and size is not an issue (We're still only slightly above half a meg).

    I would rather put all the animated gif's in a separate resource file, if possible..

    Is it?


    I would want to call both resource files from one app tho..

    But I could use this resource file again in the future....


    Scott

    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    #include

    ------------------
    hellobasic

    Comment


    • #3
      Scott --

      You can only have one #RESOURCE metastatement in each module, at least in part because of the serious problems that would be caused if the same resource ID number or string was used in both. For example, what if two resource files contained icons that used the ID number 101? What is Windows supposed to do when you tell it to load #101?

      The best way to do what you're talking about is to create a "resource DLL". Each module can have its own resource file, because resources are addressed by a combination of the module handle and the resource ID. Normally with a resource DLL (i.e. one that contain no functions) you dynamically load the DLL with the LoadLibrary API, which returns the module handle. You can then use that handle plus the resource ID to access the components that are embedded in the resource.

      It's also a great way to put different "faces" on a program without recompiling them. Install a different resource DLL, and the program looks/sounds different. You can even do it "on the fly" if your program uses FreeLibrary and then loads a different DLL.

      -- Eric

      ------------------
      Perfect Sync: Perfect Sync Development Tools
      Email: mailto:[email protected][email protected]</A>



      [This message has been edited by Eric Pearson (edited February 07, 2001).]
      "Not my circus, not my monkeys."

      Comment


      • #4
        I like that idea!
        This project may be too small for that, but I will make a note of that for future reference!!


        Thanks!
        The #include did just fine in this case, but future use, I can see some potential here...


        Scott

        ------------------
        Scott
        mailto:[email protected][email protected]</A>
        Scott Turchin
        MCSE, MCP+I
        http://www.tngbbs.com
        ----------------------
        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

        Comment


        • #5
          Ah, I understand Edwin's resonse now. It refers to #include as a line in a resource file, which brings in other resource files when the the RES file is compiled, not #INCLUDE in your source code, which brings in other source code files when an EXE or DLL is compiled.

          One final note about the "resource DLL" concept: It is an excellent way to internationalize an application without changing the core program. If 100% of your program's dialogs and display strings are located in a resource DLL, all you have to do is create a new resource DLL using a different language...

          -- Eric

          ------------------
          Perfect Sync: Perfect Sync Development Tools
          Email: mailto:[email protected][email protected]</A>
          "Not my circus, not my monkeys."

          Comment


          • #6
            Agreed on that! I saw some code at a former employer, they do multiple languages and it was pretty c ool to see how they used the resource file to do the menu's in a foreign language

            Scott


            ------------------
            Scott
            mailto:[email protected][email protected]</A>
            Scott Turchin
            MCSE, MCP+I
            http://www.tngbbs.com
            ----------------------
            True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

            Comment


            • #7
              The most common way to do that is to re-compile the program for each language. But using a resource DLL means that the main EXE can read an INI file (or the command line, or whatever) to tell it which "display language" to load. The core program doesn't have to change at all.

              -- Eric


              ------------------
              Perfect Sync: Perfect Sync Development Tools
              Email: mailto:[email protected][email protected]</A>

              [This message has been edited by Eric Pearson (edited February 07, 2001).]
              "Not my circus, not my monkeys."

              Comment

              Working...
              X