Listing 3 Retrieving display device characteristics

struct DeviceInfo
{
 WORD version;
 WORD technology;
 WORD horzRes;        /* pixels */
 WORD vertRes;        /* lines */
 WORD adjacentPixel;
 WORD colorPlanes;
 WORD colorTable;
 WORD paletteSize;
 WORD reservedPalette;
 WORD bitsPerPixel;
 int  BANDsupport;    /* T or F */
 int  BM64support;    /* T or F */
 int  GDIBsupport;    /* T or F */
 int  SDIBTDsupport;  /* T or F */
 int  PALsupport;     /* T or F */
} devInf;

void getDeviceCapsInfo (HDC, hDC,
                  struct DeviceInfo *devInf)
  {
  WORD rcaps;

  devInf->version =
       (WORD)GetDeviceCaps(hDC,DRIVERVERSION);
  devInf->technology =
       (WORD)GetDeviceCaps(hDC,TECHNOLOGY);
  devInf->horzRes =
       (WORD)GetDeviceCaps(hDC,HORZRES);
  devInf->vertRes =
       (WORD)GetDeviceCaps(hDC,VERTRES);
  devInf->adjacentPixel =
       (WORD)GetDeviceCaps(hDC,BITSPIXEL);
  devInf->colorPlanes =
       (WORD)GetDeviceCaps(hDC,PLANES);
  devInf->colorTable =
       (WORD)GetDeviceCaps(hDC,NUMCOLORS);
  devInf->paletteSize =
       (WORD)GetDeviceCaps(hDC,SIZEPALETTE);
  devInf->reservedPalette =
       (WORD)GetDeviceCaps(hDC,NUMRESERVED);
  devInf->bitsPerPixel =
       (WORD)GetDeviceCaps(hDC,COLORRES);

  rcaps = (WORD)GetDeviceCaps(hDC,RASTERCAPS);

  if (rcaps & RC_BANDING)
    devInf->BANDsupport = TRUE;
  else devInf->BANDsupport = FALSE;

  if (rcaps & RC_BITMAP64)
    devInf->BM64support = TRUE;
  else devInf->BM64support = FALSE;

  if (rcaps & RC_DI_BITMAP)
    devInf->GDIBsupport = TRUE;
  else devInf->GDIBsupport = FALSE;

  if (rcaps & RC_DIBTODEV)
    devInf->SDIBTDsupport = TRUE;
  else devInf->SDIBTDsupport = FALSE;

  if (rcaps & RC_PALETTE)
    devInf->PALsupport = TRUE;
  else devInf->PALsupport = FALSE;
 } /* getDeviceCapsInfo */

/* End of File */