## Presentation Device Driver Reference for OS/2

[prev][next][parent][TOC]

### DJP_ITEM Field - ulValue

ulValue (ULONG) Size is variable based on ulProperty.

There are two types of complexity: simple and complex. The _Sx_ and _Cx_ modifiers in the property definitions identify the complexity of ulValue. Simple types are ULONG in size and can be set directly using ulValue. Complex types are structures. To view them, first declare the corresponding property's type definition. Then choose either to use the DJP_SET_ELEMENT() macro to set the value, or to use the DJP_ELEMENTP() macro to return a pointer to the structure, as shown in the sample code below:

         /* simple DJP_SJ_COLOR:
         */
         PDJP_ITEM        pDJP;

         if (DJP_CLR_MONOCHROME == pDJP->ulValue)
            printf ("Monochrome\n");
         else if (DJP_CLR_COLOR == pDJP->ulValue)
            printf ("Color\n");

         /* complex DJP_CJ_RESOLUTION:
         */
         PDJP_ITEM         pDJP;
         DJPT_RESOLUTION   pElm;

         pElm = DJP_ELEMENTP  (*pDJP, DJPT_RESOLUTION);

         printf ("The resolution is (%d, %d)\n",
                 pElm->usXResolution,
                 pElm->usYResolution);

If you choose to use the DJP_ELEMENT() macro, code similar to the following may be used:

         /* simple DJP_SJ_COLOR:
         */
         PDJP_ITEM         pDJP;

         PDJP->ulValue = DJP_CLR_COLOR;

         /* complex DJP_CJ_RESOLUTION:
         */
         PDJP_ITEM         pDJP;
         DJPT_RESOLUTION   djpResolution;

         djpResolution.usXResolution = 720;
         djpResolution.usYResolution = 720;

         DJP_SET_ELEMENT (*pDJP, DJPT_RESOLUTION, djpResolution);