Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FiveWin 1.9.2 - January 97 - <b>2.2 exe resources vs. dll resources</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 2.2 EXE resources vs. DLL resources
--------------------------------------------------------------------------------

  There are two main ways to store the resources of your applications:

     1.- Inside your .EXE file
     2.- Inside an external DLL

   Both systems are very powerful, but there are some important
   differences you should know:

   1.- The biggest benefit of storing an .RC file (using Microsoft
   resource compiler RC.EXE -included with Microsoft, Borland, Symantec...-)
   is that you may use DEFINEs as a replacement for the controls IDs.

   This means you don't have to remember 'strange' numbers, and also
   that under any source code or resources modification you will
   make fewer mistakes.

   Sample:

   REDEFINE GET cName ID 110 OF oDlg     // using an ID number 110

   Instead of that:

   #define ID_NAME 110

   REDEFINE GET cName ID ID_NAME OF oDlg

   This one has the benefit that you may create a .CH file with all
   those #define's and the resource editor let you use it when modifying
   the .RC file:

   MyApp.RC

   #include "WinApi.ch"       // provided with FiveWin
   #include "MyApp.ch"        // your IDs definitions are here !!!

   Clients DIALOG ...
   CONTROL ... ID_NAME,

   Based on our experience we do recommend storing a .RC file inside your
   .EXEs because it is much easier to control IDs and avoid errors.

   The SAMPLES\Build.bat batch file we provide with FiveWin, automatically
   will call RC.EXE if detects a file with extension .RC with the same
   name of our application. Basically what we do in build.bat is:

                       RC -K MyApp

   This will store MyApp.RC resources inside your MyApp.EXE file.

   There is no need to specify a command SET RESOURCES TO ... in your
   application if you take this route, because your EXE file already
   knows how to locate the resources inside itself.

   The only disadvantage of this system is that every time you build your
   EXE you have to compile the RC and place it inside the EXE again -though
   this process is extremely fast!-

   2.- The big benefit of storing resources inside a DLL is that
   you may really have Data Driven DialogBoxes, because if you modify
   the DLL resources (using your resource editor) there will be no
   need to recompile again your EXE! This may be a great advantage
   when developing very large applications.

   We provide an empty DLL to be copied when you develop a new application
   as an empty storage system where you may place all your resources:

      COPY screens.dll MyApp.dll     // we provide an 'empty' screens.dll

   Now you edit it with your resource editor:

      WorkShop MyApp.dll           // Or open it as a DLL

   Later in your application you specify:

      SET RESOURCES TO "MyApp.dll"

   And you are ready to start using your resources. Remember that if you
   decide to put your resources inside your app (using .RC and RC.EXE)
   there is no need to specify SET RESOURCES TO... as the .EXE already
   has all them inside.

   The great disadvantage of this system is that you are not allowed
   to use labels if you use a DLL to store resources ! Neither Borland
   resource editor nor Microsoft let you use a .CH or .H file where
   you may store your #define's if you store your resources inside a DLL.

   Both systems are excellent, and we do recommend you to test both of
   them and decide by yourself which system suits better your needs.


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson