GETCAPS.H
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:8k
源码类别:

Windows编程

开发平台:

Visual C++

  1. /******************************************************************************
  2. *       This is a part of the Microsoft Source Code Samples. 
  3. *       Copyright (C) 1993-1997 Microsoft Corporation.
  4. *       All rights reserved. 
  5. *       This source code is only intended as a supplement to 
  6. *       Microsoft Development Tools and/or WinHelp documentation.
  7. *       See these sources for detailed information regarding the 
  8. *       Microsoft samples programs.
  9. ******************************************************************************/
  10. /******************************************************************************
  11. *
  12. *                               GETCAPS.H
  13. *
  14. ******************************************************************************/
  15. #include "strings.h"
  16. /******************************************************************************
  17. *                           SYMBOLIC CONSTANTS
  18. ******************************************************************************/
  19. #define MAX_DEVICE_CAPS     34     // num entries in gaCaps table
  20. #define MAX_TECHNOLOGY_CAPS 7      // num entries in gaTechnologyCaps table
  21. #define MAX_CURVE_CAPS      10     // num entries in gaCurveCaps table
  22. #define MAX_LINE_CAPS       8      // num entries in gaLineCaps table
  23. #define MAX_POLYGON_CAPS    10     // num entries in gaPolygonCaps table
  24. #define MAX_TEXT_CAPS       16     // num entries in gaTextCaps table
  25. #define MAX_RASTER_CAPS     17     // num entries in gaRasterCaps table
  26. #define MAX_CLIP_CAPS       3      // num entries in gaClipCaps table
  27. #define BLANKS              "                 tt" // see gaCaps to get spacing
  28. #define ERR_MOD_NAME       IDS_ERR_GETCAPS
  29. /******************************************************************************
  30. *                                TYPEDEFS
  31. ******************************************************************************/
  32. typedef struct tagCAPSLOOKUP
  33. {
  34.   int     iValue;
  35.   LPTSTR  szValue;
  36. } CAPSLOOKUP;
  37. /******************************************************************************
  38. *                            GLOBAL VARIABLES
  39. ******************************************************************************/
  40. HWND ghwndDevCaps;
  41. CAPSLOOKUP gaCaps[] =
  42.     { { DRIVERVERSION,   "DRIVERVERSION:   t%ld"   },
  43.       { TECHNOLOGY,      "TECHNOLOGY:      t"      },
  44.       { HORZSIZE,        "HORZSIZE:        tt%ld" },
  45.       { VERTSIZE,        "VERTSIZE:        tt%ld" },
  46.       { HORZRES,         "HORZRES:         tt%ld" },
  47.       { VERTRES,         "VERTRES:         tt%ld" },
  48.       { BITSPIXEL,       "BITSPIXEL:       tt%ld" },
  49.       { PLANES,          "PLANES:          tt%ld" },
  50.       { NUMBRUSHES,      "NUMBRUSHES:      t%ld"   },
  51.       { NUMPENS,         "NUMPENS:         tt%ld" },
  52.       { NUMMARKERS,      "NUMMARKERS:      t%ld"   },
  53.       { NUMFONTS,        "NUMFONTS:        tt%ld" },
  54.       { NUMCOLORS,       "NUMCOLORS:       t%ld"   },
  55.       { PDEVICESIZE,     "PDEVICESIZE:     tt%ld" },
  56.       { CURVECAPS,       "CURVECAPS:       tt"    },
  57.       { LINECAPS,        "LINECAPS:        tt"    },
  58.       { POLYGONALCAPS,   "POLYGONALCAPS:   t"      },
  59.       { TEXTCAPS,        "TEXTCAPS:        tt"    },
  60.       { CLIPCAPS,        "CLIPCAPS:        tt"    },
  61.       { RASTERCAPS,      "RASTERCAPS:      t"      },
  62.       { ASPECTX,         "ASPECTX:         tt%ld" },
  63.       { ASPECTY,         "ASPECTY:         tt%ld" },
  64.       { ASPECTXY,        "ASPECTXY:        tt%ld" },
  65.       { LOGPIXELSX,      "LOGPIXELSX:      tt%ld" },
  66.       { LOGPIXELSY,      "LOGPIXELSY:      tt%ld" },
  67.       { SIZEPALETTE,     "SIZEPALETTE:     tt%ld" },
  68.       { NUMRESERVED,     "NUMRESERVED:     t%ld"   },
  69.       { COLORRES,        "COLORRES:        tt%ld" },
  70.       { PHYSICALWIDTH,   "PHYSICALWIDTH:   t%ld"   },
  71.       { PHYSICALHEIGHT,  "PHYSICALHEIGHT:  t%ld"   },
  72.       { PHYSICALOFFSETX, "PHYSICALOFFSETX: t%ld"   },
  73.       { PHYSICALOFFSETY, "PHYSICALOFFSETY: t%ld"   },
  74.       { SCALINGFACTORX,  "SCALINGFACTORX:  t%ld"   },
  75.       { SCALINGFACTORY,  "SCALINGFACTORY:  t%ld"   }  };
  76. CAPSLOOKUP gaTechnologyCaps[] =
  77.     { { DT_PLOTTER,      "DT_PLOTTER "      },
  78.       { DT_RASDISPLAY,   "DT_RASDISPLAY "   },
  79.       { DT_RASPRINTER,   "DT_RASPRINTER "   },
  80.       { DT_RASCAMERA,    "DT_RASCAMERA "    },
  81.       { DT_CHARSTREAM,   "DT_CHARSTREAM "   },
  82.       { DT_METAFILE,     "DT_METAFILE "     },
  83.       { DT_DISPFILE,     "DT_DISPFILE "     } };
  84. CAPSLOOKUP gaCurveCaps[] =
  85.     { { CC_NONE,         "CC_NONE "         },
  86.       { CC_CIRCLES,      "CC_CIRCLES "      },
  87.       { CC_PIE,          "CC_PIE "          },
  88.       { CC_CHORD,        "CC_CHORD "        },
  89.       { CC_ELLIPSES,     "CC_ELLIPSES "     },
  90.       { CC_WIDE,         "CC_WIDE "         },
  91.       { CC_STYLED,       "CC_STYLED "       },
  92.       { CC_WIDESTYLED,   "CC_WIDESTYLED "   },
  93.       { CC_INTERIORS,    "CC_INTERIORS "    },
  94.       { CC_ROUNDRECT,    "CC_ROUNDRECT "    } };
  95. CAPSLOOKUP gaLineCaps[] =
  96.     { { LC_NONE,         "LC_NONE "         },
  97.       { LC_POLYLINE,     "LC_POLYLINE "     },
  98.       { LC_MARKER,       "LC_MARKER "       },
  99.       { LC_POLYMARKER,   "LC_POLYMARKER "   },
  100.       { LC_WIDE,         "LC_WIDE "         },
  101.       { LC_STYLED,       "LC_STYLED "       },
  102.       { LC_WIDESTYLED,   "LC_WIDESTYLED "   },
  103.       { LC_INTERIORS,    "LC_INTERIORS "    } };
  104. CAPSLOOKUP gaPolygonCaps[] =
  105.     { { PC_NONE,         "PC_NONE "         },
  106.       { PC_POLYGON,      "PC_POLYGON "      },
  107.       { PC_RECTANGLE,    "PC_RECTANGLE "    },
  108.       { PC_WINDPOLYGON,  "PC_WINDPOLYGON"   },
  109.       { PC_TRAPEZOID,    "PC_TRAPEZOID"     },
  110.       { PC_SCANLINE,     "PC_SCANLINE"      },
  111.       { PC_WIDE,         "PC_WIDE"          },
  112.       { PC_STYLED,       "PC_STYLED"        },
  113.       { PC_WIDESTYLED,   "PC_WIDESTYLED"    },
  114.       { PC_INTERIORS,    "PC_INTERIORS"     } };
  115. CAPSLOOKUP gaTextCaps[] =
  116.     { { TC_OP_CHARACTER, "TC_OP_CHARACTER"  },
  117.       { TC_OP_STROKE,    "TC_OP_STROKE"     },
  118.       { TC_CP_STROKE,    "TC_CP_STROKE"     },
  119.       { TC_CR_90,        "TC_CR_90"         },
  120.       { TC_CR_ANY,       "TC_CR_ANY"        },
  121.       { TC_SF_X_YINDEP,  "TC_SF_X_YINDEP "  },
  122.       { TC_SA_DOUBLE,    "TC_SA_DOUBLE "    },
  123.       { TC_SA_INTEGER,   "TC_SA_INTEGER "   },
  124.       { TC_SA_CONTIN,    "TC_SA_CONTIN "    },
  125.       { TC_EA_DOUBLE,    "TC_EA_DOUBLE "    },
  126.       { TC_IA_ABLE,      "TC_IA_ABLE "      },
  127.       { TC_UA_ABLE,      "TC_UA_ABLE "      },
  128.       { TC_SO_ABLE,      "TC_SO_ABLE "      },
  129.       { TC_RA_ABLE,      "TC_RA_ABLE "      },
  130.       { TC_VA_ABLE,      "TC_VA_ABLE "      },
  131.       { TC_RESERVED,     "TC_RESERVED "     },
  132.       { TC_SCROLLBLT,    "TC_SCROLLBLT "     } };
  133. CAPSLOOKUP gaRasterCaps[] =
  134.     { { 0,               "RC_NONE "         }, // !!! RC_NONE not #def'd
  135.       { RC_BITBLT,       "RC_BITBLT "       },
  136.       { RC_BANDING,      "RC_BANDING "      },
  137.       { RC_SCALING,      "RC_SCALING "      },
  138.       { RC_BITMAP64,     "RC_BITMAP64 "     },
  139.       { RC_GDI20_OUTPUT, "RC_GDI20_OUTPUT " },
  140.       { RC_GDI20_STATE,  "RC_GDI20_STATE "  },
  141.       { RC_SAVEBITMAP,   "RC_SAVEBITMAP "   },
  142.       { RC_DI_BITMAP,    "RC_DI_BITMAP "    },
  143.       { RC_PALETTE,      "RC_PALETTE "      },
  144.       { RC_DIBTODEV,     "RC_DIBTODEV "     },
  145.       { RC_BIGFONT,      "RC_BIGFONT "      },
  146.       { RC_STRETCHBLT,   "RC_STRETCHBLT "   },
  147.       { RC_FLOODFILL,    "RC_FLOODFILL "    },
  148.       { RC_STRETCHDIB,   "RC_STRETCHDIB "   },
  149.       { RC_OP_DX_OUTPUT, "RC_OP_DX_OUTPUT " },
  150.       { RC_DEVBITS,      "RC_DEVBITS "      } };
  151. CAPSLOOKUP gaClipCaps[] =
  152.     { { CP_NONE,         "CP_NONE "         },
  153.       { CP_RECTANGLE,    "CP_RECTANGLE "    },
  154.       { CP_REGION,       "CP_REGION "       } };
  155. /******************************************************************************
  156. *                          EXTERNAL VARIABLES
  157. ******************************************************************************/
  158. extern HWND ghwndMain;
  159. extern char gszDeviceName [];
  160. extern char gszDriverName [];
  161. extern char gszPort       [];
  162. /******************************************************************************
  163. *                          FUNCTION PROTOTYPES
  164. ******************************************************************************/
  165. BOOL DisplayDeviceCapsInfo (void);
  166. void TranslateDeviceCaps   (int, int, int);
  167. void ComplexDeviceCapsLine (char *, CAPSLOOKUP *, int, int);