Extended types for objects Extended ressources Extended types and ressource editor
Programming guideline of WinDom

Programming with extended objects

There is no difference to use a normal obect or an extended one. If the extended object has a text, you have to use the ObjcString() function to read or change this text because the access is different with these objects.

To install the extended objects, you have to call the RsrcXtype() function. There are two case :

  1. The ressource is extern (load in memory with the RsrcLoad(), not the rsrc_load() function!), you just have to invoke :

                 RsrcXtype( 1, NULL, 0);
    
    This call installs the extended objects,

  2. the ressource is intern (it is included in the source during, the compilation), the color icons have to be fixed to the current screen resolution with the function RsrcFixCicon() then the extended object are installed with RsrcXtype().

We illustrate these two case with a C example.

First case : external ressource

    #include <windom.h>
    #include "myrsc.h"

    void main(void) {
        ApplInit();

        /* WinDom version of rsrc_load() */
        RsrcLoad( "myrsc.rsc");

        /* Extended type are installed : */
        RsrcXtype( 1,       /* Install the new types */
                   NULL,    /* Work on the external ressource */
                   0);      /* idem */

        /* body of program */

        /* End of program */

        /* Uninstall the extended objects */
        RsrcXtype( 0, NULL, 0);

        /* Free up the memory and AES */
        RsrcFree();
        ApplExit();
    }
Second case : integrated ressource

    #include <windom.h>
    #include "myrsc.h"
    #include "myrsc.rh"
    #include "myrsc.rsh"


    void main( void) {
        int dum;
        XRSRCFIX fix;   /* Used by RsrcFixCicon() and
                         * RsrcFreeCicon() */

        ApplInit();

        /* Fixe the oject coordinate to the screen resolution */
        for( dum=0; dum<NUM_OBS; dum++)
             rsrc_obfix( rs_object, dum);

        /* Install the extended objects */
        RsrcXtype( 1,           /* Install */
                   rs_trindex,  /* address of tree objects */
                   NUM_TREE);   /* Number of tree objects */

        /* Note : you can use simultaneously severals
                  intern ressources and an extern ressource */

        /* If the ressource contains color icons, fix it to
         * the current screen resolution */
        RsrcFixCicon( rs_object, /* address of objects */
                      NUM_OBS,   /* number of objects */
                      NUM_CIB,   /* number of color icons */
                      NULL,      /* an optional color palet */
                      &fix);     /* Used later by RsrcFreeCicon() */

        /* body of program */

        /* Free up memory used by the color icons */
        RsrcFreeCicon( &fix);

        /* Free zup memory and AES */
        RsrcXtype( 0, rs_trindex, NUM_TREE);
        ApplExit();
    }