Annotation of mstools/samples/printer/printer.h, revision 1.1.1.1

1.1       root        1: /******************************************************************************\
                      2: *
                      3: *                                PRINTER.H
                      4: *
                      5: \******************************************************************************/
                      6: 
                      7: 
                      8: 
                      9: /******************************************************************************\
                     10: *                             SYMBOLIC CONSTANTS
                     11: \******************************************************************************/
                     12: 
                     13: #define IDM_PRINT                 101  // menu id's
                     14: #define IDM_PRINTDLG              102
                     15: #define IDM_GETDEVICECAPS         103
                     16: #define IDM_ENUMPRINTERS          104
                     17: #define IDM_GETPRINTERDRIVER      105
                     18: #define IDM_ENUMPRINTERDRIVERS    106
                     19: #define IDM_REFRESH               107
                     20: #define IDM_ABOUT                 108
                     21: 
                     22: #define IDM_HIENGLISH             201
                     23: #define IDM_HIMETRIC              202
                     24: #define IDM_LOENGLISH             203
                     25: #define IDM_LOMETRIC              204
                     26: #define IDM_TWIPS                 205
                     27: #define IDM_ISOTROPIC             206
                     28: #define IDM_ANISOTROPIC           207
                     29: #define IDM_TEXT                  208
                     30: 
                     31: #define IDM_ARC                   301
                     32: #define IDM_ELLIPSE               302
                     33: #define IDM_LINETO                303
                     34: #define IDM_PIE                   304
                     35: #define IDM_PLGBLT                305
                     36: #define IDM_POLYBEZIER            306
                     37: #define IDM_POLYGON               307
                     38: #define IDM_POLYLINE              308
                     39: #define IDM_POLYPOLYGON           309
                     40: #define IDM_RECTANGLE             310
                     41: #define IDM_ROUNDRECT             311
                     42: #define IDM_STRETCHBLT            312
                     43: #define IDM_ALLGRAPHICS           313
                     44: #define IDM_NOGRAPHICS            314
                     45: #define IDM_ENUMFONTS             315
                     46: #define IDM_DRAWAXIS              316
                     47: 
                     48: #define IDM_SETPENCOLOR           401
                     49: #define IDM_PENWIDTH_1            402
                     50: #define IDM_PENWIDTH_2            403
                     51: #define IDM_PENWIDTH_3            404
                     52: #define IDM_PENWIDTH_4            405
                     53: #define IDM_PENWIDTH_5            406
                     54: #define IDM_PENWIDTH_6            407
                     55: #define IDM_PENWIDTH_7            408
                     56: #define IDM_PENWIDTH_8            409
                     57: #define IDM_PENCOLOR_SOLID        410
                     58: #define IDM_PENCOLOR_DASH         411
                     59: #define IDM_PENCOLOR_DOT          412
                     60: #define IDM_PENCOLOR_DASHDOT      413
                     61: #define IDM_PENCOLOR_DASHDOTDOT   414
                     62: #define IDM_PENCOLOR_NULL         415
                     63: #define IDM_PENCOLOR_INSIDEFRAME  416
                     64: 
                     65: #define IDM_SETBRUSHCOLOR         501
                     66: #define IDM_BRUSHSTYLE_SOLID      502
                     67: #define IDM_BRUSHSTYLE_BDIAGONAL  503
                     68: #define IDM_BRUSHSTYLE_CROSS      504
                     69: #define IDM_BRUSHSTYLE_DIAGCROSS  505
                     70: #define IDM_BRUSHSTYLE_FDIAGONAL  506
                     71: #define IDM_BRUSHSTYLE_HORIZONTAL 507
                     72: #define IDM_BRUSHSTYLE_VERTICAL   508
                     73: #define IDM_BRUSHSTYLE_FDIAGONAL1 509
                     74: #define IDM_BRUSHSTYLE_BDIAGONAL1 510
                     75: #define IDM_BRUSHSTYLE_DENSE1     511
                     76: #define IDM_BRUSHSTYLE_DENSE2     512
                     77: #define IDM_BRUSHSTYLE_DENSE3     513
                     78: #define IDM_BRUSHSTYLE_DENSE4     514
                     79: #define IDM_BRUSHSTYLE_DENSE5     515
                     80: #define IDM_BRUSHSTYLE_DENSE6     516
                     81: #define IDM_BRUSHSTYLE_DENSE7     517
                     82: #define IDM_BRUSHSTYLE_DENSE8     518
                     83: #define IDM_BRUSHSTYLE_NOSHADE    519
                     84: #define IDM_BRUSHSTYLE_HALFTONE   520
                     85: 
                     86: #define IDM_TEXTCOLOR             601
                     87: 
                     88: #define ID_COMBOBOX               701  // toolbar combobox id
                     89: 
                     90: #define MAIN_ICON                 1
                     91: #define MAIN_MENU_NAME            "MENU"
                     92: #define MAIN_CLASS_NAME           "PRINTER"
                     93: #define MAIN_WND_TITLE            "Printer Sample Application"
                     94: #define MAIN_CLASS_STYLE          CS_HREDRAW | CS_VREDRAW
                     95: #define MAIN_WND_STYLE            WS_OVERLAPPEDWINDOW
                     96: 
                     97: #define MAX_MAP_MODES             8    // # items in gaMMLookup
                     98: #define MAX_PENWIDTHS             8    // # items in gaPenWidths
                     99: #define MAX_PENSTYLES             7    // # items in gaPenStyles
                    100: #define MAX_BRUSHSTYLES           19   // # items in gaBrushStyles
                    101: 
                    102: #define ERR_MOD_NAME              "Error: PRINTER.EXE (PRINTER.C)"
                    103: 
                    104: 
                    105: 
                    106: /******************************************************************************\
                    107: *                                 TYPEDEFS
                    108: \******************************************************************************/
                    109: 
                    110: typedef struct tagMAPMODELOOKUP
                    111: {
                    112:   WORD   wMenuItem;
                    113:   int    iMapMode;
                    114: 
                    115: } MAPMODELOOKUP;
                    116: 
                    117: typedef struct tagGRAPHICLOOKUP
                    118: {
                    119:   WORD   wMenuItem;
                    120:   DWORD  dwGraphic;
                    121: 
                    122: } GRAPHICLOOKUP;
                    123: 
                    124: typedef struct tagPENWIDTHLOOKUP
                    125: {
                    126:   WORD   wMenuItem;
                    127:   int    iPenWidth;
                    128: 
                    129: } PENWIDTHLOOKUP;
                    130: 
                    131: typedef struct tagPENSTYLELOOKUP
                    132: {
                    133:   WORD   wMenuItem;
                    134:   int    iPenStyle;
                    135: 
                    136: } PENSTYLELOOKUP;
                    137: 
                    138: typedef struct tagBRUSHSTYLELOOKUP
                    139: {
                    140:   WORD   wMenuItem;
                    141:   int    iBrushStyle;
                    142: 
                    143: } BRUSHSTYLELOOKUP;
                    144: 
                    145: typedef struct tagSTATUSBARLOOKUP
                    146: {
                    147:   WORD   wMenuItem;
                    148:   LPCSTR szText;
                    149: 
                    150: } STATUSBARLOOKUP;
                    151: 
                    152: 
                    153: 
                    154: /******************************************************************************\
                    155: *                                GLOBAL VARS
                    156: \******************************************************************************/
                    157: 
                    158: HANDLE  ghInst;                        // app instance handle
                    159: HWND    ghwndMain;                     // main app window handle
                    160: HWND    ghwndAbort;                    // Abort dialog handle
                    161: LONG    glcyMenu;                      // menu height
                    162: DWORD   gdwGraphicsOptions = DRAWAXIS; // current graphic options (to display)
                    163: int     giMapMode = MM_TEXT;           // current map mode
                    164: HDC     ghdc;                          // device context to print on
                    165: BOOL    gbAbort;                       // AbortProc return code
                    166: 
                    167: char    gszDeviceName[BUFSIZE];        // current device name
                    168: char    gszPort      [BUFSIZE];        // current port
                    169: char    gszDriverName[BUFSIZE];        // current driver name
                    170: 
                    171: DWORD   gdwPenColor   = 0x00ff00;      // current pen color
                    172: DWORD   gdwBrushColor = 0x0000ff;      // current brush color
                    173: DWORD   gdwTextColor =  0xff0000;      // current text color
                    174: 
                    175: int     giPenStyle   = PS_SOLID;       // current pen style
                    176: int     giPenWidth   = 1;              // current pen width
                    177: int     giBrushStyle = HS_SOLID;       // current brush style
                    178: 
                    179: MAPMODELOOKUP gaMMLookup[] =
                    180: 
                    181:     { { IDM_HIENGLISH  , MM_HIENGLISH   },
                    182:       { IDM_HIMETRIC   , MM_HIMETRIC    },
                    183:       { IDM_LOENGLISH  , MM_LOENGLISH   },
                    184:       { IDM_LOMETRIC   , MM_LOMETRIC    },
                    185:       { IDM_TWIPS      , MM_TWIPS       },
                    186:       { IDM_ISOTROPIC  , MM_ISOTROPIC   },
                    187:       { IDM_ANISOTROPIC, MM_ANISOTROPIC },
                    188:       { IDM_TEXT       , MM_TEXT        } };
                    189: 
                    190: GRAPHICLOOKUP gaGraphicLookup[] =
                    191: 
                    192:     { { IDM_ARC        , ARC         },
                    193:       { IDM_ELLIPSE    , ELLIPSE     },
                    194:       { IDM_LINETO     , LINETO      },
                    195:       { IDM_PIE        , PIE         },
                    196:       { IDM_PLGBLT     , PLG_BLT     },
                    197:       { IDM_POLYBEZIER , POLYBEZIER  },
                    198:       { IDM_POLYGON    , POLYGON     },
                    199:       { IDM_POLYLINE   , POLYLINE    },
                    200:       { IDM_POLYPOLYGON, POLYPOLYGON },
                    201:       { IDM_RECTANGLE  , RECTANGLE   },
                    202:       { IDM_ROUNDRECT  , ROUNDRECT   },
                    203:       { IDM_STRETCHBLT , STRETCH_BLT } };
                    204: 
                    205: PENWIDTHLOOKUP gaPenWidths[] =
                    206: 
                    207:     { { IDM_PENWIDTH_1, 1 },
                    208:       { IDM_PENWIDTH_2, 2 },
                    209:       { IDM_PENWIDTH_3, 3 },
                    210:       { IDM_PENWIDTH_4, 4 },
                    211:       { IDM_PENWIDTH_5, 5 },
                    212:       { IDM_PENWIDTH_6, 6 },
                    213:       { IDM_PENWIDTH_7, 7 },
                    214:       { IDM_PENWIDTH_8, 8 } };
                    215: 
                    216: PENSTYLELOOKUP gaPenStyles[] =
                    217: 
                    218:     { { IDM_PENCOLOR_SOLID      , PS_SOLID      },
                    219:       { IDM_PENCOLOR_DASH       , PS_DASH       },
                    220:       { IDM_PENCOLOR_DOT        , PS_DOT        },
                    221:       { IDM_PENCOLOR_DASHDOT    , PS_DASHDOT    },
                    222:       { IDM_PENCOLOR_DASHDOTDOT , PS_DASHDOTDOT },
                    223:       { IDM_PENCOLOR_NULL       , PS_NULL       },
                    224:       { IDM_PENCOLOR_INSIDEFRAME, PS_INSIDEFRAME} };
                    225: 
                    226: BRUSHSTYLELOOKUP gaBrushStyles[] =
                    227: 
                    228:     { { IDM_BRUSHSTYLE_SOLID     , HS_SOLID     },
                    229:       { IDM_BRUSHSTYLE_BDIAGONAL , HS_BDIAGONAL },
                    230:       { IDM_BRUSHSTYLE_CROSS     , HS_CROSS     },
                    231:       { IDM_BRUSHSTYLE_DIAGCROSS , HS_DIAGCROSS },
                    232:       { IDM_BRUSHSTYLE_FDIAGONAL , HS_FDIAGONAL },
                    233:       { IDM_BRUSHSTYLE_HORIZONTAL, HS_HORIZONTAL},
                    234:       { IDM_BRUSHSTYLE_VERTICAL  , HS_VERTICAL  },
                    235:       { IDM_BRUSHSTYLE_FDIAGONAL1, HS_FDIAGONAL1},
                    236:       { IDM_BRUSHSTYLE_BDIAGONAL1, HS_BDIAGONAL1},
                    237:       { IDM_BRUSHSTYLE_DENSE1    , HS_DENSE1    },
                    238:       { IDM_BRUSHSTYLE_DENSE2    , HS_DENSE2    },
                    239:       { IDM_BRUSHSTYLE_DENSE3    , HS_DENSE3    },
                    240:       { IDM_BRUSHSTYLE_DENSE4    , HS_DENSE4    },
                    241:       { IDM_BRUSHSTYLE_DENSE5    , HS_DENSE5    },
                    242:       { IDM_BRUSHSTYLE_DENSE6    , HS_DENSE6    },
                    243:       { IDM_BRUSHSTYLE_DENSE7    , HS_DENSE7    },
                    244:       { IDM_BRUSHSTYLE_DENSE8    , HS_DENSE8    },
                    245:       { IDM_BRUSHSTYLE_NOSHADE   , HS_NOSHADE   },
                    246:       { IDM_BRUSHSTYLE_HALFTONE  , HS_HALFTONE  } };
                    247: 
                    248: 
                    249: 
                    250: /******************************************************************************\
                    251: *                            FUNCTION PROTOTYPES
                    252: \******************************************************************************/
                    253: 
                    254: LRESULT CALLBACK MainWndProc   (HWND, UINT, WPARAM, LPARAM);
                    255: LRESULT CALLBACK AboutDlgProc  (HWND, UINT, WPARAM, LPARAM);
                    256: LRESULT CALLBACK AbortDlgProc  (HWND, UINT, WPARAM, LPARAM);
                    257: 
                    258: BOOL    CALLBACK AbortProc     (HDC, int);
                    259: 
                    260: void    InvalidateClient       (void);
                    261: void    RefreshPrinterCombobox (HWND);
                    262: void    PrintThread            (LPVOID);

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.