## Presentation Device Driver Reference for OS/2

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

### GreEscape DEVESC_STARTDOC_WPROP - Remarks

DEVESC_STARTDOC_WPROP is used to change the job properties at the beginning of a document. Since this function is new, applications will call GreEscape DEVESC_QUERYESCSUPPORT to determine if you support this DevEscape.

The DevEscape path has a handle to a device context (HDC) that should already have printer property information associated with the HDC. Job property information may change or may be dependent upon the printer property information in the HDC. In that case, if an application passes job properties for a different device or for a different spooler printer name, then misleading information will be returned.

This function will change all characteristics of the HDC and PS. An application must query again information such as DevQueryCaps, DevQueryHardcopyCaps, the list of device fonts, and so on. In addition, all previously opened memory DCs are no longer considered compatible with the DC.

You also should check the version level of the graphics engine, since GreResetDC2 is a new API and only exists on engine levels 0x0234 and above. If you are using an older version level, then treat DEVESC_STARTDOC_WPROP as a DEVESC_STARTDOC.

This function also performs the same actions as calling DEVESC_STARTDOC.

    LONG ENGENTRY Escape (HDC       hdc,
                          LONG      lEscape,
                          LONG      cInCount,
                          PBYTE     pInData,
                          PLONG     pcOutCount,
                          PBYTE     pOutData,
                          PDDC      pddc,
                          ULONG     ulFunction)
    {
       switch (lEscape)
       {
       case DEVESC_STARTDOC:
       case DEVESC_STARTDOC_WPROP:
       {
          if (GRE_234 > globals.ulGreVersion)
          {
             /* Switch DEVESC_STARTDOC_WPROP to DEVESC_STARTDOC
             ** on back level versions of the engine.
             */
             lEscape = DEVESC_STARTDOC;
             break;
          }

          if (DEVESC_STARTDOC_WPROP == lEscape)
          {
             /* This does a number of things such as:
             **   1) Sanity check input driver data
             **   2) Walk through new job properties and set up
             **      DC information (papersize, orientation, color depth, etc)
             **   3) Set up device surface structure
             */
             ReinitializeWithJobProps (pddc, (PDRIVDATA)pOutData);
          }

          // For Raw Data only jobs do not need to reset device surface
          if (!pddc->pdb->fRawOnly)
             /* This does a number of things such as:
             **   1) Allocate the device surface memory
             **   2) Call engine's SetDeviceSurface function.
             */
             CreateAndSetDeviceSurface (pddc);

          if (DEVESC_STARTDOC_WPROP == lEscape)
          {
             /* Inform the engine that your characteristics have changed
             ** and it should requery the information.
             */
             GreResetDC2 (pddc->pdb->hdc, 0);
          }

          // Normal STARTDOC processing follows...
          break;
       }
       }

       return lrc;
    }