' ########################################################################################
' Microsoft Windows
' File: WinGDI.inc
' Contents: GDI procedure declarations, constant definitions and macros
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
' Note: windows.inc must be included before this file, but can't be done here.
' You must do it in your application.
#IF NOT %DEF(PBX_WinGDI_PBI)
#DEFINE PBX_WinGDI_PBI
%EQUATE `WINGDI_INC = 1
'#ifndef WINVER
'#define WINVER 0x0500 // version 5.0
'#endif /* WINVER */
'#IF NOT %DEF(%NOGDI) ' --------------------------------------------------------
'#ifndef NOGDI
#IF NOT %DEF(%NORASTEROPS) ' --------------------------------------------------
'#ifndef NORASTEROPS
'/* Binary raster ops */
%EQUATE `R2_BLACK = 1 ' /* 0 */
%EQUATE `R2_NOTMERGEPEN = 2 ' /* DPon */
%EQUATE `R2_MASKNOTPEN = 3 ' /* DPna */
%EQUATE `R2_NOTCOPYPEN = 4 ' /* PN */
%EQUATE `R2_MASKPENNOT = 5 ' /* PDna */
%EQUATE `R2_NOT = 6 ' /* Dn */
%EQUATE `R2_XORPEN = 7 ' /* DPx */
%EQUATE `R2_NOTMASKPEN = 8 ' /* DPan */
%EQUATE `R2_MASKPEN = 9 ' /* DPa */
%EQUATE `R2_NOTXORPEN = 10 ' /* DPxn */
%EQUATE `R2_NOP = 11 ' /* D */
%EQUATE `R2_MERGENOTPEN = 12 ' /* DPno */
%EQUATE `R2_COPYPEN = 13 ' /* P */
%EQUATE `R2_MERGEPENNOT = 14 ' /* PDno */
%EQUATE `R2_MERGEPEN = 15 ' /* DPo */
%EQUATE `R2_WHITE = 16 ' /* 1 */
%EQUATE `R2_LAST = 16
'/* Ternary raster operations */
%EQUATE `SRCCOPY = &H00CC0020 ' (DWORD) dest = source
%EQUATE `SRCPAINT = &H00EE0086 ' (DWORD) dest = source OR dest
%EQUATE `SRCAND = &H008800C6 ' (DWORD) dest = source AND dest
%EQUATE `SRCINVERT = &H00660046 ' (DWORD) dest = source XOR dest
%EQUATE `SRCERASE = &H00440328 ' (DWORD) dest = source AND (NOT dest )
%EQUATE `NOTSRCCOPY = &H00330008 ' (DWORD) dest = (NOT source)
%EQUATE `NOTSRCERASE = &H001100A6 ' (DWORD) dest = (NOT src) AND (NOT dest)
%EQUATE `MERGECOPY = &H00C000CA ' (DWORD) dest = (source AND pattern)
%EQUATE `MERGEPAINT = &H00BB0226 ' (DWORD) dest = (NOT source) OR dest
%EQUATE `PATCOPY = &H00F00021 ' (DWORD) dest = pattern
%EQUATE `PATPAINT = &H00FB0A09 ' (DWORD) dest = DPSnoo
%EQUATE `PATINVERT = &H005A0049 ' (DWORD) dest = pattern XOR dest
%EQUATE `DSTINVERT = &H00550009 ' (DWORD) dest = (NOT dest)
%EQUATE `BLACKNESS = &H00000042 ' (DWORD) dest = BLACK
%EQUATE `WHITENESS = &H00FF0062 ' (DWORD) dest = WHITE
'#if(WINVER >= 0x0500)
%EQUATE `NOMIRRORBITMAP = &H80000000 ' /* Do not Mirror the bitmap in this call */
%EQUATE `CAPTUREBLT = &H40000000 ' /* Include layered windows */
'#endif /* WINVER >= 0x0500 */
'/* Quaternary raster codes */
'#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore))
MACRO MAKEROP4(fore,back) = LO(DWORD,((back * 256) AND &HFF000000) OR fore)
'#endif /* NORASTEROPS */
#ENDIF ' #IF NOT %DEF(%NORASTEROPS) -----------------------------------------
'#define GDI_ERROR (0xFFFFFFFFL)
'#define HGDI_ERROR (LongToHandle(0xFFFFFFFFL))
%EQUATE `GDI_ERROR = &HFFFFFFFF
%EQUATE `HGDI_ERROR = &HFFFFFFFF
'/* Region Flags */
%EQUATE `RGN_ERROR = 0&
%EQUATE `NULLREGION = 1&
%EQUATE `SIMPLEREGION = 2&
%EQUATE `COMPLEXREGION = 3&
'/* CombineRgn() Styles */
%EQUATE `RGN_AND = 1&
%EQUATE `RGN_OR = 2&
%EQUATE `RGN_XOR = 3&
%EQUATE `RGN_DIFF = 4&
%EQUATE `RGN_COPY = 5&
%EQUATE `RGN_MIN = %RGN_AND
%EQUATE `RGN_MAX = %RGN_COPY
'/* StretchBlt() Modes */
%EQUATE `BLACKONWHITE = 1&
%EQUATE `WHITEONBLACK = 2&
%EQUATE `COLORONCOLOR = 3&
%EQUATE `HALFTONE = 4&
%EQUATE `MAXSTRETCHBLTMODE = 4&
'#if(WINVER >= 0x0400)
'/* New StretchBlt() Modes */
%EQUATE `STRETCH_ANDSCANS = %BLACKONWHITE
%EQUATE `STRETCH_ORSCANS = %WHITEONBLACK
%EQUATE `STRETCH_DELETESCANS = %COLORONCOLOR
%EQUATE `STRETCH_HALFTONE = %HALFTONE
'#endif /* WINVER >= 0x0400 */
'/* PolyFill() Modes */
%EQUATE `ALTERNATE = 1&
%EQUATE `WINDING = 2&
%EQUATE `POLYFILL_LAST = 2&
'/* Layout Orientation Options */
'#if(WINVER >= 0x0500)
%EQUATE `LAYOUT_RTL = &H00000001 ' // Right to left
%EQUATE `LAYOUT_BTT = &H00000002 ' // Bottom to top
%EQUATE `LAYOUT_VBH = &H00000004 ' // Vertical before horizontal
%EQUATE `LAYOUT_ORIENTATIONMASK = (%LAYOUT_RTL OR %LAYOUT_BTT OR %LAYOUT_VBH)
%EQUATE `LAYOUT_BITMAPORIENTATIONPRESERVED = &H00000008
'#endif /* WINVER >= 0x0500 */
'/* Text Alignment Options */
%EQUATE `TA_NOUPDATECP = 0
%EQUATE `TA_UPDATECP = 1
%EQUATE `TA_LEFT = 0
%EQUATE `TA_RIGHT = 2
%EQUATE `TA_CENTER = 6
'#define TA_TOP 0
'#define TA_BOTTOM 8
'#define TA_BASELINE 24
'#if (WINVER >= 0x0400)
'#define TA_RTLREADING 256
'#define TA_MASK (TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING)
'#else
'#define TA_MASK (TA_BASELINE+TA_CENTER+TA_UPDATECP)
'#endif
%EQUATE `TA_TOP = 0
%EQUATE `TA_BOTTOM = 8
%EQUATE `TA_BASELINE = 24
#IF (%WINVER >= &H0400)
%EQUATE `TA_RTLREADING = 256
%EQUATE `TA_MASK = %TA_BASELINE + %TA_CENTER + %TA_UPDATECP + %TA_RTLREADING
#ELSE
%EQUATE `TA_MASK = %TA_BASELINE + %TA_CENTER + %TA_UPDATECP
#ENDIF
%EQUATE `VTA_BASELINE = %TA_BASELINE
%EQUATE `VTA_LEFT = %TA_BOTTOM
%EQUATE `VTA_RIGHT = %TA_TOP
%EQUATE `VTA_CENTER = %TA_CENTER
%EQUATE `VTA_BOTTOM = %TA_RIGHT
%EQUATE `VTA_TOP = %TA_LEFT
%EQUATE `ETO_GRAYED = 1
%EQUATE `ETO_OPAQUE = 2
%EQUATE `ETO_CLIPPED = 4
'#if(WINVER >= 0x0400)
%EQUATE `ETO_GLYPH_INDEX = &H0010
%EQUATE `ETO_RTLREADING = &H0080
%EQUATE `ETO_NUMERICSLOCAL = &H0400
%EQUATE `ETO_NUMERICSLATIN = &H0800
%EQUATE `ETO_IGNORELANGUAGE = &H1000
'#endif /* WINVER >= 0x0400 */
'#if (_WIN32_WINNT >= 0x0500)
%EQUATE `ETO_PDY = &H2000
'#endif // (_WIN32_WINNT >= 0x0500)
'#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
%EQUATE `ETO_REVERSE_INDEX_MAP = &H10000
'#endif
%EQUATE `ASPECT_FILTERING = &H0001
'/* Bounds Accumulation APIs */
%EQUATE `DCB_RESET = &H0001
%EQUATE `DCB_ACCUMULATE = &H0002
%EQUATE `DCB_DIRTY = %DCB_ACCUMULATE
%EQUATE `DCB_SET = %DCB_RESET OR %DCB_ACCUMULATE
%EQUATE `DCB_ENABLE = &H0004
%EQUATE `DCB_DISABLE = &H0008
#IF NOT %DEF(%NOMETAFILE) ' ---------------------------------------------------
'#ifndef NOMETAFILE
'/* Metafile Functions */
%EQUATE `META_SETBKCOLOR = &H0201
%EQUATE `META_SETBKMODE = &H0102
%EQUATE `META_SETMAPMODE = &H0103
%EQUATE `META_SETROP2 = &H0104
%EQUATE `META_SETRELABS = &H0105
%EQUATE `META_SETPOLYFILLMODE = &H0106
%EQUATE `META_SETSTRETCHBLTMODE = &H0107
%EQUATE `META_SETTEXTCHAREXTRA = &H0108
%EQUATE `META_SETTEXTCOLOR = &H0209
%EQUATE `META_SETTEXTJUSTIFICATION = &H020A
%EQUATE `META_SETWINDOWORG = &H020B
%EQUATE `META_SETWINDOWEXT = &H020C
%EQUATE `META_SETVIEWPORTORG = &H020D
%EQUATE `META_SETVIEWPORTEXT = &H020E
%EQUATE `META_OFFSETWINDOWORG = &H020F
%EQUATE `META_SCALEWINDOWEXT = &H0410
%EQUATE `META_OFFSETVIEWPORTORG = &H0211
%EQUATE `META_SCALEVIEWPORTEXT = &H0412
%EQUATE `META_LINETO = &H0213
%EQUATE `META_MOVETO = &H0214
%EQUATE `META_EXCLUDECLIPRECT = &H0415
%EQUATE `META_INTERSECTCLIPRECT = &H0416
%EQUATE `META_ARC = &H0817
%EQUATE `META_ELLIPSE = &H0418
%EQUATE `META_FLOODFILL = &H0419
%EQUATE `META_PIE = &H081A
%EQUATE `META_RECTANGLE = &H041B
%EQUATE `META_ROUNDRECT = &H061C
%EQUATE `META_PATBLT = &H061D
%EQUATE `META_SAVEDC = &H001E
%EQUATE `META_SETPIXEL = &H041F
%EQUATE `META_OFFSETCLIPRGN = &H0220
%EQUATE `META_TEXTOUT = &H0521
%EQUATE `META_BITBLT = &H0922
%EQUATE `META_STRETCHBLT = &H0B23
%EQUATE `META_POLYGON = &H0324
%EQUATE `META_POLYLINE = &H0325
%EQUATE `META_ESCAPE = &H0626
%EQUATE `META_RESTOREDC = &H0127
%EQUATE `META_FILLREGION = &H0228
%EQUATE `META_FRAMEREGION = &H0429
%EQUATE `META_INVERTREGION = &H012A
%EQUATE `META_PAINTREGION = &H012B
%EQUATE `META_SELECTCLIPREGION = &H012C
%EQUATE `META_SELECTOBJECT = &H012D
%EQUATE `META_SETTEXTALIGN = &H012E
%EQUATE `META_CHORD = &H0830
%EQUATE `META_SETMAPPERFLAGS = &H0231
%EQUATE `META_EXTTEXTOUT = &H0A32
%EQUATE `META_SETDIBTODEV = &H0D33
%EQUATE `META_SELECTPALETTE = &H0234
%EQUATE `META_REALIZEPALETTE = &H0035
%EQUATE `META_ANIMATEPALETTE = &H0436
%EQUATE `META_SETPALENTRIES = &H0037
%EQUATE `META_POLYPOLYGON = &H0538
%EQUATE `META_RESIZEPALETTE = &H0139
%EQUATE `META_DIBBITBLT = &H0940
%EQUATE `META_DIBSTRETCHBLT = &H0B41
%EQUATE `META_DIBCREATEPATTERNBRUSH = &H0142
%EQUATE `META_STRETCHDIB = &H0F43
%EQUATE `META_EXTFLOODFILL = &H0548
'#if(WINVER >= 0x0500)
%EQUATE `META_SETLAYOUT = &H0149
'#endif /* WINVER >= 0x0500 */
%EQUATE `META_DELETEOBJECT = &H01F0
%EQUATE `META_CREATEPALETTE = &H00F7
%EQUATE `META_CREATEPATTERNBRUSH = &H01F9
%EQUATE `META_CREATEPENINDIRECT = &H02FA
%EQUATE `META_CREATEFONTINDIRECT = &H02FB
%EQUATE `META_CREATEBRUSHINDIRECT = &H02FC
%EQUATE `META_CREATEREGION = &H06FF
'#if(WINVER >= 0x0400)
' // Size = 20 bytes
TYPE DRAWPATRECT WORD
 ptPosition AS POINT
 ptSize AS POINT
 wStyle AS WORD ' WORD
 wPattern AS WORD ' WORD
END TYPE
'#endif /* WINVER >= 0x0400 */
'#endif /* NOMETAFILE */
#ENDIF ' #IF NOT %DEF(%NOMETAFILE) ------------------------------------------
'/* GDI Escapes */
%EQUATE `NEWFRAME = 1
%EQUATE `ABORTDOC = 2
%EQUATE `NEXTBAND = 3
%EQUATE `SETCOLORTABLE = 4
%EQUATE `GETCOLORTABLE = 5
%EQUATE `FLUSHOUTPUT = 6
%EQUATE `DRAFTMODE = 7
%EQUATE `QUERYESCSUPPORT = 8
%EQUATE `SETABORTPROC = 9
%EQUATE `STARTDOC = 10
%EQUATE `ENDDOC = 11
%EQUATE `GETPHYSPAGESIZE = 12
%EQUATE `GETPRINTINGOFFSET = 13
%EQUATE `GETSCALINGFACTOR = 14
%EQUATE `MFCOMMENT = 15
%EQUATE `GETPENWIDTH = 16
%EQUATE `SETCOPYCOUNT = 17
%EQUATE `SELECTPAPERSOURCE = 18
%EQUATE `DEVICEDATA = 19
%EQUATE `PASSTHROUGH = 19
%EQUATE `GETTECHNOLGY = 20
%EQUATE `GETTECHNOLOGY = 20
%EQUATE `SETLINECAP = 21
%EQUATE `SETLINEJOIN = 22
%EQUATE `SETMITERLIMIT = 23
%EQUATE `BANDINFO = 24
%EQUATE `DRAWPATTERNRECT = 25
%EQUATE `GETVECTORPENSIZE = 26
%EQUATE `GETVECTORBRUSHSIZE = 27
%EQUATE `ENABLEDUPLEX = 28
%EQUATE `GETSETPAPERBINS = 29
%EQUATE `GETSETPRINTORIENT = 30
%EQUATE `ENUMPAPERBINS = 31
%EQUATE `SETDIBSCALING = 32
%EQUATE `EPSPRINTING = 33
%EQUATE `ENUMPAPERMETRICS = 34
%EQUATE `GETSETPAPERMETRICS = 35
%EQUATE `POSTSCRIPT_DATA = 37
%EQUATE `POSTSCRIPT_IGNORE = 38
%EQUATE `MOUSETRAILS = 39
%EQUATE `GETDEVICEUNITS = 42
%EQUATE `GETEXTENDEDTEXTMETRICS = 256
%EQUATE `GETEXTENTTABLE = 257
%EQUATE `GETPAIRKERNTABLE = 258
%EQUATE `GETTRACKKERNTABLE = 259
%EQUATE `EXTTEXTOUT = 512
%EQUATE `GETFACENAME = 513
%EQUATE `DOWNLOADFACE = 514
%EQUATE `ENABLERELATIVEWIDTHS = 768
%EQUATE `ENABLEPAIRKERNING = 769
%EQUATE `SETKERNTRACK = 770
%EQUATE `SETALLJUSTVALUES = 771
%EQUATE `SETCHARSET = 772
%EQUATE `STRETCHBLT = 2048
%EQUATE `METAFILE_DRIVER = 2049
%EQUATE `GETSETSCREENPARAMS = 3072
%EQUATE `QUERYDIBSUPPORT = 3073
%EQUATE `BEGIN_PATH = 4096
%EQUATE `CLIP_TO_PATH = 4097
%EQUATE `END_PATH = 4098
%EQUATE `EXT_DEVICE_CAPS = 4099
%EQUATE `RESTORE_CTM = 4100
%EQUATE `SAVE_CTM = 4101
%EQUATE `SET_ARC_DIRECTION = 4102
%EQUATE `SET_BACKGROUND_COLOR = 4103
%EQUATE `SET_POLY_MODE = 4104
%EQUATE `SET_SCREEN_ANGLE = 4105
%EQUATE `SET_SPREAD = 4106
%EQUATE `TRANSFORM_CTM = 4107
%EQUATE `SET_CLIP_BOX = 4108
%EQUATE `SET_BOUNDS = 4109
%EQUATE `SET_MIRROR_MODE = 4110
%EQUATE `OPENCHANNEL = 4110
%EQUATE `DOWNLOADHEADER = 4111
%EQUATE `CLOSECHANNEL = 4112
%EQUATE `POSTSCRIPT_PASSTHROUGH = 4115
%EQUATE `ENCAPSULATED_POSTSCRIPT = 4116
%EQUATE `POSTSCRIPT_IDENTIFY = 4117 ' /* new escape for NT5 pscript driver */
%EQUATE `POSTSCRIPT_INJECTION = 4118 ' /* new escape for NT5 pscript driver */
%EQUATE `CHECKJPEGFORMAT = 4119
%EQUATE `CHECKPNGFORMAT = 4120
%EQUATE `GET_PS_FEATURESETTING = 4121 ' /* new escape for NT5 pscript driver */
%EQUATE `GDIPLUS_TS_QUERYVER = 4122 ' /* private escape */
%EQUATE `GDIPLUS_TS_RECORD = 4123 ' /* private escape */
'/*
' * Return Values for MILCORE_TS_QUERYVER
' */
'#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
%EQUATE `MILCORE_TS_QUERYVER_RESULT_FALSE = &H0
%EQUATE `MILCORE_TS_QUERYVER_RESULT_TRUE = &H7FFFFFFF
'#endif // (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
%EQUATE `SPCLPASSTHROUGH2 = 4568 ' /* new escape for NT5 pscript driver */
'/*
' * Parameters for POSTSCRIPT_IDENTIFY escape
' */
%EQUATE `PSIDENT_GDICENTRIC = 0
%EQUATE `PSIDENT_PSCENTRIC = 1
'/*
' * Header structure for the input buffer to POSTSCRIPT_INJECTION escape
' */
' // Size = 8 bytes
TYPE PSINJECTDATA WORD
 DataBytes AS DWORD ' DWORD /* number of raw data bytes (NOT including this header) */
 InjectionPoint AS WORD ' WORD /* injection point */
 PageNumber AS WORD ' WORD /* page number to apply the injection */
 ' /* Followed by raw data to be injected */
END TYPE
'/*
' * Constants for PSINJECTDATA.InjectionPoint field
' */
%EQUATE `PSINJECT_BEGINSTREAM = 1
%EQUATE `PSINJECT_PSADOBE = 2
%EQUATE `PSINJECT_PAGESATEND = 3
%EQUATE `PSINJECT_PAGES = 4
%EQUATE `PSINJECT_DOCNEEDEDRES = 5
%EQUATE `PSINJECT_DOCSUPPLIEDRES = 6
%EQUATE `PSINJECT_PAGEORDER = 7
%EQUATE `PSINJECT_ORIENTATION = 8
%EQUATE `PSINJECT_BOUNDINGBOX = 9
%EQUATE `PSINJECT_DOCUMENTPROCESSCOLORS = 10
%EQUATE `PSINJECT_COMMENTS = 11
%EQUATE `PSINJECT_BEGINDEFAULTS = 12
%EQUATE `PSINJECT_ENDDEFAULTS = 13
%EQUATE `PSINJECT_BEGINPROLOG = 14
%EQUATE `PSINJECT_ENDPROLOG = 15
%EQUATE `PSINJECT_BEGINSETUP = 16
%EQUATE `PSINJECT_ENDSETUP = 17
%EQUATE `PSINJECT_TRAILER = 18
%EQUATE `PSINJECT_EOF = 19
%EQUATE `PSINJECT_ENDSTREAM = 20
%EQUATE `PSINJECT_DOCUMENTPROCESSCOLORSATEND = 21
%EQUATE `PSINJECT_PAGENUMBER = 100
%EQUATE `PSINJECT_BEGINPAGESETUP = 101
%EQUATE `PSINJECT_ENDPAGESETUP = 102
%EQUATE `PSINJECT_PAGETRAILER = 103
%EQUATE `PSINJECT_PLATECOLOR = 104
%EQUATE `PSINJECT_SHOWPAGE = 105
%EQUATE `PSINJECT_PAGEBBOX = 106
%EQUATE `PSINJECT_ENDPAGECOMMENTS = 107
%EQUATE `PSINJECT_VMSAVE = 200
%EQUATE `PSINJECT_VMRESTORE = 201
'/*
' * InjectionPoint for publisher mode PScript5 OEM plugin to
' * generate DSC comment for included font resource
' */
%EQUATE `PSINJECT_DLFONT = &Hdddddddd
'/*
' * Parameter for GET_PS_FEATURESETTING escape
' */
%EQUATE `FEATURESETTING_NUP = 0
%EQUATE `FEATURESETTING_OUTPUT = 1
%EQUATE `FEATURESETTING_PSLEVEL = 2
%EQUATE `FEATURESETTING_CUSTPAPER = 3
%EQUATE `FEATURESETTING_MIRROR = 4
%EQUATE `FEATURESETTING_NEGATIVE = 5
%EQUATE `FEATURESETTING_PROTOCOL = 6
'#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
'//
'// The range of selectors between FEATURESETTING_PRIVATE_BEGIN and
'// FEATURESETTING_PRIVATE_END is reserved by Microsoft for private use
'//
%EQUATE `FEATURESETTING_PRIVATE_BEGIN = &H1000
%EQUATE `FEATURESETTING_PRIVATE_END = &H1FFF
'#endif // (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
'/*
' * Information about output options
' */
' // Size = 8 bytes
TYPE PSFEATURE_OUTPUT DWORD
 bPageIndependent AS LONG
 bSetPageDevice AS LONG
END TYPE
'/*
' * Information about custom paper size
' */
' // Size = 20 bytes
TYPE PSFEATURE_CUSTPAPER DWORD
 lOrientation AS LONG
 lWidth AS LONG
 lHeight AS LONG
 lWidthOffset AS LONG
 lHeightOffset AS LONG
END TYPE
'/* Value returned for FEATURESETTING_PROTOCOL */
%EQUATE `PSPROTOCOL_ASCII = 0
%EQUATE `PSPROTOCOL_BCP = 1
%EQUATE `PSPROTOCOL_TBCP = 2
%EQUATE `PSPROTOCOL_BINARY = 3
'/* Flag returned from QUERYDIBSUPPORT */
%EQUATE `QDI_SETDIBITS = 1
%EQUATE `QDI_GETDIBITS = 2
%EQUATE `QDI_DIBTOSCREEN = 4
%EQUATE `QDI_STRETCHDIB = 8
'/* Spooler Error Codes */
%EQUATE `SP_NOTREPORTED = &H4000
%EQUATE `SP_ERROR = -1
%EQUATE `SP_APPABORT = -2
%EQUATE `SP_USERABORT = -3
%EQUATE `SP_OUTOFDISK = -4
%EQUATE `SP_OUTOFMEMORY = -5
%EQUATE `PR_JOBSTATUS = &H0000
'/* Object Definitions for EnumObjects() */
%EQUATE `OBJ_PEN = 1
%EQUATE `OBJ_BRUSH = 2
%EQUATE `OBJ_DC = 3
%EQUATE `OBJ_METADC = 4
%EQUATE `OBJ_PAL = 5
%EQUATE `OBJ_FONT = 6
%EQUATE `OBJ_BITMAP = 7
%EQUATE `OBJ_REGION = 8
%EQUATE `OBJ_METAFILE = 9
%EQUATE `OBJ_MEMDC = 10
%EQUATE `OBJ_EXTPEN = 11
%EQUATE `OBJ_ENHMETADC = 12
%EQUATE `OBJ_ENHMETAFILE = 13
%EQUATE `OBJ_COLORSPACE = 14
%EQUATE `GDI_OBJ_LAST = %OBJ_COLORSPACE
'/* xform stuff */
%EQUATE `MWT_IDENTITY = 1
%EQUATE `MWT_LEFTMULTIPLY = 2
%EQUATE `MWT_RIGHTMULTIPLY = 3
%EQUATE `MWT_MIN = %MWT_IDENTITY
%EQUATE `MWT_MAX = %MWT_RIGHTMULTIPLY
'#define _XFORM_
#IF NOT %DEF(%XFORM)
%EQUATE `XFORM = 1
' // Size = 24 bytes
TYPE XFORM DWORD
 eM11 AS SINGLE ' FLOAT
 eM12 AS SINGLE ' FLOAT
 eM21 AS SINGLE ' FLOAT
 eM22 AS SINGLE ' FLOAT
 eDx AS SINGLE ' FLOAT
 eDy AS SINGLE ' FLOAT
END TYPE
#ENDIF
'/* Bitmap Header Definition */
' // Size = 24 bytes
TYPE BITMAP DWORD FILL
 bmType AS LONG
 bmWidth AS LONG
 bmHeight AS LONG
 bmWidthBytes AS LONG
 bmPlanes AS WORD ' WORD
 bmBitsPixel AS WORD ' WORD
 bmBits AS BYTE PTR
END TYPE
'#include <pshpack1.h>
' // Size = 3 bytes
TYPE RGBTRIPLE BYTE
 rgbtBlue AS BYTE
 rgbtGreen AS BYTE
 rgbtRed AS BYTE
END TYPE
'#include <poppack.h>
#IF NOT %DEF(%RGBQUAD_DEFINED)
%EQUATE `RGBQUAD_DEFINED = 1
' // Size = 4 bytes
TYPE RGBQUAD BYTE
 rgbBlue AS BYTE
 rgbGreen AS BYTE
 rgbRed AS BYTE
 rgbReserved AS BYTE
END TYPE
#ENDIF
'#if(WINVER >= 0x0400)
'/* Image Color Matching color definitions */
%EQUATE `CS_ENABLE = &H00000001
%EQUATE `CS_DISABLE = &H00000002
%EQUATE `CS_DELETE_TRANSFORM = &H00000003
'/* Logcolorspace signature */
'#define LCS_SIGNATURE 'PSOC'
%EQUATE `LCS_SIGNATURE = &H50534f43 ' "PSOC"
'/* Logcolorspace lcsType values */
'#define LCS_sRGB 'sRGB'
'#define LCS_WINDOWS_COLOR_SPACE 'Win ' // Windows default color space
%EQUATE `LCS_sRGB = &H73524742 ' "sRGB"
%EQUATE `LCS_WINDOWS_COLOR_SPACE = &H57696e20 ' "Win " ' Windows default color space
'typedef LONG LCSCSTYPE;
%EQUATE `LCS_CALIBRATED_RGB = &H00000000
'typedef LONG LCSGAMUTMATCH;
%EQUATE `LCS_GM_BUSINESS = &H00000001
%EQUATE `LCS_GM_GRAPHICS = &H00000002
%EQUATE `LCS_GM_IMAGES = &H00000004
%EQUATE `LCS_GM_ABS_COLORIMETRIC = &H00000008
'/* ICM Defines for results from CheckColorInGamut() */
%EQUATE `CM_OUT_OF_GAMUT = 255
%EQUATE `CM_IN_GAMUT = 0
'/* UpdateICMRegKey Constants */
%EQUATE `ICM_ADDPROFILE = 1
%EQUATE `ICM_DELETEPROFILE = 2
%EQUATE `ICM_QUERYPROFILE = 3
%EQUATE `ICM_SETDEFAULTPROFILE = 4
%EQUATE `ICM_REGISTERICMATCHER = 5
%EQUATE `ICM_UNREGISTERICMATCHER = 6
%EQUATE `ICM_QUERYMATCH = 7
'/* Macros to retrieve CMYK values from a COLORREF */
'#define GetKValue(cmyk) ((BYTE)(cmyk))
'#define GetYValue(cmyk) ((BYTE)((cmyk)>> 8))
'#define GetMValue(cmyk) ((BYTE)((cmyk)>>16))
'#define GetCValue(cmyk) ((BYTE)((cmyk)>>24))
'#define CMYK(c,m,y,k) ((COLORREF)((((BYTE)(k)|((WORD)((BYTE)(y))<<8))|(((DWORD)(BYTE)(m))<<16))|(((DWORD)(BYTE)(c))<<24)))
'MACRO GetKValue(dwCMYK) = LO(BYTE, dwCMYK)
'MACRO GetYValue(dwCMYK) = HI(BYTE, LO(WORD, dwCMYK)))
'MACRO GetMValue(dwCMYK) = LO(BYTE, HI(WORD, dwCMYK))
'MACRO GetCValue(dwCMYK) = HI(BYTE, HI(WORD, dwCMYK))
' // Not a macro because it conflicts with the cmyk member of the tagCOLOR union in Icm.inc
'MACRO CMYK(c,m,y,k) = (LO(BYTE, k) OR LO(BYTE, y) * 256 OR LO(BYTE, m) * 65536 OR LO(BYTE, c) * 65536 * 256)
FUNCTION GetKValue (BYVAL dwCMYK AS DWORD) AS BYTE
 FUNCTION = LO(BYTE, dwCMYK)
END FUNCTION
FUNCTION GetYValue (BYVAL dwCMYK AS DWORD) AS BYTE
 FUNCTION = (HI(BYTE, LO(WORD, dwCMYK)))
END FUNCTION
FUNCTION GetMValue (BYVAL dwCMYK AS DWORD) AS BYTE
 FUNCTION = LO(BYTE, HI(WORD, dwCMYK))
END FUNCTION
FUNCTION GetCValue (BYVAL dwCMYK AS DWORD) AS BYTE
 FUNCTION = HI(BYTE, HI(WORD, dwCMYK))
END FUNCTION
FUNCTION CMYK (BYVAL c AS BYTE, BYVAL m AS BYTE, BYVAL y AS BYTE, BYVAL k AS BYTE) AS DWORD
 FUNCTION = (LO(BYTE, k) OR LO(BYTE, y) * 256 OR LO(BYTE, m) * 65536 OR LO(BYTE, c) * 65536 * 256)
END FUNCTION
'typedef long FXPT16DOT16, FAR *LPFXPT16DOT16;
'typedef long FXPT2DOT30, FAR *LPFXPT2DOT30;
'/* ICM Color Definitions */
'// The following two structures are used for defining RGB's in terms of CIEXYZ.
' // Size = 12 bytes
TYPE CIEXYZ DWORD
 ciexyzX AS LONG ' FXPT2DOT30
 ciexyzY AS LONG ' FXPT2DOT30
 ciexyzZ AS LONG ' FXPT2DOT30
END TYPE
' // Size = 36 bytes
TYPE CIEXYZTRIPLE DWORD
 ciexyzRed AS CIEXYZ
 ciexyzGreen AS CIEXYZ
 ciexyBlue AS CIEXYZ
END TYPE
'// The next structures the logical color space. Unlike pens and brushes,
'// but like palettes, there is only one way to create a LogColorSpace.
'// A pointer to it must be passed, its elements can't be pushed as
'// arguments.
' // Size = 328 bytes
TYPE LOGCOLORSPACEA DWORD
 lcsSignature AS DWORD
 lcsVersion AS DWORD
 lcsSize AS DWORD
 lcsCSType AS LONG ' LCSCSTYPE
 lcsIntent AS LONG ' LCSGAMUTMATCH
 lcsEndPoints AS CIEXYZTRIPLE ' CIEXYZTRIPLE
 lcsGammaRed AS DWORD
 lcsGammaGreen AS DWORD
 lcsGammaBlue AS DWORD
 lcsFileName AS ASCIIZ * %MAX_PATH ' CHAR lcsFilename[MAX_PATH]
END TYPE
' // Size = 588 bytes
TYPE LOGCOLORSPACEW DWORD
 lcsSignature AS DWORD
 lcsVersion AS DWORD
 lcsSize AS DWORD
 lcsCSType AS LONG ' LCSCSTYPE
 lcsIntent AS LONG ' LCSGAMUTMATCH
 lcsEndPoints AS CIEXYZTRIPLE ' CIEXYZTRIPLE
 lcsGammaRed AS DWORD
 lcsGammaGreen AS DWORD
 lcsGammaBlue AS DWORD
 lcsFileName AS WSTRINGZ * %MAX_PATH ' WCHAR lcsFilename[MAX_PATH]
END TYPE
#IF %DEF(%UNICODE)
 MACRO LOGCOLORSPACE = LOGCOLORSPACEW
#ELSE
 MACRO LOGCOLORSPACE = LOGCOLORSPACEA
#ENDIF
'#endif /* WINVER >= 0x0400 */
'/* structures for defining DIBs */
' // Size = 12 bytes
TYPE BITMAPCOREHEADER DWORD FILL
 bcSize AS DWORD
 bcWidth AS WORD
 bcHeight AS WORD
 bcPlanes AS WORD
 bcBitCount AS WORD
END TYPE
' // Size = 40 bytes
TYPE BITMAPINFOHEADER DWORD FILL
 biSize AS DWORD
 biWidth AS LONG
 biHeight AS LONG
 biPlanes AS WORD
 biBitCount AS WORD
 biCompression AS DWORD
 biSizeImage AS DWORD
 biXPelsPerMeter AS LONG
 biYPelsPerMeter AS LONG
 biClrUsed AS DWORD
 biClrImportant AS DWORD
END TYPE
'#if(WINVER >= 0x0400)
' // Size = 108 bytes
TYPE BITMAPV4HEADER DWORD FILL
 bV4Size AS DWORD
 bV4Width AS LONG
 bV4Height AS LONG
 bV4Planes AS WORD
 bV4BitCount AS WORD
 bV4Compression AS DWORD
 bV4SizeImage AS DWORD
 bV4XPelsPerMeter AS LONG
 bV4YPelsPerMeter AS LONG
 bV4ClrUsed AS DWORD
 bV4ClrImportant AS DWORD
 bV4RedMask AS DWORD
 bV4GreenMask AS DWORD
 bV4BlueMask AS DWORD
 bV4AlphaMask AS DWORD
 bV4CSType AS DWORD
 bV4Endpoints AS CIEXYZTRIPLE
 bV4GammaRed AS DWORD
 bV4GammaGreen AS DWORD
 bV4GammaBlue AS DWORD
END TYPE
'#endif /* WINVER >= 0x0400 */
'#if (WINVER >= 0x0500)
' // Size = 124 bytes
TYPE BITMAPV5HEADER DWORD FILL
 bV5Size AS DWORD
 bV5Width AS LONG
 bV5Height AS LONG
 bV5Planes AS WORD
 bV5BitCount AS WORD
 bV5Compression AS DWORD
 bV5SizeImage AS DWORD
 bV5XPelsPerMeter AS LONG
 bV5YPelsPerMeter AS LONG
 bV5ClrUsed AS DWORD
 bV5ClrImportant AS DWORD
 bV5RedMask AS DWORD
 bV5GreenMask AS DWORD
 bV5BlueMask AS DWORD
 bV5AlphaMask AS DWORD
 bV5CSType AS DWORD
 bV5Endpoints AS CIEXYZTRIPLE
 bV5GammaRed AS DWORD
 bV5GammaGreen AS DWORD
 bV5GammaBlue AS DWORD
 bV5Intent AS DWORD
 bV5ProfileData AS DWORD
 bV5ProfileSize AS DWORD
 bV5Reserved AS DWORD
END TYPE
'// Values for bV5CSType
'#define PROFILE_LINKED 'LINK'
'#define PROFILE_EMBEDDED 'MBED'
%EQUATE `PROFILE_LINKED = &H4c494e4b ' "LINK"
%EQUATE `PROFILE_EMBEDDED = &H4d424544 ' "MBED"
'#endif
'/* constants for the biCompression field */
%EQUATE `BI_RGB = 0
%EQUATE `BI_RLE8 = 1
%EQUATE `BI_RLE4 = 2
%EQUATE `BI_BITFIELDS = 3
%EQUATE `BI_JPEG = 4
%EQUATE `BI_PNG = 5
'#if (_WIN32_WINNT >= 0x0400)
'#endif
' // Size = 44 bytes
TYPE BITMAPINFO DWORD
 bmiHeader AS BITMAPINFOHEADER
 bmiColors(0) AS RGBQUAD ' RGBQUAD
END TYPE
' // Size = 16 bytes
TYPE BITMAPCOREINFO DWORD
 bmciHeader AS BITMAPCOREHEADER
 bmciColors(0) AS RGBTRIPLE ' RGBTRIPLE bmciColors[1]
END TYPE
'#include <pshpack2.h>
' // Size = 14 bytes
TYPE BITMAPFILEHEADER WORD
 bfType AS WORD
 bfSize AS DWORD
 bfReserved1 AS WORD
 bfReserved2 AS WORD
 bfOffBits AS DWORD
END TYPE
'#include <poppack.h>
'#define MAKEPOINTS(l) (*((POINTS FAR *)&(l)))
MACRO MAKEPOINTS(l, pt)
 pt.x = LO(INTEGER, l)
 pt.y = HI(INTEGER, l)
END MACRO
'#if(WINVER >= 0x0400)
#IF NOT %DEF(%NOFONTSIG) ' --------------------------------------------------
'#ifndef NOFONTSIG
' // Size = 24 bytes
TYPE FONTSIGNATURE DWORD
 fsUsb(3) AS DWORD
 fsCsb(1) AS DWORD
END TYPE
' // Size = 32 bytes
TYPE CHARSETINFO DWORD
 ciCharset AS DWORD ' UINT
 ciACP AS DWORD ' UINT
 fs AS FONTSIGNATURE ' FONTSIGNATURE
END TYPE
%EQUATE `TCI_SRCCHARSET = 1
%EQUATE `TCI_SRCCODEPAGE = 2
%EQUATE `TCI_SRCFONTSIG = 3
'#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
%EQUATE `TCI_SRCLOCALE = &H1000
'#endif // (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
' // Size = 32 bytes
TYPE LOCALESIGNATURE DWORD
 lsUsb (3) AS DWORD
 lsCsbDefault (1) AS DWORD
 lsCsbSupported(1) AS DWORD
END TYPE
'#endif
#ENDIF ' #IF NOT %DEF(%NOFONTSIG) -----------------------------------------
'#endif /* WINVER >= 0x0400 */
#IF NOT %DEF(%NOMETAFILE) ' ---------------------------------------------------
'#ifndef NOMETAFILE
'/* Clipboard Metafile Picture Structure */
' // Size = 4 bytes
TYPE HANDLETABLE DWORD
 objectHandle(0) AS DWORD ' HGDIOBJ objectHandle[1]
END TYPE
' // Size = 8 bytes
TYPE METARECORD DWORD FILL
 rdSize AS DWORD
 rdFunction AS WORD ' WORD
 rdParm(0) AS WORD ' WORD rdParm[1]
END TYPE
' // Size = 16 bytes
TYPE METAFILEPICT DWORD
 mm AS LONG
 xExt AS LONG
 yExt AS LONG
 hMF AS DWORD ' HMETAFILE
END TYPE
'#include <pshpack2.h>
' // Size = 18 bytes
TYPE METAHEADER WORD
 mtType AS WORD
 mtHeaderSize AS WORD
 mtVersion AS WORD
 mtSize AS DWORD
 mtNoObjects AS WORD
 mtMaxRecord AS DWORD
 mtNoParameters AS WORD
END TYPE
'#include <poppack.h>
' // Size = 12 bytes
TYPE ENHMETARECORD DWORD
 iType AS DWORD
 nSize AS DWORD
 dParm(0) AS DWORD ' DWORD dParm[1]
END TYPE
' // Size = 108 bytes
TYPE ENHMETAHEADER DWORD FILL
 iType AS DWORD ' DWORD // Record type EMR_HEADER
 nSize AS DWORD ' DWORD // Record size in bytes. This may be greater
 ' // than the sizeof(ENHMETAHEADER).
 rclBounds AS RECTL ' RECTL // Inclusive-inclusive bounds in device units
 rclFrame AS RECTL ' RECTL // Inclusive-inclusive Picture Frame of metafile in .01 mm units
 dSignature AS DWORD ' DWORD // Signature. Must be ENHMETA_SIGNATURE.
 nVersion AS DWORD ' DWORD // Version number
 nBytes AS DWORD ' DWORD // Size of the metafile in bytes
 nRecords AS DWORD ' DWORD // Number of records in the metafile
 nHandles AS WORD ' WORD // Number of handles in the handle table
 ' // Handle index zero is reserved.
 sReserved AS WORD ' WORD // Reserved. Must be zero.
 nDescription AS DWORD ' DWORD // Number of chars in the unicode description string
 ' // This is 0 if there is no description string
 offDescription AS DWORD ' DWORD // Offset to the metafile description record.
 ' // This is 0 if there is no description string
 nPalEntries AS DWORD ' DWORD // Number of entries in the metafile palette.
 szlDevice AS SIZEL ' SIZEL // Size of the reference device in pels
 szlMillimeters AS SIZEL ' SIZEL // Size of the reference device in millimeters
#IF (%WINVER >= &H0400)
 cbPixelFormat AS DWORD ' DWORD // Size of PIXELFORMATDESCRIPTOR information
 ' // This is 0 if no pixel format is set
 offPixelFormat AS DWORD ' DWORD // Offset to PIXELFORMATDESCRIPTOR
 ' // This is 0 if no pixel format is set
 bOpenGL AS DWORD ' DWORD // TRUE if OpenGL commands are present in
 ' // the metafile, otherwise FALSE
#ENDIF ' /* WINVER >= 0x0400 */
#IF (%WINVER >= &H0500)
 szlMicrometers AS SIZEL ' SIZEL // Size of the reference device in micrometers
#ENDIF ' /* WINVER >= 0x0500 */
END TYPE
'#endif /* NOMETAFILE */
#ENDIF ' #IF NOT %DEF(%NOMETAFILE) ------------------------------------------
#IF NOT %DEF(%NOTEXTMETRIC) ' -------------------------------------------------
'#ifndef NOTEXTMETRIC
'/* tmPitchAndFamily flags */
%EQUATE `TMPF_FIXED_PITCH = &H01
%EQUATE `TMPF_VECTOR = &H02
%EQUATE `TMPF_DEVICE = &H08
%EQUATE `TMPF_TRUETYPE = &H04
'//
'// BCHAR definition for APPs
'//
#IF NOT %DEF(%TEXTMETRIC_DEFINED) '--------------------------------------------
%EQUATE `TEXTMETRIC_DEFINED = 1
'#include <pshpack4.h>
' // Size = 56 bytes
TYPE TEXTMETRICA ' Must be 4 byte aligned
 tmHeight AS LONG
 tmAscent AS LONG
 tmDescent AS LONG
 tmInternalLeading AS LONG
 tmExternalLeading AS LONG
 tmAveCharWidth AS LONG
 tmMaxCharWidth AS LONG
 tmWeight AS LONG
 tmOverhang AS LONG
 tmDigitizedAspectX AS LONG
 tmDigitizedAspectY AS LONG
 tmFirstChar AS STRING * 1 ' BYTE [must be char]
 tmLastChar AS STRING * 1 ' BYTE [must be char]
 tmDefaultChar AS STRING * 1 ' BYTE [must be char]
 tmBreakChar AS STRING * 1 ' BYTE [must be char]
 tmItalic AS BYTE ' BYTE
 tmUnderlined AS BYTE ' BYTE
 tmStruckOut AS BYTE ' BYTE
 tmPitchAndFamily AS BYTE ' BYTE
 tmCharSet AS BYTE ' BYTE
 alignment__(2) AS BYTE ' // To keep DWORD alignment
END TYPE
%EQUATE `TEXTMETRICW_DEFINED = 1
' // Size = 60 bytes
TYPE TEXTMETRICW ' Must be 4 byte aligned
 tmHeight AS LONG
 tmAscent AS LONG
 tmDescent AS LONG
 tmInternalLeading AS LONG
 tmExternalLeading AS LONG
 tmAveCharWidth AS LONG
 tmMaxCharWidth AS LONG
 tmWeight AS LONG
 tmOverhang AS LONG
 tmDigitizedAspectX AS LONG
 tmDigitizedAspectY AS LONG
 tmFirstChar AS WSTRING * 1 ' WCHAR
 tmLastChar AS WSTRING * 1 ' WCHAR
 tmDefaultChar AS WSTRING * 1 ' WCHAR
 tmBreakChar AS WSTRING * 1 ' WCHAR
 tmItalic AS BYTE ' BYTE
 tmUnderlined AS BYTE ' BYTE
 tmStruckOut AS BYTE ' BYTE
 tmPitchAndFamily AS BYTE ' BYTE
 tmCharSet AS BYTE ' BYTE
 alignment__(2) AS BYTE ' // To keep DWORD alignment
END TYPE
#IF %DEF(%UNICODE)
 MACRO TEXTMETRIC = TEXTMETRICW
#ELSE
 MACRO TEXTMETRIC = TEXTMETRICA
#ENDIF
'#include <poppack.h>
#ENDIF ' #IF NOT %DEF(%TEXTMETRIC_DEFINED) ----------------------------------
'/* ntmFlags field flags */
%EQUATE `NTM_REGULAR = &H00000040
%EQUATE `NTM_BOLD = &H00000020
%EQUATE `NTM_ITALIC = &H00000001
'/* new in NT 5.0 */
%EQUATE `NTM_NONNEGATIVE_AC = &H00010000
%EQUATE `NTM_OPENTYPE = &H00020000
%EQUATE `NTM_MULTIPLEMASTER = &H00040000
%EQUATE `NTM_MM_INSTANCE = &H00080000
%EQUATE `NTM_TYPE1 = &H00100000
%EQUATE `NTM_DSIG = &H00200000
'#include <pshpack4.h>
' // Size = 72 bytes
TYPE NEWTEXTMETRICA DWORD FILL ' Must be 4 byte aligned
 tmHeight AS LONG
 tmAscent AS LONG
 tmDescent AS LONG
 tmInternalLeading AS LONG
 tmExternalLeading AS LONG
 tmAveCharWidth AS LONG
 tmMaxCharWidth AS LONG
 tmWeight AS LONG
 tmOverhang AS LONG
 tmDigitizedAspectX AS LONG
 tmDigitizedAspectY AS LONG
 tmFirstChar AS STRING * 1 ' BYTE [must be char]
 tmLastChar AS STRING * 1 ' BYTE [must be char]
 tmDefaultChar AS STRING * 1 ' BYTE [must be char]
 tmBreakChar AS STRING * 1 ' BYTE [must be char]
 tmItalic AS BYTE ' BYTE
 tmUnderlined AS BYTE ' BYTE
 tmStruckOut AS BYTE ' BYTE
 tmPitchAndFamily AS BYTE ' BYTE
 tmCharSet AS BYTE ' BYTE
 ntmFlags AS DWORD
 ntmSizeEM AS DWORD ' UINT
 ntmCellHeight AS DWORD ' UINT
 ntmAveWidth AS DWORD ' UINT
END TYPE
' // Size = 76 bytes
TYPE NEWTEXTMETRICW DWORD FILL
 tmHeight AS LONG
 tmAscent AS LONG
 tmDescent AS LONG
 tmInternalLeading AS LONG
 tmExternalLeading AS LONG
 tmAveCharWidth AS LONG
 tmMaxCharWidth AS LONG
 tmWeight AS LONG
 tmOverhang AS LONG
 tmDigitizedAspectX AS LONG
 tmDigitizedAspectY AS LONG
 tmFirstChar AS WSTRING * 1 ' WCHAR
 tmLastChar AS WSTRING * 1 ' WCHAR
 tmDefaultChar AS WSTRING * 1 ' WCHAR
 tmBreakChar AS WSTRING * 1 ' WCHAR
 tmItalic AS BYTE ' BYTE
 tmUnderlined AS BYTE ' BYTE
 tmStruckOut AS BYTE ' BYTE
 tmPitchAndFamily AS BYTE ' BYTE
 tmCharSet AS BYTE ' BYTE
 ntmFlags AS DWORD
 ntmSizeEM AS DWORD ' UINT
 ntmCellHeight AS DWORD ' UINT
 ntmAveWidth AS DWORD ' UINT
END TYPE
#IF %DEF(%UNICODE)
 MACRO NEWTEXTMETRIC = NEWTEXTMETRICW
#ELSE
 MACRO NEWTEXTMETRIC = NEWTEXTMETRICA
#ENDIF
'#include <poppack.h>
'#if(WINVER >= 0x0400)
' // Size = 96 bytes
TYPE NEWTEXTMETRICEXA DWORD FILL
 ntmTm AS NEWTEXTMETRIC
 ntmFontSig AS FONTSIGNATURE
END TYPE
' // Size = 100 bytes
TYPE NEWTEXTMETRICEXW DWORD FILL
 ntmTm AS NEWTEXTMETRICW
 ntmFontSig AS FONTSIGNATURE
END TYPE
#IF %DEF(%UNICODE)
 MACRO NEWTEXTMETRICEX = NEWTEXTMETRICEXW
#ELSE
 MACRO NEWTEXTMETRICEX = NEWTEXTMETRICEXA
#ENDIF
'#endif /* WINVER >= 0x0400 */
'#endif /* NOTEXTMETRIC */
#ENDIF ' #IF NOT %DEF(%NOTEXTMETRIC) ----------------------------------------
'/* GDI Logical Objects: */
'/* Pel Array */
' // Size = 100 bytes
TYPE PELARRAY DWORD
 paXCount AS LONG
 paYCount AS LONG
 paXExt AS LONG
 paYExt AS LONG
 paRGBs AS BYTE
END TYPE
'/* Logical Brush (or Pattern) */
' // Size = 12 bytes
TYPE LOGBRUSH DWORD
 lbStyle AS DWORD ' UINT
 lbColor AS DWORD ' COLORREF
 lbHatch AS DWORD ' ULONG_PTR
END TYPE
' // Size = 12 bytes
TYPE LOGBRUSH32 DWORD
 lbStyle AS DWORD ' UINT
 lbColor AS DWORD ' COLORREF
 lbHatch AS DWORD ' ULONG
END TYPE
'typedef LOGBRUSH PATTERN;
'typedef PATTERN *PPATTERN;
'typedef PATTERN NEAR *NPPATTERN;
'typedef PATTERN FAR *LPPATTERN;
'/* Logical Pen */
' // Size = 16 bytes
TYPE LOGPEN DWORD
 lopnStyle AS DWORD ' UINT
 lopnWidth AS POINT
 lopnColor AS DWORD ' COLORREF
END TYPE
' // Size = 28 bytes
TYPE EXTLOGPEN DWORD
 elpPenStyle AS DWORD
 elpWidth AS DWORD
 elpBrushStyle AS DWORD ' UINT
 elpColor AS DWORD ' COLORREF
 elpHatch AS DWORD ' ULONG_PTR
 elpNumEntries AS DWORD
 elpStyleEntry(0) AS DWORD ' DWORD elpStyleEntry[1]
END TYPE
' // Size = 28 bytes
TYPE EXTLOGPEN32 DWORD
 elpPenStyle AS DWORD
 elpWidth AS DWORD
 elpBrushStyle AS DWORD ' UINT
 elpColor AS DWORD ' COLORREF
 elpHatch AS DWORD ' ULONG
 elpNumEntries AS DWORD
 elpStyleEntry(0) AS DWORD ' DWORD elpStyleEntry[1]
END TYPE
#IF NOT %DEF(%PALETTEENTRY_DEFINED) '------------------------------------------
%EQUATE `PALETTEENTRY_DEFINED = 1
' // Size = 4 bytes
TYPE PALETTEENTRY BYTE
 peRed AS BYTE
 peGreen AS BYTE
 peBlue AS BYTE
 peFlags AS BYTE
END TYPE
#ENDIF ' #IF NOT %DEF(%PALETTEENTRY_DEFINED) --------------------------------
#IF NOT %DEF(%LOGPALETTE_DEFINED) '--------------------------------------------
%EQUATE `LOGPALETTE_DEFINED = 1
' // Size = 8 bytes
TYPE LOGPALETTE BYTE
 palVersion AS WORD
 palNumEntries AS WORD
 palPalEntry(0) AS PALETTEENTRY ' PALETTEENTRY palPalEntry[1]
END TYPE
TYPE LOGPALETTE256 BYTE
 palVersion AS WORD
 palNumEntries AS WORD
 palPalEntry(255) AS PALETTEENTRY ' Enough for 256 colors
END TYPE
'#endif // !_LOGPALETTE_DEFINED
#ENDIF ' #IF NOT %DEF(%LOGPALETTE_DEFINED) ----------------------------------
'/* Logical Font */
%EQUATE `LF_FACESIZE = 32
' // Size = 60 bytes
TYPE LOGFONTA DWORD FILL
 lfHeight AS LONG
 lfWidth AS LONG
 lfEscapement AS LONG
 lfOrientation AS LONG
 lfWeight AS LONG
 lfItalic AS BYTE
 lfUnderline AS BYTE
 lfStrikeOut AS BYTE
 lfCharSet AS BYTE
 lfOutPrecision AS BYTE
 lfClipPrecision AS BYTE
 lfQuality AS BYTE
 lfPitchAndFamily AS BYTE
 lfFaceName AS ASCIIZ * %LF_FACESIZE ' CHAR lfFaceName[LF_FACESIZE]
END TYPE
' // Size = 92 bytes
TYPE LOGFONTW DWORD FILL
 lfHeight AS LONG
 lfWidth AS LONG
 lfEscapement AS LONG
 lfOrientation AS LONG
 lfWeight AS LONG
 lfItalic AS BYTE
 lfUnderline AS BYTE
 lfStrikeOut AS BYTE
 lfCharSet AS BYTE
 lfOutPrecision AS BYTE
 lfClipPrecision AS BYTE
 lfQuality AS BYTE
 lfPitchAndFamily AS BYTE
 lfFaceName AS WSTRINGZ * %LF_FACESIZE ' WCHAR lfFaceName[LF_FACESIZE]
END TYPE
#IF %DEF(%UNICODE)
 MACRO LOGFONT = LOGFONTW
#ELSE
 MACRO LOGFONT = LOGFONTA
#ENDIF
%EQUATE `LF_FULLFACESIZE = 64
'/* Structure passed to FONTENUMPROC */
'typedef struct tagENUMLOGFONTA
'{
' LOGFONTA elfLogFont;
' BYTE elfFullName[LF_FULLFACESIZE];
' BYTE elfStyle[LF_FACESIZE];
'} ENUMLOGFONTA, FAR* LPENUMLOGFONTA;
' // Size = 156 bytes
TYPE ENUMLOGFONTA DWORD
 elfLogFont AS LOGFONTA
 elfFullName AS ASCIIZ * %LF_FULLFACESIZE
 elfStyle AS ASCIIZ * %LF_FACESIZE
END TYPE
'/* Structure passed to FONTENUMPROC */
'typedef struct tagENUMLOGFONTW
'{
' LOGFONTW elfLogFont;
' WCHAR elfFullName[LF_FULLFACESIZE];
' WCHAR elfStyle[LF_FACESIZE];
'} ENUMLOGFONTW, FAR* LPENUMLOGFONTW;
' // Size = 284 bytes
TYPE ENUMLOGFONTW DWORD
 elfLogFont AS LOGFONTW
 elfFullName AS WSTRINGZ * %LF_FULLFACESIZE
 elfStyle AS WSTRINGZ * %LF_FACESIZE
END TYPE
#IF %DEF(%UNICODE)
 MACRO ENUMLOGFONT = ENUMLOGFONTW
#ELSE
 MACRO ENUMLOGFONT = ENUMLOGFONTA
#ENDIF
'#if(WINVER >= 0x0400)
'typedef struct tagENUMLOGFONTEXA
'{
' LOGFONTA elfLogFont;
' BYTE elfFullName[LF_FULLFACESIZE];
' BYTE elfStyle[LF_FACESIZE];
' BYTE elfScript[LF_FACESIZE];
'} ENUMLOGFONTEXA, FAR *LPENUMLOGFONTEXA;
' // Size = 188 bytes
TYPE ENUMLOGFONTEXA DWORD
 elfLogFont AS LOGFONTA
 elfFullName AS ASCIIZ * %LF_FULLFACESIZE
 elfStyle AS ASCIIZ * %LF_FACESIZE
 elfScript AS ASCIIZ * %LF_FACESIZE
END TYPE
'typedef struct tagENUMLOGFONTEXW
'{
' LOGFONTW elfLogFont;
' WCHAR elfFullName[LF_FULLFACESIZE];
' WCHAR elfStyle[LF_FACESIZE];
' WCHAR elfScript[LF_FACESIZE];
'} ENUMLOGFONTEXW, FAR *LPENUMLOGFONTEXW;
' // Size = 348 bytes
TYPE ENUMLOGFONTEXW DWORD
 elfLogFont AS LOGFONTW
 elfFullName AS WSTRINGZ * %LF_FULLFACESIZE
 elfStyle AS WSTRINGZ * %LF_FACESIZE
 elfScript AS WSTRINGZ * %LF_FACESIZE
END TYPE
#IF %DEF(%UNICODE)
 MACRO ENUMLOGFONTEX = ENUMLOGFONTEXW
#ELSE
 MACRO ENUMLOGFONTEX = ENUMLOGFONTEXA
#ENDIF
'#endif /* WINVER >= 0x0400 */
%EQUATE `OUT_DEFAULT_PRECIS = 0
%EQUATE `OUT_STRING_PRECIS = 1
%EQUATE `OUT_CHARACTER_PRECIS = 2
%EQUATE `OUT_STROKE_PRECIS = 3
%EQUATE `OUT_TT_PRECIS = 4
%EQUATE `OUT_DEVICE_PRECIS = 5
%EQUATE `OUT_RASTER_PRECIS = 6
%EQUATE `OUT_TT_ONLY_PRECIS = 7
%EQUATE `OUT_OUTLINE_PRECIS = 8
%EQUATE `OUT_SCREEN_OUTLINE_PRECIS = 9
%EQUATE `OUT_PS_ONLY_PRECIS = 10
'#define CLIP_DEFAULT_PRECIS 0
'#define CLIP_CHARACTER_PRECIS 1
'#define CLIP_STROKE_PRECIS 2
'#define CLIP_MASK 0xf
'#define CLIP_LH_ANGLES (1<<4)
'#define CLIP_TT_ALWAYS (2<<4)
'#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
'#define CLIP_DFA_DISABLE (4<<4)
'#endif // (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
'#define CLIP_EMBEDDED (8<<4)
%EQUATE `CLIP_DEFAULT_PRECIS = 0
%EQUATE `CLIP_CHARACTER_PRECIS = 1
%EQUATE `CLIP_STROKE_PRECIS = 2
%EQUATE `CLIP_MASK = &HF
%EQUATE `CLIP_LH_ANGLES = &H10 ' 16
%EQUATE `CLIP_TT_ALWAYS = &H20 ' 32
'#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
%EQUATE `CLIP_DFA_DISABLE = &H40 ' 64
'#endif // (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
%EQUATE `CLIP_EMBEDDED = &H80 ' 128
%EQUATE `DEFAULT_QUALITY = 0
%EQUATE `DRAFT_QUALITY = 1
%EQUATE `PROOF_QUALITY = 2
'#if(WINVER >= 0x0400)
%EQUATE `NONANTIALIASED_QUALITY = 3
%EQUATE `ANTIALIASED_QUALITY = 4
'#endif /* WINVER >= 0x0400 */
'#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
%EQUATE `CLEARTYPE_QUALITY = 5
%EQUATE `CLEARTYPE_NATURAL_QUALITY = 6
'#endif
%EQUATE `DEFAULT_PITCH = 0
%EQUATE `FIXED_PITCH = 1
%EQUATE `VARIABLE_PITCH = 2
'#if(WINVER >= 0x0400)
%EQUATE `MONO_FONT = 8
'#endif /* WINVER >= 0x0400 */
%EQUATE `ANSI_CHARSET = 0
%EQUATE `DEFAULT_CHARSET = 1
%EQUATE `SYMBOL_CHARSET = 2
%EQUATE `SHIFTJIS_CHARSET = 128
%EQUATE `HANGEUL_CHARSET = 129
%EQUATE `HANGUL_CHARSET = 129
%EQUATE `GB2312_CHARSET = 134
%EQUATE `CHINESEBIG5_CHARSET = 136
%EQUATE `OEM_CHARSET = 255
'#if(WINVER >= 0x0400)
%EQUATE `JOHAB_CHARSET = 130
%EQUATE `HEBREW_CHARSET = 177
%EQUATE `ARABIC_CHARSET = 178
%EQUATE `GREEK_CHARSET = 161
%EQUATE `TURKISH_CHARSET = 162
%EQUATE `VIETNAMESE_CHARSET = 163
%EQUATE `THAI_CHARSET = 222
%EQUATE `EASTEUROPE_CHARSET = 238
%EQUATE `RUSSIAN_CHARSET = 204
%EQUATE `MAC_CHARSET = 77
%EQUATE `BALTIC_CHARSET = 186
%EQUATE `FS_LATIN1 = &H00000001
%EQUATE `FS_LATIN2 = &H00000002
%EQUATE `FS_CYRILLIC = &H00000004
%EQUATE `FS_GREEK = &H00000008
%EQUATE `FS_TURKISH = &H00000010
%EQUATE `FS_HEBREW = &H00000020
%EQUATE `FS_ARABIC = &H00000040
%EQUATE `FS_BALTIC = &H00000080
%EQUATE `FS_VIETNAMESE = &H00000100
%EQUATE `FS_THAI = &H00010000
%EQUATE `FS_JISJAPAN = &H00020000
%EQUATE `FS_CHINESESIMP = &H00040000
%EQUATE `FS_WANSUNG = &H00080000
%EQUATE `FS_CHINESETRAD = &H00100000
%EQUATE `FS_JOHAB = &H00200000
%EQUATE `FS_SYMBOL = &H80000000
'#endif /* WINVER >= 0x0400 */
'/* Font Families */
'#define FF_DONTCARE (0<<4) /* Don't care or don't know. */
'#define FF_ROMAN (1<<4) /* Variable stroke width, serifed. */
' /* Times Roman, Century Schoolbook, etc. */
'#define FF_SWISS (2<<4) /* Variable stroke width, sans-serifed. */
' /* Helvetica, Swiss, etc. */
'#define FF_MODERN (3<<4) /* Constant stroke width, serifed or sans-serifed. */
' /* Pica, Elite, Courier, etc. */
'#define FF_SCRIPT (4<<4) /* Cursive, etc. */
'#define FF_DECORATIVE (5<<4) /* Old English, etc. */
%EQUATE `FF_DONTCARE = 0 ' Don't care or don't know.
%EQUATE `FF_ROMAN = 16 ' Variable stroke width, serifed.
%EQUATE `FF_SWISS = 32 ' Variable stroke width, sans-serifed.
%EQUATE `FF_MODERN = 48 ' Constant stroke width, serifed or sans-serifed.
%EQUATE `FF_SCRIPT = 64 ' Cursive, etc.
%EQUATE `FF_DECORATIVE = 80 ' Old English, etc.
'/* Font Weights */
%EQUATE `FW_DONTCARE = 0&
%EQUATE `FW_THIN = 100&
%EQUATE `FW_EXTRALIGHT = 200&
%EQUATE `FW_LIGHT = 300&
%EQUATE `FW_NORMAL = 400&
%EQUATE `FW_MEDIUM = 500&
%EQUATE `FW_SEMIBOLD = 600&
%EQUATE `FW_BOLD = 700&
%EQUATE `FW_EXTRABOLD = 800&
%EQUATE `FW_HEAVY = 900&
%EQUATE `FW_ULTRALIGHT = %FW_EXTRALIGHT
%EQUATE `FW_REGULAR = %FW_NORMAL
%EQUATE `FW_DEMIBOLD = %FW_SEMIBOLD
%EQUATE `FW_ULTRABOLD = %FW_EXTRABOLD
%EQUATE `FW_BLACK = %FW_HEAVY
%EQUATE `PANOSE_COUNT = 10
%EQUATE `PAN_FAMILYTYPE_INDEX = 0
%EQUATE `PAN_SERIFSTYLE_INDEX = 1
%EQUATE `PAN_WEIGHT_INDEX = 2
%EQUATE `PAN_PROPORTION_INDEX = 3
%EQUATE `PAN_CONTRAST_INDEX = 4
%EQUATE `PAN_STROKEVARIATION_INDEX = 5
%EQUATE `PAN_ARMSTYLE_INDEX = 6
%EQUATE `PAN_LETTERFORM_INDEX = 7
%EQUATE `PAN_MIDLINE_INDEX = 8
%EQUATE `PAN_XHEIGHT_INDEX = 9
%EQUATE `PAN_CULTURE_LATIN = 0
' // Size = 10 bytes
TYPE PANOSE BYTE
 bFamilyType AS BYTE
 bSerifStyle AS BYTE
 bWeight AS BYTE
 bProportion AS BYTE
 bContrast AS BYTE
 bStrokeVariation AS BYTE
 bArmStyle AS BYTE
 bLetterform AS BYTE
 bMidline AS BYTE
 bXHeight AS BYTE
END TYPE
%EQUATE `PAN_ANY = 0 ' Any
%EQUATE `PAN_NO_FIT = 1 ' No Fit
%EQUATE `PAN_FAMILY_TEXT_DISPLAY = 2 ' Text and Display
%EQUATE `PAN_FAMILY_SCRIPT = 3 ' Script
%EQUATE `PAN_FAMILY_DECORATIVE = 4 ' Decorative
%EQUATE `PAN_FAMILY_PICTORIAL = 5 ' Pictorial
%EQUATE `PAN_SERIF_COVE = 2 ' Cove
%EQUATE `PAN_SERIF_OBTUSE_COVE = 3 ' Obtuse Cove
%EQUATE `PAN_SERIF_SQUARE_COVE = 4 ' Square Cove
%EQUATE `PAN_SERIF_OBTUSE_SQUARE_COVE = 5 ' Obtuse Square Cove
%EQUATE `PAN_SERIF_SQUARE = 6 ' Square
%EQUATE `PAN_SERIF_THIN = 7 ' Thin
%EQUATE `PAN_SERIF_BONE = 8 ' Bone
%EQUATE `PAN_SERIF_EXAGGERATED = 9 ' Exaggerated
%EQUATE `PAN_SERIF_TRIANGLE = 10 ' Triangle
%EQUATE `PAN_SERIF_NORMAL_SANS = 11 ' Normal Sans
%EQUATE `PAN_SERIF_OBTUSE_SANS = 12 ' Obtuse Sans
%EQUATE `PAN_SERIF_PERP_SANS = 13 ' Prep Sans
%EQUATE `PAN_SERIF_FLARED = 14 ' Flared
%EQUATE `PAN_SERIF_ROUNDED = 15 ' Rounded
%EQUATE `PAN_WEIGHT_VERY_LIGHT = 2 ' Very Light
%EQUATE `PAN_WEIGHT_LIGHT = 3 ' Light
%EQUATE `PAN_WEIGHT_THIN = 4 ' Thin
%EQUATE `PAN_WEIGHT_BOOK = 5 ' Book
%EQUATE `PAN_WEIGHT_MEDIUM = 6 ' Medium
%EQUATE `PAN_WEIGHT_DEMI = 7 ' Demi
%EQUATE `PAN_WEIGHT_BOLD = 8 ' Bold
%EQUATE `PAN_WEIGHT_HEAVY = 9 ' Heavy
%EQUATE `PAN_WEIGHT_BLACK = 10 ' Black
%EQUATE `PAN_WEIGHT_NORD = 11 ' Nord
%EQUATE `PAN_PROP_OLD_STYLE = 2 ' Old Style
%EQUATE `PAN_PROP_MODERN = 3 ' Modern
%EQUATE `PAN_PROP_EVEN_WIDTH = 4 ' Even Width
%EQUATE `PAN_PROP_EXPANDED = 5 ' Expanded
%EQUATE `PAN_PROP_CONDENSED = 6 ' Condensed
%EQUATE `PAN_PROP_VERY_EXPANDED = 7 ' Very Expanded
%EQUATE `PAN_PROP_VERY_CONDENSED = 8 ' Very Condensed
%EQUATE `PAN_PROP_MONOSPACED = 9 ' Monospaced
%EQUATE `PAN_CONTRAST_NONE = 2 ' None
%EQUATE `PAN_CONTRAST_VERY_LOW = 3 ' Very Low
%EQUATE `PAN_CONTRAST_LOW = 4 ' Low
%EQUATE `PAN_CONTRAST_MEDIUM_LOW = 5 ' Medium Low
%EQUATE `PAN_CONTRAST_MEDIUM = 6 ' Medium
%EQUATE `PAN_CONTRAST_MEDIUM_HIGH = 7 ' Mediim High
%EQUATE `PAN_CONTRAST_HIGH = 8 ' High
%EQUATE `PAN_CONTRAST_VERY_HIGH = 9 ' Very High
%EQUATE `PAN_STROKE_GRADUAL_DIAG = 2 ' Gradual/Diagonal
%EQUATE `PAN_STROKE_GRADUAL_TRAN = 3 ' Gradual/Transitional
%EQUATE `PAN_STROKE_GRADUAL_VERT = 4 ' Gradual/Vertical
%EQUATE `PAN_STROKE_GRADUAL_HORZ = 5 ' Gradual/Horizontal
%EQUATE `PAN_STROKE_RAPID_VERT = 6 ' Rapid/Vertical
%EQUATE `PAN_STROKE_RAPID_HORZ = 7 ' Rapid/Horizontal
%EQUATE `PAN_STROKE_INSTANT_VERT = 8 ' Instant/Vertical
%EQUATE `PAN_STRAIGHT_ARMS_HORZ = 2 ' Straight Arms/Horizontal
%EQUATE `PAN_STRAIGHT_ARMS_WEDGE = 3 ' Straight Arms/Wedge
%EQUATE `PAN_STRAIGHT_ARMS_VERT = 4 ' Straight Arms/Vertical
%EQUATE `PAN_STRAIGHT_ARMS_SINGLE_SERIF = 5 ' Straight Arms/Single-Serif
%EQUATE `PAN_STRAIGHT_ARMS_DOUBLE_SERIF = 6 ' Straight Arms/Double-Serif
%EQUATE `PAN_BENT_ARMS_HORZ = 7 ' Non-Straight Arms/Horizontal
%EQUATE `PAN_BENT_ARMS_WEDGE = 8 ' Non-Straight Arms/Wedge
%EQUATE `PAN_BENT_ARMS_VERT = 9 ' Non-Straight Arms/Vertical
%EQUATE `PAN_BENT_ARMS_SINGLE_SERIF = 10 ' Non-Straight Arms/Single-Serif
%EQUATE `PAN_BENT_ARMS_DOUBLE_SERIF = 11 ' Non-Straight Arms/Double-Serif
%EQUATE `PAN_LETT_NORMAL_CONTACT = 2 ' Normal/Contact
%EQUATE `PAN_LETT_NORMAL_WEIGHTED = 3 ' Normal/Weighted
%EQUATE `PAN_LETT_NORMAL_BOXED = 4 ' Normal/Boxed
%EQUATE `PAN_LETT_NORMAL_FLATTENED = 5 ' Normal/Flattened
%EQUATE `PAN_LETT_NORMAL_ROUNDED = 6 ' Normal/Rounded
%EQUATE `PAN_LETT_NORMAL_OFF_CENTER = 7 ' Normal/Off Center
%EQUATE `PAN_LETT_NORMAL_SQUARE = 8 ' Normal/Square
%EQUATE `PAN_LETT_OBLIQUE_CONTACT = 9 ' Oblique/Contact
%EQUATE `PAN_LETT_OBLIQUE_WEIGHTED = 10 ' Oblique/Weighted
%EQUATE `PAN_LETT_OBLIQUE_BOXED = 11 ' Oblique/Boxed
%EQUATE `PAN_LETT_OBLIQUE_FLATTENED = 12 ' Oblique/Flattened
%EQUATE `PAN_LETT_OBLIQUE_ROUNDED = 13 ' Oblique/Rounded
%EQUATE `PAN_LETT_OBLIQUE_OFF_CENTER = 14 ' Oblique/Off Center
%EQUATE `PAN_LETT_OBLIQUE_SQUARE = 15 ' Oblique/Square
%EQUATE `PAN_MIDLINE_STANDARD_TRIMMED = 2 ' Standard/Trimmed
%EQUATE `PAN_MIDLINE_STANDARD_POINTED = 3 ' Standard/Pointed
%EQUATE `PAN_MIDLINE_STANDARD_SERIFED = 4 ' Standard/Serifed
%EQUATE `PAN_MIDLINE_HIGH_TRIMMED = 5 ' High/Trimmed
%EQUATE `PAN_MIDLINE_HIGH_POINTED = 6 ' High/Pointed
%EQUATE `PAN_MIDLINE_HIGH_SERIFED = 7 ' High/Serifed
%EQUATE `PAN_MIDLINE_CONSTANT_TRIMMED = 8 ' Constant/Trimmed
%EQUATE `PAN_MIDLINE_CONSTANT_POINTED = 9 ' Constant/Pointed
%EQUATE `PAN_MIDLINE_CONSTANT_SERIFED = 10 ' Constant/Serifed
%EQUATE `PAN_MIDLINE_LOW_TRIMMED = 11 ' Low/Trimmed
%EQUATE `PAN_MIDLINE_LOW_POINTED = 12 ' Low/Pointed
%EQUATE `PAN_MIDLINE_LOW_SERIFED = 13 ' Low/Serifed
%EQUATE `PAN_XHEIGHT_CONSTANT_SMALL = 2 ' Constant/Small
%EQUATE `PAN_XHEIGHT_CONSTANT_STD = 3 ' Constant/Standard
%EQUATE `PAN_XHEIGHT_CONSTANT_LARGE = 4 ' Constant/Large
%EQUATE `PAN_XHEIGHT_DUCKING_SMALL = 5 ' Ducking/Small
%EQUATE `PAN_XHEIGHT_DUCKING_STD = 6 ' Ducking/Standard
%EQUATE `PAN_XHEIGHT_DUCKING_LARGE = 7 ' Ducking/Large
%EQUATE `ELF_VENDOR_SIZE = 4
'/* The extended logical font */
'/* An extension of the ENUMLOGFONT */
' // Size = 192 bytes
TYPE EXTLOGFONTA DWORD
 elfLogFont AS LOGFONTA
 elfFullName AS ASCIIZ * %LF_FULLFACESIZE ' BYTE [must be char]
 elfStyle AS ASCIIZ * %LF_FACESIZE ' BYTE [must be char]
 elfVersion AS DWORD ' DWORD /* 0 for the first release of NT */
 elfStyleSize AS DWORD
 elfMatch AS DWORD
 elfReserved AS DWORD
 elfVendorId AS STRING * %ELF_VENDOR_SIZE ' BYTE
 elfCulture AS DWORD ' DWORD /* 0 for Latin */
 elfPanose AS PANOSE
END TYPE
' // Size = 320 bytes
TYPE EXTLOGFONTW DWORD
 elfLogFont AS LOGFONTW
 elfFullName AS WSTRINGZ * %LF_FULLFACESIZE ' WCHAR
 elfStyle AS WSTRINGZ * %LF_FACESIZE ' WCHAR
 elfVersion AS DWORD ' DWORD /* 0 for the first release of NT */
 elfStyleSize AS DWORD
 elfMatch AS DWORD
 elfReserved AS DWORD
 elfVendorId AS STRING * %ELF_VENDOR_SIZE ' BYTE
 elfCulture AS DWORD ' DWORD /* 0 for Latin */
 elfPanose AS PANOSE
END TYPE
#IF %DEF(%UNICODE)
 MACRO EXTLOGFONT = EXTLOGFONTW
#ELSE
 MACRO EXTLOGFONT = EXTLOGFONTA
#ENDIF
%EQUATE `ELF_VERSION = 0
%EQUATE `ELF_CULTURE_LATIN = 0
'/* EnumFonts Masks */
%EQUATE `RASTER_FONTTYPE = &H0001
%EQUATE `DEVICE_FONTTYPE = &H0002
%EQUATE `TRUETYPE_FONTTYPE = &H0004
'#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
'#define PALETTERGB(r,g,b) (0x02000000 | RGB(r,g,b))
'#define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i)))
'MACRO PALETTERGB(r,g,b) = (&H02000000 OR RGB(r,g,b))
'MACRO PALETTEINDEX(i) = (&H01000000 OR CDWD(i))
FUNCTION PALETTERGB (BYVAL bRed AS BYTE, BYVAL bGreen AS BYTE, BYVAL bBlue AS BYTE) AS DWORD
 FUNCTION = (&H02000000 OR RGB(bRed, bGreen, bBlue))
END FUNCTION
' // Not a macro because it conflicts with the PaletteIndex member of the COLORKEY struture.
FUNCTION PALETTEINDEX (BYVAL ix AS WORD) AS DWORD
 FUNCTION = (&H01000000 OR CDWD(ix))
END FUNCTION
'/* palette entry flags */
%EQUATE `PC_RESERVED = &H01 ' palette index used for animation
%EQUATE `PC_EXPLICIT = &H02 ' palette index is explicit to device
%EQUATE `PC_NOCOLLAPSE = &H04 ' do not match color to system palette
'#define GetRValue(rgb) (LOBYTE(rgb))
'#define GetGValue(rgb) (LOBYTE(((WORD)(rgb)) >> 8))
'#define GetBValue(rgb) (LOBYTE((rgb)>>16))
'MACRO GetRValue(nRGB) = LO(BYTE, nRGB)
'MACRO GetGValue(nRGB) = LO(BYTE, nRGB \ 256)
'MACRO GetBValue(nRGB) = LO(BYTE, nRGB \ 65536)
' // There is a bug in the LO(BYTE) function in PBWIN 10.
FUNCTION GetRValue(BYVAL clrRGB AS DWORD) AS BYTE
 FUNCTION = (clrRGB AND &H000000FF)
END FUNCTION
FUNCTION GetGValue(BYVAL clrRGB AS DWORD) AS BYTE
 SHIFT RIGHT clrRGB, 8
 FUNCTION = (clrRGB AND &H000000FF)
END FUNCTION
FUNCTION GetBValue(BYVAL clrRGB AS DWORD) AS BYTE
 SHIFT RIGHT clrRGB, 16
 FUNCTION = (clrRGB AND &H000000FF)
END FUNCTION
'/* Background Modes */
%EQUATE `TRANSPARENT = 1
%EQUATE `OPAQUE = 2
%EQUATE `BKMODE_LAST = 2
'/* Graphics Modes */
%EQUATE `GM_COMPATIBLE = 1
%EQUATE `GM_ADVANCED = 2
%EQUATE `GM_LAST = 2
'/* PolyDraw and GetPath point types */
%EQUATE `PT_CLOSEFIGURE = &H01
%EQUATE `PT_LINETO = &H02
%EQUATE `PT_BEZIERTO = &H04
%EQUATE `PT_MOVETO = &H06
'/* Mapping Modes */
%EQUATE `MM_TEXT = 1
%EQUATE `MM_LOMETRIC = 2
%EQUATE `MM_HIMETRIC = 3
%EQUATE `MM_LOENGLISH = 4
%EQUATE `MM_HIENGLISH = 5
%EQUATE `MM_TWIPS = 6
%EQUATE `MM_ISOTROPIC = 7
%EQUATE `MM_ANISOTROPIC = 8
'/* Min and Max Mapping Mode values */
%EQUATE `MM_MIN = %MM_TEXT
%EQUATE `MM_MAX = %MM_ANISOTROPIC
%EQUATE `MM_MAX_FIXEDSCALE = %MM_TWIPS
'/* Coordinate Modes */
%EQUATE `ABSOLUTE = 1
%EQUATE `RELATIVE = 2
'/* Stock Logical Objects */
%EQUATE `WHITE_BRUSH = 0
%EQUATE `LTGRAY_BRUSH = 1
%EQUATE `GRAY_BRUSH = 2
%EQUATE `DKGRAY_BRUSH = 3
%EQUATE `BLACK_BRUSH = 4
%EQUATE `NULL_BRUSH = 5
%EQUATE `HOLLOW_BRUSH = %NULL_BRUSH
%EQUATE `WHITE_PEN = 6
%EQUATE `BLACK_PEN = 7
%EQUATE `NULL_PEN = 8
%EQUATE `OEM_FIXED_FONT = 10
%EQUATE `ANSI_FIXED_FONT = 11
%EQUATE `ANSI_VAR_FONT = 12
%EQUATE `SYSTEM_FONT = 13
%EQUATE `DEVICE_DEFAULT_FONT = 14
%EQUATE `DEFAULT_PALETTE = 15
%EQUATE `SYSTEM_FIXED_FONT = 16
'#if(WINVER >= 0x0400)
%EQUATE `DEFAULT_GUI_FONT = 17
'#endif /* WINVER >= 0x0400 */
'#if (_WIN32_WINNT >= 0x0500)
%EQUATE `DC_BRUSH = 18
%EQUATE `DC_PEN = 19
'#endif
'#if (_WIN32_WINNT >= 0x0500)
'#define STOCK_LAST 19
%EQUATE `STOCK_LAST = 19 ' depending on Windows version, may be 16, 17 or 19
'#elif (WINVER >= 0x0400)
'#define STOCK_LAST 17
'#else
'#define STOCK_LAST 16
'#endif
%EQUATE `CLR_INVALID = &HFFFFFFFF ' some Microsoft docs claim this is &HFFFF, but it's not
'/* Brush Styles */
%EQUATE `BS_SOLID = 0
%EQUATE `BS_NULL = 1
%EQUATE `BS_HOLLOW = %BS_NULL
%EQUATE `BS_HATCHED = 2
%EQUATE `BS_PATTERN = 3
%EQUATE `BS_INDEXED = 4
%EQUATE `BS_DIBPATTERN = 5
%EQUATE `BS_DIBPATTERNPT = 6
%EQUATE `BS_PATTERN8X8 = 7
%EQUATE `BS_DIBPATTERN8X8 = 8
%EQUATE `BS_MONOPATTERN = 9
'/* Hatch Styles */
%EQUATE `HS_HORIZONTAL = 0 ' -----
%EQUATE `HS_VERTICAL = 1 ' |||||
%EQUATE `HS_FDIAGONAL = 2 ' \\\\\
%EQUATE `HS_BDIAGONAL = 3 ' -----
%EQUATE `HS_CROSS = 4 ' +++++
%EQUATE `HS_DIAGCROSS = 5 ' xxxxx
%EQUATE `HS_API_MAX = 12
'/* Pen Styles */
%EQUATE `PS_SOLID = 0
%EQUATE `PS_DASH = 1 ' -------
%EQUATE `PS_DOT = 2 ' .......
%EQUATE `PS_DASHDOT = 3 ' _._._._
%EQUATE `PS_DASHDOTDOT = 4 ' _.._.._
%EQUATE `PS_NULL = 5
%EQUATE `PS_INSIDEFRAME = 6
%EQUATE `PS_USERSTYLE = 7
%EQUATE `PS_ALTERNATE = 8
%EQUATE `PS_STYLE_MASK = &H0000000F
%EQUATE `PS_ENDCAP_ROUND = &H00000000
%EQUATE `PS_ENDCAP_SQUARE = &H00000100
%EQUATE `PS_ENDCAP_FLAT = &H00000200
%EQUATE `PS_ENDCAP_MASK = &H00000F00
%EQUATE `PS_JOIN_ROUND = &H00000000
%EQUATE `PS_JOIN_BEVEL = &H00001000
%EQUATE `PS_JOIN_MITER = &H00002000
%EQUATE `PS_JOIN_MASK = &H0000F000
%EQUATE `PS_COSMETIC = &H00000000
%EQUATE `PS_GEOMETRIC = &H00010000
%EQUATE `PS_TYPE_MASK = &H000F0000
%EQUATE `AD_COUNTERCLOCKWISE = 1
%EQUATE `AD_CLOCKWISE = 2
'/* Device Parameters for GetDeviceCaps() */
%EQUATE `DRIVERVERSION = 0 ' Device driver version
%EQUATE `TECHNOLOGY = 2 ' Device classification
%EQUATE `HORZSIZE = 4 ' Horizontal size in millimeters
%EQUATE `VERTSIZE = 6 ' Vertical size in millimeters
%EQUATE `HORZRES = 8 ' Horizontal width in pixels
%EQUATE `VERTRES = 10 ' Vertical width in pixels
%EQUATE `BITSPIXEL = 12 ' Number of bits per pixel
%EQUATE `PLANES = 14 ' Number of planes
%EQUATE `NUMBRUSHES = 16 ' Number of brushes the device has
%EQUATE `NUMPENS = 18 ' Number of pens the device has
%EQUATE `NUMMARKERS = 20 ' Number of markers the device has
%EQUATE `NUMFONTS = 22 ' Number of fonts the device has
%EQUATE `NUMCOLORS = 24 ' Number of colors the device supports
%EQUATE `PDEVICESIZE = 26 ' Size required for device descriptor
%EQUATE `CURVECAPS = 28 ' Curve capabilities
%EQUATE `LINECAPS = 30 ' Line capabilities
%EQUATE `POLYGONALCAPS = 32 ' Polygonal capabilities
%EQUATE `TEXTCAPS = 34 ' Text capabilities
%EQUATE `CLIPCAPS = 36 ' Clipping capabilities
%EQUATE `RASTERCAPS = 38 ' Bitblt capabilities
%EQUATE `ASPECTX = 40 ' Length of the X leg
%EQUATE `ASPECTY = 42 ' Length of the Y leg
%EQUATE `ASPECTXY = 44 ' Length of the hypotenuse
%EQUATE `LOGPIXELSX = 88 ' Logical pixels/inch in X
%EQUATE `LOGPIXELSY = 90 ' Logical pixels/inch in Y
%EQUATE `SIZEPALETTE = 104 ' Number of entries in physical palette
%EQUATE `NUMRESERVED = 106 ' Number of reserved entries in palette
%EQUATE `COLORRES = 108 ' Actual color resolution
'// Printing related DeviceCaps. These replace the appropriate Escapes
%EQUATE `PHYSICALWIDTH = 110 ' Physical Width in device units
%EQUATE `PHYSICALHEIGHT = 111 ' Physical Height in device units
%EQUATE `PHYSICALOFFSETX = 112 ' Physical Printable Area x margin
%EQUATE `PHYSICALOFFSETY = 113 ' Physical Printable Area y margin
%EQUATE `SCALINGFACTORX = 114 ' Scaling factor x
%EQUATE `SCALINGFACTORY = 115 ' Scaling factor y
'// Display driver specific
%EQUATE `VREFRESH = 116 ' Current vertical refresh rate of the
 ' display device (for displays only) in Hz
%EQUATE `DESKTOPVERTRES = 117 ' Horizontal width of entire desktop in pixels
%EQUATE `DESKTOPHORZRES = 118 ' Vertical height of entire desktop in pixels
%EQUATE `BLTALIGNMENT = 119 ' Preferred blt alignment
'#if(WINVER >= 0x0500)
%EQUATE `SHADEBLENDCAPS = 120 ' Shading and blending caps
%EQUATE `COLORMGMTCAPS = 121 ' Color Management caps
'#endif /* WINVER >= 0x0500 */
#IF NOT %DEF(%NOGDICAPMASKS) ' ------------------------------------------------
'#ifndef NOGDICAPMASKS
'/* Device Capability Masks: */
'/* Device Technologies */
%EQUATE `DT_PLOTTER = 0 ' Vector plotter
%EQUATE `DT_RASDISPLAY = 1 ' Raster display
%EQUATE `DT_RASPRINTER = 2 ' Raster printer
%EQUATE `DT_RASCAMERA = 3 ' Raster camera
%EQUATE `DT_CHARSTREAM = 4 ' Character-stream, PLP
%EQUATE `DT_METAFILE = 5 ' Metafile, VDM
%EQUATE `DT_DISPFILE = 6 ' Display-file
'/* Curve Capabilities */
%EQUATE `CC_NONE = 0 ' Curves not supported
%EQUATE `CC_CIRCLES = 1 ' Can do circles
%EQUATE `CC_PIE = 2 ' Can do pie wedges
%EQUATE `CC_CHORD = 4 ' Can do chord arcs
%EQUATE `CC_ELLIPSES = 8 ' Can do ellipese
%EQUATE `CC_WIDE = 16 ' Can do wide lines
%EQUATE `CC_STYLED = 32 ' Can do styled lines
%EQUATE `CC_WIDESTYLED = 64 ' Can do wide styled lines
%EQUATE `CC_INTERIORS = 128 ' Can do interiors
%EQUATE `CC_ROUNDRECT = 256 '
'/* Line Capabilities */
%EQUATE `LC_NONE = 0 ' Lines not supported
%EQUATE `LC_POLYLINE = 2 ' Can do polylines
%EQUATE `LC_MARKER = 4 ' Can do markers
%EQUATE `LC_POLYMARKER = 8 ' Can do polymarkers
%EQUATE `LC_WIDE = 16 ' Can do wide lines
%EQUATE `LC_STYLED = 32 ' Can do styled lines
%EQUATE `LC_WIDESTYLED = 64 ' Can do wide styled lines
%EQUATE `LC_INTERIORS = 128 ' Can do interiors
'/* Polygonal Capabilities */
%EQUATE `PC_NONE = 0 ' Polygonals not supported
%EQUATE `PC_POLYGON = 1 ' Can do polygons
%EQUATE `PC_RECTANGLE = 2 ' Can do rectangles
%EQUATE `PC_WINDPOLYGON = 4 ' Can do winding polygons
%EQUATE `PC_TRAPEZOID = 4 ' Can do trapezoids
%EQUATE `PC_SCANLINE = 8 ' Can do scanlines
%EQUATE `PC_WIDE = 16 ' Can do wide borders
%EQUATE `PC_STYLED = 32 ' Can do styled borders
%EQUATE `PC_WIDESTYLED = 64 ' Can do wide styled borders
%EQUATE `PC_INTERIORS = 128 ' Can do interiors
%EQUATE `PC_POLYPOLYGON = 256 ' Can do polypolygons
%EQUATE `PC_PATHS = 512 ' Can do paths
'/* Clipping Capabilities */
%EQUATE `CP_NONE = 0 ' No clipping of output
%EQUATE `CP_RECTANGLE = 1 ' Output clipped to rects
%EQUATE `CP_REGION = 2 ' obsolete
'/* Text Capabilities */
%EQUATE `TC_OP_CHARACTER = &H00000001& ' Can do OutputPrecision CHARACTER
%EQUATE `TC_OP_STROKE = &H00000002& ' Can do OutputPrecision STROKE
%EQUATE `TC_CP_STROKE = &H00000004& ' Can do ClipPrecision STROKE
%EQUATE `TC_CR_90 = &H00000008& ' Can do CharRotAbility 90
%EQUATE `TC_CR_ANY = &H00000010& ' Can do CharRotAbility ANY
%EQUATE `TC_SF_X_YINDEP = &H00000020& ' Can do ScaleFreedom X_YINDEPENDENT
%EQUATE `TC_SA_DOUBLE = &H00000040& ' Can do ScaleAbility DOUBLE
%EQUATE `TC_SA_INTEGER = &H00000080& ' Can do ScaleAbility INTEGER
%EQUATE `TC_SA_CONTIN = &H00000100& ' Can do ScaleAbility CONTINUOUS
%EQUATE `TC_EA_DOUBLE = &H00000200& ' Can do EmboldenAbility DOUBLE
%EQUATE `TC_IA_ABLE = &H00000400& ' Can do ItalisizeAbility ABLE
%EQUATE `TC_UA_ABLE = &H00000800& ' Can do UnderlineAbility ABLE
%EQUATE `TC_SO_ABLE = &H00001000& ' Can do StrikeOutAbility ABLE
%EQUATE `TC_RA_ABLE = &H00002000& ' Can do RasterFontAble ABLE
%EQUATE `TC_VA_ABLE = &H00004000& ' Can do VectorFontAble ABLE
%EQUATE `TC_RESERVED = &H00008000&
%EQUATE `TC_SCROLLBLT = &H00010000& ' Don't do text scroll with blt
'#endif /* NOGDICAPMASKS */
#ENDIF ' #IF NOT %DEF(%NOGDICAPMASKS) ---------------------------------------
'/* Raster Capabilities */
%EQUATE `RC_NONE = 0&
%EQUATE `RC_BITBLT = 1& ' Can do standard BLT.
%EQUATE `RC_BANDING = 2& ' Device requires banding support
%EQUATE `RC_SCALING = 4& ' Device requires scaling support
%EQUATE `RC_BITMAP64 = 8& ' Device can support >64K bitmap
%EQUATE `RC_GDI20_OUTPUT = &H00000010& ' has 2.0 output calls
%EQUATE `RC_GDI20_STATE = &H00000020&
%EQUATE `RC_SAVEBITMAP = &H00000040&
%EQUATE `RC_DI_BITMAP = &H00000080& ' supports DIB to memory
%EQUATE `RC_PALETTE = &H00000100& ' supports a palette
%EQUATE `RC_DIBTODEV = &H00000200& ' supports DIBitsToDevice
%EQUATE `RC_BIGFONT = &H00000400& ' supports >64K fonts
%EQUATE `RC_STRETCHBLT = &H00000800& ' supports StretchBlt
%EQUATE `RC_FLOODFILL = &H00001000& ' supports FloodFill
%EQUATE `RC_STRETCHDIB = &H00002000& ' supports StretchDIBits
%EQUATE `RC_OP_DX_OUTPUT = &H00004000&
%EQUATE `RC_DEVBITS = &H00008000&
'#if(WINVER >= 0x0500)
'/* Shading and blending caps */
%EQUATE `SB_NONE = &H00000000&
%EQUATE `SB_CONST_ALPHA = &H00000001&
%EQUATE `SB_PIXEL_ALPHA = &H00000002&
%EQUATE `SB_PREMULT_ALPHA = &H00000004&
%EQUATE `SB_GRAD_RECT = &H00000010&
%EQUATE `SB_GRAD_TRI = &H00000020&
'/* Color Management caps */
%EQUATE `CM_NONE = &H00000000&
%EQUATE `CM_DEVICE_ICM = &H00000001&
%EQUATE `CM_GAMMA_RAMP = &H00000002&
%EQUATE `CM_CMYK_COLOR = &H00000004&
'#endif /* WINVER >= 0x0500 */
'/* DIB color table identifiers */
%EQUATE `DIB_RGB_COLORS = 0 ' color table in RGBs
%EQUATE `DIB_PAL_COLORS = 1 ' color table in palette indices
'/* constants for Get/SetSystemPaletteUse() */
%EQUATE `SYSPAL_ERROR = 0
%EQUATE `SYSPAL_STATIC = 1
%EQUATE `SYSPAL_NOSTATIC = 2
%EQUATE `SYSPAL_NOSTATIC256 = 3
'/* constants for CreateDIBitmap */
%EQUATE `CBM_INIT = 4 ' initialize bitmap
'/* ExtFloodFill style flags */
%EQUATE `FLOODFILLBORDER = 0
%EQUATE `FLOODFILLSURFACE = 1
'/* size of a device name string */
'#define CCHDEVICENAME 32
%EQUATE `CCHDEVICENAME = 32
'/* size of a form name string */
'#define CCHFORMNAME 32
%EQUATE `CCHFORMNAME = 32
'typedef struct _devicemodeA {
' BYTE dmDeviceName[CCHDEVICENAME];
' WORD dmSpecVersion;
' WORD dmDriverVersion;
' WORD dmSize;
' WORD dmDriverExtra;
' DWORD dmFields;
' union {
' /* printer only fields */
' struct {
' short dmOrientation;
' short dmPaperSize;
' short dmPaperLength;
' short dmPaperWidth;
' short dmScale;
' short dmCopies;
' short dmDefaultSource;
' short dmPrintQuality;
' } DUMMYSTRUCTNAME;
' /* display only fields */
' struct {
' POINTL dmPosition;
' DWORD dmDisplayOrientation;
' DWORD dmDisplayFixedOutput;
' } DUMMYSTRUCTNAME2;
' } DUMMYUNIONNAME;
' short dmColor;
' short dmDuplex;
' short dmYResolution;
' short dmTTOption;
' short dmCollate;
' BYTE dmFormName[CCHFORMNAME];
' WORD dmLogPixels;
' DWORD dmBitsPerPel;
' DWORD dmPelsWidth;
' DWORD dmPelsHeight;
' union {
' DWORD dmDisplayFlags;
' DWORD dmNup;
' } DUMMYUNIONNAME2;
' DWORD dmDisplayFrequency;
'#if(WINVER >= 0x0400)
' DWORD dmICMMethod;
' DWORD dmICMIntent;
' DWORD dmMediaType;
' DWORD dmDitherType;
' DWORD dmReserved1;
' DWORD dmReserved2;
'#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
' DWORD dmPanningWidth;
' DWORD dmPanningHeight;
'#endif
'#endif /* WINVER >= 0x0400 */
'} DEVMODEA, *PDEVMODEA, *NPDEVMODEA, *LPDEVMODEA;
' // Size = 16 bytes
TYPE DEVMODE_UNION1_STRUCT_1 WORD
 dmOrientation AS INTEGER ' short dmOrientation
 dmPaperSize AS INTEGER ' short dmPaperSize
 dmPaperLength AS INTEGER ' short dmPaperLength
 dmPaperWidth AS INTEGER ' short dmPaperWidth
 dmScale AS INTEGER ' short dmScale
 dmCopies AS INTEGER ' short dmCopies
 dmDefaultSource AS INTEGER ' short dmDefaultSource
 dmPrintQuality AS INTEGER ' short dmPrintQuality
END TYPE
' // Size = 16 bytes
TYPE DEVMODE_UNION1_STRUCT_2 DWORD
 dmPosition AS POINTL ' POINTL dmPosition
 dmDisplayOrientation AS DWORD ' DWORD dmDisplayOrientation
 dmDisplayFixedOutput AS DWORD ' DWORD dmDisplayFixedOutput
END TYPE
' // Size = 16 bytes
UNION DEVMODE_UNION_1 DWORD
 DEVMODE_UNION1_STRUCT_1
 DEVMODE_UNION1_STRUCT_2
END UNION
' // Size = 4 bytes
UNION DEVMODE_UNION_2 DWORD
 dmDisplayFlags AS DWORD
 dmNup AS DWORD
END UNION
' // Size = 156 bytes
TYPE DEVMODEA DWORD FILL
 dmDeviceName AS ASCIIZ * %CCHDEVICENAME ' BYTE dmDeviceName[CCHDEVICENAME]
 dmSpecVersion AS WORD ' WORD dmSpecVersion
 dmDriverVersion AS WORD ' WORD dmDriverVersion
 dmSize AS WORD ' WORD dmSize
 dmDriverExtra AS WORD ' WORD dmDriverExtra
 dmFields AS DWORD ' DWORD dmFields
 DEVMODE_UNION_1
 dmColor AS INTEGER ' short
 dmDuplex AS INTEGER ' short
 dmYResolution AS INTEGER ' short
 dmTTOption AS INTEGER ' short
 dmCollate AS INTEGER ' short
 dmFormName AS ASCIIZ * %CCHFORMNAME ' BYTE dmFormName[CCHFORMNAME]
 dmLogPixels AS WORD ' WORD dmLogPixels
 dmBitsPerPel AS DWORD ' DWORD dmBitsPerPel
 dmPelsWidth AS DWORD ' DWORD dmPelsWidth
 dmPelsHeight AS DWORD ' DWORD dmPelsHeight
 DEVMODE_UNION_2
 dmDisplayFrequency AS DWORD ' DWORD dmDisplayFrequency
#IF (%WINVER >= &H0400)
 dmICMMethod AS DWORD ' DWORD dmICMMethod
 dmICMIntent AS DWORD ' DWORD dmICMIntent
 dmMediaType AS DWORD ' DWORD dmMediaType
 dmDitherType AS DWORD ' DWORD dmDitherType
 dmReserved1 AS DWORD ' DWORD dmReserved1
 dmReserved2 AS DWORD ' DWORD dmReserved2
#IF (%WINVER >= &H0500) OR (%WIN32_WINNT >= %WIN32_WINNT_NT4)
 dmPanningWidth AS DWORD ' DWORD dmPanningWidth
 dmPanningHeight AS DWORD ' DWORD dmPanningHeight
#ENDIF
#ENDIF ' WINVER >= &H0400
END TYPE
'typedef struct _devicemodeW {
' WCHAR dmDeviceName[CCHDEVICENAME];
' WORD dmSpecVersion;
' WORD dmDriverVersion;
' WORD dmSize;
' WORD dmDriverExtra;
' DWORD dmFields;
' union {
' /* printer only fields */
' struct {
' short dmOrientation;
' short dmPaperSize;
' short dmPaperLength;
' short dmPaperWidth;
' short dmScale;
' short dmCopies;
' short dmDefaultSource;
' short dmPrintQuality;
' } DUMMYSTRUCTNAME;
' /* display only fields */
' struct {
' POINTL dmPosition;
' DWORD dmDisplayOrientation;
' DWORD dmDisplayFixedOutput;
' } DUMMYSTRUCTNAME2;
' } DUMMYUNIONNAME;
' short dmColor;
' short dmDuplex;
' short dmYResolution;
' short dmTTOption;
' short dmCollate;
' WCHAR dmFormName[CCHFORMNAME];
' WORD dmLogPixels;
' DWORD dmBitsPerPel;
' DWORD dmPelsWidth;
' DWORD dmPelsHeight;
' union {
' DWORD dmDisplayFlags;
' DWORD dmNup;
' } DUMMYUNIONNAME2;
' DWORD dmDisplayFrequency;
'#if(WINVER >= 0x0400)
' DWORD dmICMMethod;
' DWORD dmICMIntent;
' DWORD dmMediaType;
' DWORD dmDitherType;
' DWORD dmReserved1;
' DWORD dmReserved2;
'#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
' DWORD dmPanningWidth;
' DWORD dmPanningHeight;
'#endif
' // Size = 220 bytes
TYPE DEVMODEW DWORD FILL
 dmDeviceName AS WSTRINGZ * %CCHDEVICENAME ' WCHAR dmDeviceName[CCHDEVICENAME]
 dmSpecVersion AS WORD ' WORD dmSpecVersion
 dmDriverVersion AS WORD ' WORD dmDriverVersion
 dmSize AS WORD ' WORD dmSize
 dmDriverExtra AS WORD ' WORD dmDriverExtra
 dmFields AS DWORD ' DWORD dmFields
 DEVMODE_UNION_1
 dmColor AS INTEGER ' short dmColor
 dmDuplex AS INTEGER ' short dmDuplex
 dmYResolution AS INTEGER ' short dmYResolution
 dmTTOption AS INTEGER ' short dmTTOption
 dmCollate AS INTEGER ' short dmCollate
 dmFormName AS WSTRINGZ * %CCHFORMNAME ' WCHAR dmFormName[CCHFORMNAME]
 dmLogPixels AS WORD ' WORD dmLogPixels
 dmBitsPerPel AS DWORD ' DWORD dmBitsPerPel
 dmPelsWidth AS DWORD ' DWORD dmPelsWidth
 dmPelsHeight AS DWORD ' DWORD dmPelsHeight
 DEVMODE_UNION_2
 dmDisplayFrequency AS DWORD ' DWORD dmDisplayFrequency
 dmICMMethod AS DWORD ' DWORD dmICMMethod
#IF (%WINVER >= &H0400)
 dmICMIntent AS DWORD ' DWORD dmICMIntent
 dmMediaType AS DWORD ' DWORD dmMediaType
 dmDitherType AS DWORD ' DWORD dmDitherType
 dmReserved1 AS DWORD ' DWORD dmReserved1
 dmReserved2 AS DWORD ' DWORD dmReserved2
#IF (%WINVER >= &H0500) OR (%WIN32_WINNT >= %WIN32_WINNT_NT4)
 dmPanningWidth AS DWORD ' DWORD dmPanningWidth
 dmPanningHeight AS DWORD ' DWORD dmPanningHeight
#ENDIF
#ENDIF ' WINVER >= &H0400
END TYPE
#IF %DEF(%UNICODE)
 MACRO DEVMODE = DEVMODEW
#ELSE
 MACRO DEVMODE = DEVMODEA
#ENDIF
'#endif /* WINVER >= 0x0400 */
'/* current version of specification */
'#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
'#define DM_SPECVERSION 0x0401
%EQUATE `DM_SPECVERSION = &H0401
'#elif (WINVER >= 0x0400)
'#define DM_SPECVERSION 0x0400
'#else
'#define DM_SPECVERSION 0x0320
'#endif /* WINVER */
'/* field selection bits */
%EQUATE `DM_ORIENTATION = &H00000001
%EQUATE `DM_PAPERSIZE = &H00000002
%EQUATE `DM_PAPERLENGTH = &H00000004
%EQUATE `DM_PAPERWIDTH = &H00000008
%EQUATE `DM_SCALE = &H00000010
'#if(WINVER >= 0x0500)
%EQUATE `DM_POSITION = &H00000020
%EQUATE `DM_NUP = &H00000040
'#endif /* WINVER >= 0x0500 */
'#if(WINVER >= 0x0501)
%EQUATE `DM_DISPLAYORIENTATION = &H00000080
'#endif /* WINVER >= 0x0501 */
%EQUATE `DM_COPIES = &H00000100
%EQUATE `DM_DEFAULTSOURCE = &H00000200
%EQUATE `DM_PRINTQUALITY = &H00000400
%EQUATE `DM_COLOR = &H00000800
%EQUATE `DM_DUPLEX = &H00001000
%EQUATE `DM_YRESOLUTION = &H00002000
%EQUATE `DM_TTOPTION = &H00004000
%EQUATE `DM_COLLATE = &H00008000
%EQUATE `DM_FORMNAME = &H00010000
%EQUATE `DM_LOGPIXELS = &H00020000
%EQUATE `DM_BITSPERPEL = &H00040000
%EQUATE `DM_PELSWIDTH = &H00080000
%EQUATE `DM_PELSHEIGHT = &H00100000
%EQUATE `DM_DISPLAYFLAGS = &H00200000
%EQUATE `DM_DISPLAYFREQUENCY = &H00400000
'#if(WINVER >= 0x0400)
%EQUATE `DM_ICMMETHOD = &H00800000 ' *** MSDN claims a different value here!
%EQUATE `DM_ICMINTENT = &H01000000 ' *** MSDN claims a different value here!
%EQUATE `DM_MEDIATYPE = &H02000000 ' *** MSDN claims a different value here!
%EQUATE `DM_DITHERTYPE = &H04000000 ' *** MSDN claims a different value here!
%EQUATE `DM_PANNINGWIDTH = &H08000000
%EQUATE `DM_PANNINGHEIGHT = &H10000000
'#endif /* WINVER >= 0x0400 */
'#if(WINVER >= 0x0501)
%EQUATE `DM_DISPLAYFIXEDOUTPUT = &H20000000
'#endif /* WINVER >= 0x0501 */
'/* orientation selections */
%EQUATE `DMORIENT_PORTRAIT = 1
%EQUATE `DMORIENT_LANDSCAPE = 2
'/* paper selections */
%EQUATE `DMPAPER_LETTER = 1
%EQUATE `DMPAPER_FIRST = %DMPAPER_LETTER ' Letter 8 1/2 x 11 in
%EQUATE `DMPAPER_LETTERSMALL = 2 ' Letter Small 8 1/2 x 11 in
%EQUATE `DMPAPER_TABLOID = 3 ' Tabloid 11 x 17 in
%EQUATE `DMPAPER_LEDGER = 4 ' Ledger 17 x 11 in
%EQUATE `DMPAPER_LEGAL = 5 ' Legal 8 1/2 x 14 in
%EQUATE `DMPAPER_STATEMENT = 6 ' Statement 5 1/2 x 8 1/2 in
%EQUATE `DMPAPER_EXECUTIVE = 7 ' Executive 7 1/4 x 10 1/2 in
%EQUATE `DMPAPER_A3 = 8 ' A3 297 x 420 mm
%EQUATE `DMPAPER_A4 = 9 ' A4 210 x 297 mm
%EQUATE `DMPAPER_A4SMALL = 10 ' A4 Small 210 x 297 mm
%EQUATE `DMPAPER_A5 = 11 ' A5 148 x 210 mm
%EQUATE `DMPAPER_B4 = 12 ' B4 250 x 354
%EQUATE `DMPAPER_B5 = 13 ' B5 182 x 257 mm
%EQUATE `DMPAPER_FOLIO = 14 ' Folio 8 1/2 x 13 in
%EQUATE `DMPAPER_QUARTO = 15 ' Quarto 215 x 275 mm
%EQUATE `DMPAPER_10X14 = 16 ' 1&H14 in
%EQUATE `DMPAPER_11X17 = 17 ' 11x17 in
%EQUATE `DMPAPER_NOTE = 18 ' Note 8 1/2 x 11 in
%EQUATE `DMPAPER_ENV_9 = 19 ' Envelope #9 3 7/8 x 8 7/8
%EQUATE `DMPAPER_ENV_10 = 20 ' Envelope #10 4 1/8 x 9 1/2
%EQUATE `DMPAPER_ENV_11 = 21 ' Envelope #11 4 1/2 x 10 3/8
%EQUATE `DMPAPER_ENV_12 = 22 ' Envelope #12 4 \276 x 11
%EQUATE `DMPAPER_ENV_14 = 23 ' Envelope #14 5 x 11 1/2
%EQUATE `DMPAPER_CSHEET = 24 ' C size sheet
%EQUATE `DMPAPER_DSHEET = 25 ' D size sheet
%EQUATE `DMPAPER_ESHEET = 26 ' E size sheet
%EQUATE `DMPAPER_ENV_DL = 27 ' Envelope DL 110 x 220mm
%EQUATE `DMPAPER_ENV_C5 = 28 ' Envelope C5 162 x 229 mm
%EQUATE `DMPAPER_ENV_C3 = 29 ' Envelope C3 324 x 458 mm
%EQUATE `DMPAPER_ENV_C4 = 30 ' Envelope C4 229 x 324 mm
%EQUATE `DMPAPER_ENV_C6 = 31 ' Envelope C6 114 x 162 mm
%EQUATE `DMPAPER_ENV_C65 = 32 ' Envelope C65 114 x 229 mm
%EQUATE `DMPAPER_ENV_B4 = 33 ' Envelope B4 250 x 353 mm
%EQUATE `DMPAPER_ENV_B5 = 34 ' Envelope B5 176 x 250 mm
%EQUATE `DMPAPER_ENV_B6 = 35 ' Envelope B6 176 x 125 mm
%EQUATE `DMPAPER_ENV_ITALY = 36 ' Envelope 110 x 230 mm
%EQUATE `DMPAPER_ENV_MONARCH = 37 ' Envelope Monarch 3.875 x 7.5 in
%EQUATE `DMPAPER_ENV_PERSONAL = 38 ' 6 3/4 Envelope 3 5/8 x 6 1/2 in
%EQUATE `DMPAPER_FANFOLD_US = 39 ' US Std Fanfold 14 7/8 x 11 in
%EQUATE `DMPAPER_FANFOLD_STD_GERMAN = 40 ' German Std Fanfold 8 1/2 x 12 in
%EQUATE `DMPAPER_FANFOLD_LGL_GERMAN = 41 ' German Legal Fanfold 8 1/2 x 13 in
'#if(WINVER >= 0x0400)
%EQUATE `DMPAPER_ISO_B4 = 42 ' B4 (ISO) 250 x 353 mm
%EQUATE `DMPAPER_JAPANESE_POSTCARD = 43 ' Japanese Postcard 100 x 148 mm
%EQUATE `DMPAPER_9X11 = 44 ' 9 x 11 in
%EQUATE `DMPAPER_10X11 = 45 ' 10 x 11 in
%EQUATE `DMPAPER_15X11 = 46 ' 15 x 11 in
%EQUATE `DMPAPER_ENV_INVITE = 47 ' Envelope Invite 220 x 220 mm
%EQUATE `DMPAPER_RESERVED_48 = 48 ' RESERVED--DO NOT USE
%EQUATE `DMPAPER_RESERVED_49 = 49 ' RESERVED--DO NOT USE
%EQUATE `DMPAPER_LETTER_EXTRA = 50 ' Letter Extra 9 \275 x 12 in
%EQUATE `DMPAPER_LEGAL_EXTRA = 51 ' Legal Extra 9 \275 x 15 in
%EQUATE `DMPAPER_TABLOID_EXTRA = 52 ' Tabloid Extra 11.69 x 18 in
%EQUATE `DMPAPER_A4_EXTRA = 53 ' A4 Extra 9.27 x 12.69 in
%EQUATE `DMPAPER_LETTER_TRANSVERSE = 54 ' Letter Transverse 8 \275 x 11 in
%EQUATE `DMPAPER_A4_TRANSVERSE = 55 ' A4 Transverse 210 x 297 mm
%EQUATE `DMPAPER_LETTER_EXTRA_TRANSVERSE = 56 ' Letter Extra Transverse 9\275 x 12 in
%EQUATE `DMPAPER_A_PLUS = 57 ' SuperA/SuperA/A4 227 x 356 mm
%EQUATE `DMPAPER_B_PLUS = 58 ' SuperB/SuperB/A3 305 x 487 mm
%EQUATE `DMPAPER_LETTER_PLUS = 59 ' Letter Plus 8.5 x 12.69 in
%EQUATE `DMPAPER_A4_PLUS = 60 ' A4 Plus 210 x 330 mm
%EQUATE `DMPAPER_A5_TRANSVERSE = 61 ' A5 Transverse 148 x 210 mm
%EQUATE `DMPAPER_B5_TRANSVERSE = 62 ' B5 (JIS) Transverse 182 x 257 mm
%EQUATE `DMPAPER_A3_EXTRA = 63 ' A3 Extra 322 x 445 mm
%EQUATE `DMPAPER_A5_EXTRA = 64 ' A5 Extra 174 x 235 mm
%EQUATE `DMPAPER_B5_EXTRA = 65 ' B5 (ISO) Extra 201 x 276 mm
%EQUATE `DMPAPER_A2 = 66 ' A2 420 x 594 mm
%EQUATE `DMPAPER_A3_TRANSVERSE = 67 ' A3 Transverse 297 x 420 mm
%EQUATE `DMPAPER_A3_EXTRA_TRANSVERSE = 68 ' A3 Extra Transverse 322 x 445 mm
'#endif /* WINVER >= 0x0400 */
'#if(WINVER >= 0x0500)
%EQUATE `DMPAPER_DBL_JAPANESE_POSTCARD = 69 ' Japanese Double Postcard 200 x 148 mm
%EQUATE `DMPAPER_A6 = 70 ' A6 105 x 148 mm
%EQUATE `DMPAPER_JENV_KAKU2 = 71 ' Japanese Envelope Kaku #2
%EQUATE `DMPAPER_JENV_KAKU3 = 72 ' Japanese Envelope Kaku #3
%EQUATE `DMPAPER_JENV_CHOU3 = 73 ' Japanese Envelope Chou #3
%EQUATE `DMPAPER_JENV_CHOU4 = 74 ' Japanese Envelope Chou #4
%EQUATE `DMPAPER_LETTER_ROTATED = 75 ' Letter Rotated 11 x 8 1/2 11 in
%EQUATE `DMPAPER_A3_ROTATED = 76 ' A3 Rotated 420 x 297 mm
%EQUATE `DMPAPER_A4_ROTATED = 77 ' A4 Rotated 297 x 210 mm
%EQUATE `DMPAPER_A5_ROTATED = 78 ' A5 Rotated 210 x 148 mm
%EQUATE `DMPAPER_B4_JIS_ROTATED = 79 ' B4 (JIS) Rotated 364 x 257 mm
%EQUATE `DMPAPER_B5_JIS_ROTATED = 80 ' B5 (JIS) Rotated 257 x 182 mm
%EQUATE `DMPAPER_JAPANESE_POSTCARD_ROTATED = 81 ' Japanese Postcard Rotated 148 x 100 mm
%EQUATE `DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82 ' Double Japanese Postcard Rotated 148 x 200 mm
%EQUATE `DMPAPER_A6_ROTATED = 83 ' A6 Rotated 148 x 105 mm
%EQUATE `DMPAPER_JENV_KAKU2_ROTATED = 84 ' Japanese Envelope Kaku #2 Rotated
%EQUATE `DMPAPER_JENV_KAKU3_ROTATED = 85 ' Japanese Envelope Kaku #3 Rotated
%EQUATE `DMPAPER_JENV_CHOU3_ROTATED = 86 ' Japanese Envelope Chou #3 Rotated
%EQUATE `DMPAPER_JENV_CHOU4_ROTATED = 87 ' Japanese Envelope Chou #4 Rotated
%EQUATE `DMPAPER_B6_JIS = 88 ' B6 (JIS) 128 x 182 mm
%EQUATE `DMPAPER_B6_JIS_ROTATED = 89 ' B6 (JIS) Rotated 182 x 128 mm
%EQUATE `DMPAPER_12X11 = 90 ' 12 x 11 in
%EQUATE `DMPAPER_JENV_YOU4 = 91 ' Japanese Envelope You #4
%EQUATE `DMPAPER_JENV_YOU4_ROTATED = 92 ' Japanese Envelope You #4 Rotated
%EQUATE `DMPAPER_P16K = 93 ' PRC 16K 146 x 215 mm
%EQUATE `DMPAPER_P32K = 94 ' PRC 32K 97 x 151 mm
%EQUATE `DMPAPER_P32KBIG = 95 ' PRC 32K(Big) 97 x 151 mm
%EQUATE `DMPAPER_PENV_1 = 96 ' PRC Envelope #1 102 x 165 mm
%EQUATE `DMPAPER_PENV_2 = 97 ' PRC Envelope #2 102 x 176 mm
%EQUATE `DMPAPER_PENV_3 = 98 ' PRC Envelope #3 125 x 176 mm
%EQUATE `DMPAPER_PENV_4 = 99 ' PRC Envelope #4 110 x 208 mm
%EQUATE `DMPAPER_PENV_5 = 100 ' PRC Envelope #5 110 x 220 mm
%EQUATE `DMPAPER_PENV_6 = 101 ' PRC Envelope #6 120 x 230 mm
%EQUATE `DMPAPER_PENV_7 = 102 ' PRC Envelope #7 160 x 230 mm
%EQUATE `DMPAPER_PENV_8 = 103 ' PRC Envelope #8 120 x 309 mm
%EQUATE `DMPAPER_PENV_9 = 104 ' PRC Envelope #9 229 x 324 mm
%EQUATE `DMPAPER_PENV_10 = 105 ' PRC Envelope #10 324 x 458 mm
%EQUATE `DMPAPER_P16K_ROTATED = 106 ' PRC 16K Rotated
%EQUATE `DMPAPER_P32K_ROTATED = 107 ' PRC 32K Rotated
%EQUATE `DMPAPER_P32KBIG_ROTATED = 108 ' PRC 32K(Big) Rotated
%EQUATE `DMPAPER_PENV_1_ROTATED = 109 ' PRC Envelope #1 Rotated 165 x 102 mm
%EQUATE `DMPAPER_PENV_2_ROTATED = 110 ' PRC Envelope #2 Rotated 176 x 102 mm
%EQUATE `DMPAPER_PENV_3_ROTATED = 111 ' PRC Envelope #3 Rotated 176 x 125 mm
%EQUATE `DMPAPER_PENV_4_ROTATED = 112 ' PRC Envelope #4 Rotated 208 x 110 mm
%EQUATE `DMPAPER_PENV_5_ROTATED = 113 ' PRC Envelope #5 Rotated 220 x 110 mm
%EQUATE `DMPAPER_PENV_6_ROTATED = 114 ' PRC Envelope #6 Rotated 230 x 120 mm
%EQUATE `DMPAPER_PENV_7_ROTATED = 115 ' PRC Envelope #7 Rotated 230 x 160 mm
%EQUATE `DMPAPER_PENV_8_ROTATED = 116 ' PRC Envelope #8 Rotated 309 x 120 mm
%EQUATE `DMPAPER_PENV_9_ROTATED = 117 ' PRC Envelope #9 Rotated 324 x 229 mm
%EQUATE `DMPAPER_PENV_10_ROTATED = 118 ' PRC Envelope #10 Rotated 458 x 324 mm
'#endif /* WINVER >= 0x0500 */
'#if (WINVER >= 0x0500)
'#define DMPAPER_LAST DMPAPER_PENV_10_ROTATED
%EQUATE `DMPAPER_LAST = %DMPAPER_PENV_10_ROTATED
'#elif (WINVER >= 0x0400)
'#define DMPAPER_LAST DMPAPER_A3_EXTRA_TRANSVERSE
'#else
'#define DMPAPER_LAST DMPAPER_FANFOLD_LGL_GERMAN
'#endif
%EQUATE `DMPAPER_USER = 256
'/* bin selections */
%EQUATE `DMBIN_UPPER = 1
%EQUATE `DMBIN_FIRST = %DMBIN_UPPER
%EQUATE `DMBIN_ONLYONE = 1
%EQUATE `DMBIN_LOWER = 2
%EQUATE `DMBIN_MIDDLE = 3
%EQUATE `DMBIN_MANUAL = 4
%EQUATE `DMBIN_ENVELOPE = 5
%EQUATE `DMBIN_ENVMANUAL = 6
%EQUATE `DMBIN_AUTO = 7
%EQUATE `DMBIN_TRACTOR = 8
%EQUATE `DMBIN_SMALLFMT = 9
%EQUATE `DMBIN_LARGEFMT = 10
%EQUATE `DMBIN_LARGECAPACITY = 11
%EQUATE `DMBIN_CASSETTE = 14
%EQUATE `DMBIN_FORMSOURCE = 15
%EQUATE `DMBIN_LAST = %DMBIN_FORMSOURCE
%EQUATE `DMBIN_USER = 256 ' device specific bins start here
'/* print qualities */
%EQUATE `DMRES_DRAFT = -1
%EQUATE `DMRES_LOW = -2
%EQUATE `DMRES_MEDIUM = -3
%EQUATE `DMRES_HIGH = -4
'/* color enable/disable for color printers */
%EQUATE `DMCOLOR_MONOCHROME = 1
%EQUATE `DMCOLOR_COLOR = 2
'/* duplex enable */
%EQUATE `DMDUP_SIMPLEX = 1
%EQUATE `DMDUP_VERTICAL = 2
%EQUATE `DMDUP_HORIZONTAL = 3
%EQUATE `DMTT_BITMAP = 1 ' print TT fonts as graphics
%EQUATE `DMTT_DOWNLOAD = 2 ' download TT fonts as soft fonts
%EQUATE `DMTT_SUBDEV = 3 ' substitute device fonts for TT fonts
'#if(WINVER >= 0x0400)
%EQUATE `DMTT_DOWNLOAD_OUTLINE = 4 ' download TT fonts as outline soft fonts
'#endif /* WINVER >= 0x0400 */
'/* Collation selections */
%EQUATE `DMCOLLATE_FALSE = 0
%EQUATE `DMCOLLATE_TRUE = 1
'#if(WINVER >= 0x0501)
'/* DEVMODE dmDisplayOrientation specifiations */
%EQUATE `DMDO_DEFAULT = 0
%EQUATE `DMDO_90 = 1
%EQUATE `DMDO_180 = 2
%EQUATE `DMDO_270 = 3
'/* DEVMODE dmDisplayFixedOutput specifiations */
%EQUATE `DMDFO_DEFAULT = 0
%EQUATE `DMDFO_STRETCH = 1
%EQUATE `DMDFO_CENTER = 2
'#endif /* WINVER >= 0x0501 */
'/* DEVMODE dmDisplayFlags flags */
'// #define DM_GRAYSCALE 0x00000001 /* This flag is no longer valid */
'// #define DM_INTERLACED 0x00000002 /* This flag is no longer valid */
'%DM_GRAYSCALE = &H00000001 ' /* This flag is no longer valid */
%EQUATE `DM_INTERLACED = &H00000002
%EQUATE `DMDISPLAYFLAGS_TEXTMODE = 4
'/* dmNup , multiple logical page per physical page options */
%EQUATE `DMNUP_SYSTEM = 1
%EQUATE `DMNUP_ONEUP = 2
'#if(WINVER >= 0x0400)
'/* ICM methods */
%EQUATE `DMICMMETHOD_NONE = 1 ' ICM disabled
%EQUATE `DMICMMETHOD_SYSTEM = 2 ' ICM handled by system
%EQUATE `DMICMMETHOD_DRIVER = 3 ' ICM handled by driver
%EQUATE `DMICMMETHOD_DEVICE = 4 ' ICM handled by device
'#define DMICMMETHOD_USER 256 /* Device-specific methods start here */
%EQUATE `DMICMMETHOD_USER = 256 ' Device-specific methods start here
'/* ICM Intents */
%EQUATE `DMICM_SATURATE = 1 ' Maximize color saturation
%EQUATE `DMICM_CONTRAST = 2 ' Maximize color contrast
%EQUATE `DMICM_COLORIMETRIC = 3 ' Use specific color metric
%EQUATE `DMICM_ABS_COLORIMETRIC = 4 ' Use specific color metric
%EQUATE `DMICM_USER = 256 ' Device-specific intents start here
'/* Media types */
%EQUATE `DMMEDIA_STANDARD = 1 ' Standard paper
%EQUATE `DMMEDIA_TRANSPARENCY = 2 ' Transparency
%EQUATE `DMMEDIA_GLOSSY = 3 ' Glossy paper
%EQUATE `DMMEDIA_USER = 256 ' Device-specific media start here
'/* Dither types */
%EQUATE `DMDITHER_NONE = 1 ' No dithering
%EQUATE `DMDITHER_COARSE = 2 ' Dither with a coarse brush
%EQUATE `DMDITHER_FINE = 3 ' Dither with a fine brush
%EQUATE `DMDITHER_LINEART = 4 ' LineArt dithering
%EQUATE `DMDITHER_ERRORDIFFUSION = 5 ' LineArt dithering
%EQUATE `DMDITHER_RESERVED6 = 6 ' LineArt dithering
%EQUATE `DMDITHER_RESERVED7 = 7 ' LineArt dithering
%EQUATE `DMDITHER_RESERVED8 = 8 ' LineArt dithering
%EQUATE `DMDITHER_RESERVED9 = 9 ' LineArt dithering
%EQUATE `DMDITHER_GRAYSCALE = 10 ' Device does grayscaling
'#define DMDITHER_USER 256 /* Device-specific dithers start here */
%EQUATE `DMDITHER_USER = 256 ' Device-specific dithers start here
'#endif /* WINVER >= 0x0400 */
' // Size = 424 bytes
TYPE DISPLAY_DEVICEA DWORD
 cb AS DWORD ' DWORD cb
 DeviceName AS ASCIIZ * 32 ' CHAR DeviceName[32]
 DeviceString AS ASCIIZ * 128 ' CHAR DeviceString[128]
 StateFlags AS DWORD ' DWORD StateFlags
 DeviceID AS ASCIIZ * 128 ' CHAR DeviceID[128]
 DeviceKey AS ASCIIZ * 128 ' CHAR DeviceKey[128]
END TYPE
' // Size = 840 bytes
TYPE DISPLAY_DEVICEW DWORD
 cb AS DWORD ' DWORD cb
 DeviceName AS WSTRINGZ * 32 ' WCHAR DeviceName[32]
 DeviceString AS WSTRINGZ * 128 ' WCHAR DeviceString[128]
 StateFlags AS DWORD ' DWORD StateFlags
 DeviceID AS WSTRINGZ * 128 ' WCHAR DeviceID[128]
 DeviceKey AS WSTRINGZ * 128 ' WCHAR DeviceKey[128]
END TYPE
#IF %DEF(%UNICODE)
 MACRO DISPLAY_DEVICE = DISPLAY_DEVICEW
#ELSE
 MACRO DISPLAY_DEVICE = DISPLAY_DEVICEA
#ENDIF
%EQUATE `DISPLAY_DEVICE_ATTACHED_TO_DESKTOP = &H00000001
%EQUATE `DISPLAY_DEVICE_MULTI_DRIVER = &H00000002
%EQUATE `DISPLAY_DEVICE_PRIMARY_DEVICE = &H00000004
%EQUATE `DISPLAY_DEVICE_MIRRORING_DRIVER = &H00000008
%EQUATE `DISPLAY_DEVICE_VGA_COMPATIBLE = &H00000010
'#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
%EQUATE `DISPLAY_DEVICE_REMOVABLE = &H00000020
'#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
%EQUATE `DISPLAY_DEVICE_MODESPRUNED = &H08000000
'#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
%EQUATE `DISPLAY_DEVICE_REMOTE = &H04000000
%EQUATE `DISPLAY_DEVICE_DISCONNECT = &H02000000
'#endif
%EQUATE `DISPLAY_DEVICE_TS_COMPATIBLE = &H00200000
'#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
%EQUATE `DISPLAY_DEVICE_UNSAFE_MODES_ON = &H00080000
'#endif
'/* Child device state */
'#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
%EQUATE `DISPLAY_DEVICE_ACTIVE = &H00000001
%EQUATE `DISPLAY_DEVICE_ATTACHED = &H00000002
'#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
'#if(WINVER >= 0x0601)
%EQUATE `DISPLAYCONFIG_MAXPATH = 1024 ' // Maximum display path in system.
 ' // Max adapter (16) * Max source (16) *
 ' // Max clone pre source (4)
' // Size = 8 bytes
TYPE DISPLAYCONFIG_RATIONAL DWORD
 Numerator AS DWORD ' UINT32
 Denominator AS DWORD ' UINT32
END TYPE
' enum DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_OTHER = -1
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HD15 = 0
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SVIDEO = 1
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPOSITE_VIDEO = 2
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPONENT_VIDEO = 3
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DVI = 4
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HDMI = 5
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_LVDS = 6
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_D_JPN = 8
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDI = 9
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EXTERNAL = 10
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EMBEDDED = 11
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EXTERNAL = 12
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EMBEDDED = 13
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDTVDONGLE = 14
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL = &H80000000
%EQUATE `DISPLAYCONFIG_OUTPUT_TECHNOLOGY_FORCE_UINT32 = &HFFFFFFFF
' enum DISPLAYCONFIG_SCANLINE_ORDERING
%EQUATE `DISPLAYCONFIG_SCANLINE_ORDERING_UNSPECIFIED = 0
%EQUATE `DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE = 1
%EQUATE `DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED = 2
%EQUATE `DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_UPPERFIELDFIRST = %DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED
%EQUATE `DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_LOWERFIELDFIRST = 3
%EQUATE `DISPLAYCONFIG_SCANLINE_ORDERING_FORCE_UINT32 = &HFFFFFFFF
' // Size = 8 bytes
TYPE DISPLAYCONFIG_2DREGION DWORD
 cx AS DWORD ' UINT32
 cy AS DWORD ' UINT32
END TYPE
' // Size = 48 bytes
TYPE DISPLAYCONFIG_VIDEO_SIGNAL_INFO ' Must be 8 byte aligned
 pixelRate AS QUAD ' UINT64
 hSyncFreq AS DISPLAYCONFIG_RATIONAL
 vSyncFreq AS DISPLAYCONFIG_RATIONAL
 activeSize AS DISPLAYCONFIG_2DREGION
 totalSize AS DISPLAYCONFIG_2DREGION
 videoStandard AS DWORD ' UINT32
 scanLineOrdering AS DWORD ' DISPLAYCONFIG_SCANLINE_ORDERING
END TYPE
' enum DISPLAYCONFIG_SCALING
%EQUATE `DISPLAYCONFIG_SCALING_IDENTITY = 1
%EQUATE `DISPLAYCONFIG_SCALING_CENTERED = 2
%EQUATE `DISPLAYCONFIG_SCALING_STRETCHED = 3
%EQUATE `DISPLAYCONFIG_SCALING_ASPECTRATIOCENTEREDMAX = 4
%EQUATE `DISPLAYCONFIG_SCALING_CUSTOM = 5
%EQUATE `DISPLAYCONFIG_SCALING_PREFERRED = 128
%EQUATE `DISPLAYCONFIG_SCALING_FORCE_UINT32 = &HFFFFFFFF
' enum DISPLAYCONFIG_ROTATION
%EQUATE `DISPLAYCONFIG_ROTATION_IDENTITY = 1
%EQUATE `DISPLAYCONFIG_ROTATION_ROTATE90 = 2
%EQUATE `DISPLAYCONFIG_ROTATION_ROTATE180 = 3
%EQUATE `DISPLAYCONFIG_ROTATION_ROTATE270 = 4
%EQUATE `DISPLAYCONFIG_ROTATION_FORCE_UINT32 = &HFFFFFFFF
' enum DISPLAYCONFIG_MODE_INFO_TYPE
%EQUATE `DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE = 1
%EQUATE `DISPLAYCONFIG_MODE_INFO_TYPE_TARGET = 2
%EQUATE `DISPLAYCONFIG_MODE_INFO_TYPE_FORCE_UINT32 = &HFFFFFFFF
' enum DISPLAYCONFIG_PIXELFORMAT
%EQUATE `DISPLAYCONFIG_PIXELFORMAT_8BPP = 1
%EQUATE `DISPLAYCONFIG_PIXELFORMAT_16BPP = 2
%EQUATE `DISPLAYCONFIG_PIXELFORMAT_24BPP = 3
%EQUATE `DISPLAYCONFIG_PIXELFORMAT_32BPP = 4
%EQUATE `DISPLAYCONFIG_PIXELFORMAT_NONGDI = 5
%EQUATE `DISPLAYCONFIG_PIXELFORMAT_FORCE_UINT32 = &Hffffffff
' // Size = 20 bytes
TYPE DISPLAYCONFIG_SOURCE_MODE DWORD
 width AS DWORD ' UINT32
 height AS DWORD ' UINT32
 pixelFormat AS DWORD ' DISPLAYCONFIG_PIXELFORMAT
 position AS POINTL
END TYPE
' // Size = 48 bytes
TYPE DISPLAYCONFIG_TARGET_MODE ' Must be 9 byte aligned
 targetVideoSignalInfo AS DISPLAYCONFIG_VIDEO_SIGNAL_INFO
END TYPE
' // Size = 48 bytes
UNION DISPLAYCONFIG_MODE_INFO_UNION DWORD
 targetMode AS DISPLAYCONFIG_TARGET_MODE
 sourceMode AS DISPLAYCONFIG_SOURCE_MODE
END UNION
' // Size = 64 bytes
TYPE DISPLAYCONFIG_MODE_INFO DWORD
 infoType AS LONG ' DISPLAYCONFIG_MODE_INFO_TYPE
 id AS DWORD ' UINT32
 adapterId AS QUAD ' LUID
 DISPLAYCONFIG_MODE_INFO_UNION
END TYPE
%EQUATE `DISPLAYCONFIG_PATH_MODE_IDX_INVALID = &Hffffffff
' // Size = 20 bytes
TYPE DISPLAYCONFIG_PATH_SOURCE_INFO DWORD
 adapterId AS QUAD ' LUID
 id AS DWORD ' UINT32
 modeInfoIdx AS DWORD ' UINT32
 statusFlags AS DWORD ' UINT32
END TYPE
'//
'// Flags for source info structure (from OS to application through QDC)
'//
%EQUATE `DISPLAYCONFIG_SOURCE_IN_USE = &H00000001
' // Size = 48 bytes
TYPE DISPLAYCONFIG_PATH_TARGET_INFO DWORD
 adapterId AS QUAD ' LUID
 id AS DWORD ' UINT32
 modeInfoIdx AS DWORD ' UINT32
 outputTechnology AS LONG ' DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY
 rotation AS DWORD ' DISPLAYCONFIG_ROTATION
 scaling AS DWORD ' DISPLAYCONFIG_SCALING
 refreshRate AS DISPLAYCONFIG_RATIONAL
 scanLineOrdering AS DWORD ' DISPLAYCONFIG_SCANLINE_ORDERING
 targetAvailable AS LONG
 statusFlags AS DWORD ' UINT32
END TYPE
'//
'// Status flags for target info structure (from OS to application through QDC)
'//
%EQUATE `DISPLAYCONFIG_TARGET_IN_USE = &H00000001
%EQUATE `DISPLAYCONFIG_TARGET_FORCIBLE = &H00000002
%EQUATE `DISPLAYCONFIG_TARGET_FORCED_AVAILABILITY_BOOT = &H00000004
%EQUATE `DISPLAYCONFIG_TARGET_FORCED_AVAILABILITY_PATH = &H00000008
%EQUATE `DISPLAYCONFIG_TARGET_FORCED_AVAILABILITY_SYSTEM = &H00000010
' // Size = 72 bytes
TYPE DISPLAYCONFIG_PATH_INFO DWORD
 sourceInfo AS DISPLAYCONFIG_PATH_SOURCE_INFO
 targetInfo AS DISPLAYCONFIG_PATH_TARGET_INFO
 flags AS DWORD ' UINT32
END TYPE
'//
'// Flags for path info structure (from OS to application through QDC)
'//
%EQUATE `DISPLAYCONFIG_PATH_ACTIVE = &H00000001
' enum DISPLAYCONFIG_TOPOLOGY_ID
%EQUATE `DISPLAYCONFIG_TOPOLOGY_INTERNAL = &H00000001
%EQUATE `DISPLAYCONFIG_TOPOLOGY_CLONE = &H00000002
%EQUATE `DISPLAYCONFIG_TOPOLOGY_EXTEND = &H00000004
%EQUATE `DISPLAYCONFIG_TOPOLOGY_EXTERNAL = &H00000008
%EQUATE `DISPLAYCONFIG_TOPOLOGY_FORCE_UINT32 = &HFFFFFFFF
' enum DISPLAYCONFIG_DEVICE_INFO_TYPE
%EQUATE `DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME = 1
%EQUATE `DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME = 2
%EQUATE `DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE = 3
%EQUATE `DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME = 4
%EQUATE `DISPLAYCONFIG_DEVICE_INFO_SET_TARGET_PERSISTENCE = 5
%EQUATE `DISPLAYCONFIG_DEVICE_INFO_FORCE_UINT32 = &HFFFFFFFF
UNION DISPLAYCONFIG_DEVICE_INFO_HEADER_TYPE_UNION
 type AS DWORD ' DISPLAYCONFIG_DEVICE_INFO_TYPE
 ' // For compatibility with PB declares
 dtype AS DWORD ' DISPLAYCONFIG_DEVICE_INFO_TYPE
END UNION
UNION DISPLAYCONFIG_DEVICE_INFO_HEADER_SIZE_UNION
 size AS DWORD ' UINT32
 ' // For compatibility with PB declares
 dsize AS DWORD ' UINT32
END UNION
' // Size = 20 bytes
TYPE DISPLAYCONFIG_DEVICE_INFO_HEADER DWORD
 DISPLAYCONFIG_DEVICE_INFO_HEADER_TYPE_UNION
 DISPLAYCONFIG_DEVICE_INFO_HEADER_SIZE_UNION
 adapterId AS QUAD ' LUID
 id AS DWORD ' UINT32
END TYPE
' // Size = 84 bytes
TYPE DISPLAYCONFIG_SOURCE_DEVICE_NAME DWORD
 header AS DISPLAYCONFIG_DEVICE_INFO_HEADER
 viewGdiDeviceName AS WSTRINGZ * %CCHDEVICENAME ' WCHAR
END TYPE
' // Size = 4 bytes
TYPE DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS_STRUCT DWORD
 friendlyNameFromEdid AS BIT * 1 IN DWORD ' UINT32
 friendlyNameForced AS BIT * 1
 edidIdsValid AS BIT * 1
 reserved AS BIT * 29
END TYPE
' // Size = 4 bytes
UNION DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS_UNION
 DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS_STRUCT
 value AS DWORD ' UINT32
END UNION
' // Size = 4 bytes
TYPE DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS DWORD
 DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS_UNION
END TYPE
' // Size = 420 bytes
TYPE DISPLAYCONFIG_TARGET_DEVICE_NAME DWORD FILL
 header AS DISPLAYCONFIG_DEVICE_INFO_HEADER
 flags AS DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS
 outputTechnology AS LONG ' DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY
 edidManufactureId AS WORD ' UINT16
 edidProductCodeId AS WORD ' UINT16
 connectorInstance AS DWORD ' UINT32
 monitorFriendlyDeviceName AS WSTRINGZ * 64 ' WCHAR
 monitorDevicePath AS WSTRINGZ * 128 ' WCHAR
END TYPE
' // Size = 80 bytes
TYPE DISPLAYCONFIG_TARGET_PREFERRED_MODE QWORD FILL ' Must be 8 byte aligned
 header AS DISPLAYCONFIG_DEVICE_INFO_HEADER
 width AS DWORD ' UINT32
 height AS DWORD ' UINT32
 targetMode AS DISPLAYCONFIG_TARGET_MODE
END TYPE
' // Size = 276 bytes
TYPE DISPLAYCONFIG_ADAPTER_NAME ' Must be 8 byte aligned
 header AS DISPLAYCONFIG_DEVICE_INFO_HEADER
 adapterDevicePath AS WSTRINGZ * 128 ' WCHAR
END TYPE
' // Size = 4 bytes
TYPE DISPLAYCONFIG_SET_TARGET_PERSISTENCE_STRUCT DWORD
 bootPersistenceOn AS BIT * 1 IN DWORD ' UINT32
 reserved AS BIT * 31
END TYPE
' // Size = 4 bytes
UNION DISPLAYCONFIG_SET_TARGET_PERSISTENCE_UNION
 DISPLAYCONFIG_SET_TARGET_PERSISTENCE_STRUCT
 value AS DWORD ' UINT32
END UNION
' // Size = 24 bytes
TYPE DISPLAYCONFIG_SET_TARGET_PERSISTENCE ' Must be 8 byte aligned
 header AS DISPLAYCONFIG_DEVICE_INFO_HEADER
 DISPLAYCONFIG_SET_TARGET_PERSISTENCE_UNION
END TYPE
'//
'// Definitions to be used by GetDisplayConfigBufferSizes and QueryDisplayConfig.
'//
%EQUATE `QDC_ALL_PATHS = &H00000001
%EQUATE `QDC_ONLY_ACTIVE_PATHS = &H00000002
%EQUATE `QDC_DATABASE_CURRENT = &H00000004
'//
'// Definitions used by SetDisplayConfig.
'//
%EQUATE `SDC_TOPOLOGY_INTERNAL = &H00000001
%EQUATE `SDC_TOPOLOGY_CLONE = &H00000002
%EQUATE `SDC_TOPOLOGY_EXTEND = &H00000004
%EQUATE `SDC_TOPOLOGY_EXTERNAL = &H00000008
%EQUATE `SDC_TOPOLOGY_SUPPLIED = &H00000010
%EQUATE `SDC_USE_DATABASE_CURRENT = %SDC_TOPOLOGY_INTERNAL OR %SDC_TOPOLOGY_CLONE OR %SDC_TOPOLOGY_EXTEND OR %SDC_TOPOLOGY_EXTERNAL
%EQUATE `SDC_USE_SUPPLIED_DISPLAY_CONFIG = &H00000020
%EQUATE `SDC_VALIDATE = &H00000040
%EQUATE `SDC_APPLY = &H00000080
%EQUATE `SDC_NO_OPTIMIZATION = &H00000100
%EQUATE `SDC_SAVE_TO_DATABASE = &H00000200
%EQUATE `SDC_ALLOW_CHANGES = &H00000400
%EQUATE `SDC_PATH_PERSIST_IF_REQUIRED = &H00000800
%EQUATE `SDC_FORCE_MODE_ENUMERATION = &H00001000
%EQUATE `SDC_ALLOW_PATH_ORDER_CHANGES = &H00002000
'#endif /* WINVER >= 0x0601 */
'/* GetRegionData/ExtCreateRegion */
%EQUATE `RDH_RECTANGLES = 1
#IF NOT %DEF(%RGNDATAHEADER_DEFINED)
%EQUATE `RGNDATAHEADER_DEFINED = 1
' // Size = 32 bytes
TYPE RGNDATAHEADER DWORD
 dwSize AS DWORD
 iType AS DWORD
 nCount AS DWORD
 nRgnSize AS DWORD
 rcBound AS RECT
END TYPE
#ENDIF
#IF NOT %DEF(%RGNDATA_DEFINED)
%EQUATE `RGNDATA_DEFINED = 1
' // Size = 36 bytes
TYPE RGNDATA DWORD
 rdh AS RGNDATAHEADER ' RGNDATAHEADER rdh
 Buffer(0) AS BYTE ' char Buffer[ 1 ] - arbitrary-size buffer
END TYPE
#ENDIF
'/* for GetRandomRgn */
%EQUATE `SYSRGN = 4
' // Size = 12 bytes
TYPE ABC DWORD
 abcA AS LONG ' int
 abcB AS DWORD ' UINT
 abcC AS LONG ' int
END TYPE
' // Size = 12 bytes
TYPE ABCFLOAT DWORD
 abcfA AS SINGLE ' FLOAT
 abcfB AS SINGLE ' FLOAT
 abcfC AS SINGLE ' FLOAT
END TYPE
#IF NOT %DEF(%NOTEXTMETRIC) ' -------------------------------------------------
'#ifndef NOTEXTMETRIC
'#ifdef _MAC
'#include "pshpack4.h"
'#endif
' // Size = 212 bytes
TYPE OUTLINETEXTMETRICA BYTE
 otmSize AS DWORD ' UINT
 otmTextMetrics AS TEXTMETRICA ' TEXTMETRICA
 otmFiller AS BYTE ' BYTE
 otmPanoseNumber AS PANOSE
 alignment__ AS BYTE
 otmfsSelection AS DWORD ' UINT
 otmfsType AS DWORD ' UINT
 otmsCharSlopeRise AS LONG ' int
 otmsCharSlopeRun AS LONG ' int
 otmItalicAngle AS LONG ' int
 otmEMSquare AS DWORD ' UINT
 otmAscent AS LONG ' int
 otmDescent AS LONG ' int
 otmLineGap AS DWORD ' UINT
 otmsCapEmHeight AS DWORD ' UINT
 otmsXHeight AS DWORD ' UINT
 otmrcFontBox AS RECT ' RECT
 otmMacAscent AS LONG ' int
 otmMacDescent AS LONG ' int
 otmMacLineGap AS DWORD ' UINT
 otmusMinimumPPEM AS DWORD ' UINT
 otmptSubscriptSize AS POINT
 otmptSubscriptOffset AS POINT
 otmptSuperscriptSize AS POINT
 otmptSuperscriptOffset AS POINT
 otmsStrikeoutSize AS DWORD ' UINT
 otmsStrikeoutPosition AS LONG ' int
 otmsUnderscorePosition AS LONG ' int
 otmsUnderscoreSize AS LONG ' int
 otmpFamilyName AS ASCIIZ PTR
 otmpFaceName AS ASCIIZ PTR
 otmpStyleName AS ASCIIZ PTR
 otmpFullName AS ASCIIZ PTR
END TYPE
' // Size = 216 bytes
TYPE OUTLINETEXTMETRICW BYTE
 otmSize AS DWORD ' UINT
 otmTextMetrics AS TEXTMETRICW
 otmFiller AS BYTE ' BYTE
 otmPanoseNumber AS PANOSE
 alignment__ AS BYTE
 otmfsSelection AS DWORD ' UINT
 otmfsType AS DWORD ' UINT
 otmsCharSlopeRise AS LONG ' int
 otmsCharSlopeRun AS LONG ' int
 otmItalicAngle AS LONG ' int
 otmEMSquare AS DWORD ' UINT
 otmAscent AS LONG ' int
 otmDescent AS LONG ' int
 otmLineGap AS DWORD ' UINT
 otmsCapEmHeight AS DWORD ' UINT
 otmsXHeight AS DWORD ' UINT
 otmrcFontBox AS RECT ' RECT
 otmMacAscent AS LONG ' int
 otmMacDescent AS LONG ' int
 otmMacLineGap AS DWORD ' UINT
 otmusMinimumPPEM AS DWORD ' UINT
 otmptSubscriptSize AS POINT
 otmptSubscriptOffset AS POINT
 otmptSuperscriptSize AS POINT
 otmptSuperscriptOffset AS POINT
 otmsStrikeoutSize AS DWORD ' UINT
 otmsStrikeoutPosition AS LONG ' int
 otmsUnderscorePosition AS LONG ' int
 otmsUnderscoreSize AS LONG ' int
 otmpFamilyName AS ASCIIZ PTR
 otmpFaceName AS ASCIIZ PTR
 otmpStyleName AS ASCIIZ PTR
 otmpFullName AS ASCIIZ PTR
END TYPE
#IF %DEF(%UNICODE)
 MACRO OUTLINETEXTMETRIC = OUTLINETEXTMETRICW
#ELSE
 MACRO OUTLINETEXTMETRIC = OUTLINETEXTMETRICA
#ENDIF
'#endif /* NOTEXTMETRIC */
#ENDIF ' #IF NOT %DEF(%NOTEXTMETRIC) ----------------------------------------
' // Size = 40 bytes
TYPE POLYTEXTA DWORD
 x AS LONG ' int
 y AS LONG ' int
 n AS DWORD ' UINT
 lpStr AS ASCIIZ PTR
 uiFlags AS DWORD ' UINT
 rcl AS RECT ' RECT
 pdx AS LONG PTR ' INT*
END TYPE
' // Size = 40 bytes
TYPE POLYTEXTW DWORD
 x AS LONG ' int
 y AS LONG ' int
 n AS DWORD ' UINT
 lpStr AS WSTRINGZ PTR
 uiFlags AS DWORD ' UINT
 rcl AS RECT ' RECT
 pdx AS LONG PTR ' int*
END TYPE
#IF %DEF(%UNICODE)
 MACRO POLYTEXT = POLYTEXTW
#ELSE
 MACRO POLYTEXT = POLYTEXTA
#ENDIF
' // Size = 4 bytes
TYPE FIXED WORD
 fract AS WORD ' WORD
 value AS INTEGER ' short
END TYPE
' // Size = 16 bytes
TYPE MAT2 DWORD
 eM11 AS FIXED
 eM12 AS FIXED
 eM21 AS FIXED
 eM22 AS FIXED
END TYPE
' // Size = 20 bytes
TYPE GLYPHMETRICS DWORD FILL
 gmBlackBoxX AS DWORD ' UINT
 gmBlackBoxY AS DWORD ' UINT
 gmptGlyphOrigin AS POINT
 gmCellIncX AS INTEGER ' short
 gmCellIncY AS INTEGER ' short
END TYPE
'// GetGlyphOutline constants
%EQUATE `GGO_METRICS = 0
%EQUATE `GGO_BITMAP = 1
%EQUATE `GGO_NATIVE = 2
%EQUATE `GGO_BEZIER = 3
'#if(WINVER >= 0x0400)
%EQUATE `GGO_GRAY2_BITMAP = 4
%EQUATE `GGO_GRAY4_BITMAP = 5
%EQUATE `GGO_GRAY8_BITMAP = 6
%EQUATE `GGO_GLYPH_INDEX = &H0080
'#endif /* WINVER >= 0x0400 */
'#if (_WIN32_WINNT >= 0x0500)
%EQUATE `GGO_UNHINTED = &H0100
'#endif // (_WIN32_WINNT >= 0x0500)
%EQUATE `TT_POLYGON_TYPE = 24
%EQUATE `TT_PRIM_LINE = 1
%EQUATE `TT_PRIM_QSPLINE = 2
%EQUATE `TT_PRIM_CSPLINE = 3
' // Size = 8 bytes
TYPE POINTFX DWORD
 x AS FIXED
 y AS FIXED
END TYPE
' // Size = 12 bytes
TYPE TTPOLYCURVE DWORD FILL
 wType AS WORD ' WORD
 cpfx AS WORD ' WORD
 apfx(0) AS POINTFX ' POINTFX apfx[1]
END TYPE
' // Size = 16 bytes
TYPE TTPOLYGONHEADER DWORD
 cb AS DWORD
 dwType AS DWORD
 pfxStart AS POINTFX
END TYPE
'#if(WINVER >= 0x0400)
%EQUATE `GCP_DBCS = &H00000001
%EQUATE `GCP_REORDER = &H00000002
%EQUATE `GCP_USEKERNING = &H00000008
%EQUATE `GCP_GLYPHSHAPE = &H00000010
%EQUATE `GCP_LIGATE = &H00000020
%EQUATE `GCP_DIACRITIC = &H00000100
%EQUATE `GCP_KASHIDA = &H00000400
%EQUATE `GCP_ERROR = &H00008000
%EQUATE `FLI_MASK = &H0000103B
%EQUATE `GCP_JUSTIFY = &H00010000
'%GCP_NODIACRITICS = &H00020000
%EQUATE `FLI_GLYPHS = &H00040000
%EQUATE `GCP_CLASSIN = &H00080000
%EQUATE `GCP_MAXEXTENT = &H00100000
%EQUATE `GCP_JUSTIFYIN = &H00200000
%EQUATE `GCP_DISPLAYZWG = &H00400000
%EQUATE `GCP_SYMSWAPOFF = &H00800000
%EQUATE `GCP_NUMERICOVERRIDE = &H01000000
%EQUATE `GCP_NEUTRALOVERRIDE = &H02000000
%EQUATE `GCP_NUMERICSLATIN = &H04000000
%EQUATE `GCP_NUMERICSLOCAL = &H08000000
%EQUATE `GCPCLASS_LATIN = 1
%EQUATE `GCPCLASS_HEBREW = 2
%EQUATE `GCPCLASS_ARABIC = 2
%EQUATE `GCPCLASS_NEUTRAL = 3
%EQUATE `GCPCLASS_LOCALNUMBER = 4
%EQUATE `GCPCLASS_LATINNUMBER = 5
%EQUATE `GCPCLASS_LATINNUMERICTERMINATOR = 6
%EQUATE `GCPCLASS_LATINNUMERICSEPARATOR = 7
%EQUATE `GCPCLASS_NUMERICSEPARATOR = 8
%EQUATE `GCPCLASS_PREBOUNDLTR = &H80
%EQUATE `GCPCLASS_PREBOUNDRTL = &H40
%EQUATE `GCPCLASS_POSTBOUNDLTR = &H20
%EQUATE `GCPCLASS_POSTBOUNDRTL = &H10
%EQUATE `GCPGLYPH_LINKBEFORE = &H8000
%EQUATE `GCPGLYPH_LINKAFTER = &H4000
' // Size = 36 bytes
TYPE GCP_RESULTSA DWORD
 lStructSize AS DWORD
 lpOutString AS ASCIIZ PTR
 lpOrder AS DWORD PTR ' UINT FAR*
 lpDx AS LONG PTR ' int FAR*
 lpCaretPos AS LONG PTR ' int FAR*
 lpClass AS ASCIIZ PTR
 lpGlyphs AS WSTRINGZ PTR
 nGlyphs AS DWORD ' UINT
 nMaxFit AS LONG ' int
END TYPE
' // Size = 36 bytes
TYPE GCP_RESULTSW DWORD
 lStructSize AS DWORD
 lpOutString AS WSTRINGZ PTR
 lpOrder AS DWORD PTR ' UINT FAR*
 lpDx AS LONG PTR ' int FAR*
 lpCaretPos AS LONG PTR ' int FAR*
 lpClass AS WSTRINGZ PTR
 lpGlyphs AS WSTRINGZ PTR
 nGlyphs AS DWORD ' UINT
 nMaxFit AS LONG ' int
END TYPE
#IF %DEF(%UNICODE)
 MACRO GCP_RESULTS = GCP_RESULTSW
#ELSE
 MACRO GCP_RESULTS = GCP_RESULTSA
#ENDIF
' // Size = 6 bytes
TYPE RASTERIZER_STATUS WORD
 nSize AS INTEGER ' short
 wFlags AS INTEGER ' short
 nLanguageID AS INTEGER ' short
END TYPE
'/* bits defined in wFlags of RASTERIZER_STATUS */
%EQUATE `TT_AVAILABLE = &H0001%
%EQUATE `TT_ENABLED = &H0002%
'/* Pixel format descriptor */
' // Size = 40 bytes
TYPE PIXELFORMATDESCRIPTOR DWORD FILL
 nSize AS WORD
 nVersion AS WORD
 dwFlags AS DWORD
 iPixelType AS BYTE
 cColorBits AS BYTE
 cRedBits AS BYTE
 cRedShift AS BYTE
 cGreenBits AS BYTE
 cGreenShift AS BYTE
 cBlueBits AS BYTE
 cBlueShift AS BYTE
 cAlphaBits AS BYTE
 cAlphaShift AS BYTE
 cAccumBits AS BYTE
 cAccumRedBits AS BYTE
 cAccumGreenBits AS BYTE
 cAccumBlueBits AS BYTE
 cAccumAlphaBits AS BYTE
 cDepthBits AS BYTE
 cStencilBits AS BYTE
 cAuxBuffers AS BYTE
 iLayerType AS BYTE
 bReserved AS BYTE
 dwLayerMask AS DWORD
 dwVisibleMask AS DWORD
 dwDamageMask AS DWORD
END TYPE
'/* pixel types */
%EQUATE `PFD_TYPE_RGBA = 0
%EQUATE `PFD_TYPE_COLORINDEX = 1
'/* layer types */
%EQUATE `PFD_MAIN_PLANE = 0
%EQUATE `PFD_OVERLAY_PLANE = 1
%EQUATE `PFD_UNDERLAY_PLANE = -1
'/* PIXELFORMATDESCRIPTOR flags */
%EQUATE `PFD_DOUBLEBUFFER = &H00000001
%EQUATE `PFD_STEREO = &H00000002
%EQUATE `PFD_DRAW_TO_WINDOW = &H00000004
%EQUATE `PFD_DRAW_TO_BITMAP = &H00000008
%EQUATE `PFD_SUPPORT_GDI = &H00000010
%EQUATE `PFD_SUPPORT_OPENGL = &H00000020
%EQUATE `PFD_GENERIC_FORMAT = &H00000040
%EQUATE `PFD_NEED_PALETTE = &H00000080
%EQUATE `PFD_NEED_SYSTEM_PALETTE = &H00000100
%EQUATE `PFD_SWAP_EXCHANGE = &H00000200
%EQUATE `PFD_SWAP_COPY = &H00000400
%EQUATE `PFD_SWAP_LAYER_BUFFERS = &H00000800
%EQUATE `PFD_GENERIC_ACCELERATED = &H00001000
%EQUATE `PFD_SUPPORT_DIRECTDRAW = &H00002000
%EQUATE `PFD_DIRECT3D_ACCELERATED = &H00004000
%EQUATE `PFD_SUPPORT_COMPOSITION = &H00008000
'/* PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only */
%EQUATE `PFD_DEPTH_DONTCARE = &H20000000
%EQUATE `PFD_DOUBLEBUFFER_DONTCARE = &H40000000
%EQUATE `PFD_STEREO_DONTCARE = &H80000000
'#ifdef STRICT
'#if !defined(NOTEXTMETRIC)
'typedef int (CALLBACK* OLDFONTENUMPROCA)(CONST LOGFONTA *, CONST TEXTMETRICA *, DWORD, LPARAM);
'typedef int (CALLBACK* OLDFONTENUMPROCW)(CONST LOGFONTW *, CONST TEXTMETRICW *, DWORD, LPARAM);
'typedef int (CALLBACK* GOBJENUMPROC)(LPVOID, LPARAM);
'typedef VOID (CALLBACK* LINEDDAPROC)(int, int, LPARAM);
'#else
'typedef FARPROC OLDFONTENUMPROC;
'typedef FARPROC FONTENUMPROCA;
'typedef FARPROC FONTENUMPROCW;
'typedef FARPROC GOBJENUMPROC;
'typedef FARPROC LINEDDAPROC;
'#endif
DECLARE FUNCTION AddFontResourceA LIB "gdi32.dll" ALIAS "AddFontResourceA" ( BYREF lpszFilename AS ASCIIZ ) AS LONG ' int
DECLARE FUNCTION AddFontResourceW LIB "gdi32.dll" ALIAS "AddFontResourceW" ( BYREF lpszFilename AS WSTRINGZ ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO AddFontResource = AddFontResourceW
#ELSE
 MACRO AddFontResource = AddFontResourceA
#ENDIF
DECLARE FUNCTION AnimatePalette LIB "gdi32.dll" ALIAS "AnimatePalette" ( BYVAL hPal AS QUAD , BYVAL iStartIndex AS QUAD , BYVAL cEntries AS QUAD , BYREF ppe AS PALETTEENTRY ) AS LONG
DECLARE FUNCTION Arc LIB "gdi32.dll" ALIAS "Arc" ( BYVAL hdc AS QUAD
 , BYVAL x1 AS LONG
 , BYVAL y1 AS LONG
 , BYVAL x2 AS LONG
 , BYVAL y2 AS LONG
 , BYVAL x3 AS LONG
 , BYVAL y3 AS LONG
 , BYVAL x4 AS LONG
 , BYVAL y4 AS LONG
 ) AS LONG
DECLARE FUNCTION BitBlt LIB "gdi32.dll" ALIAS "BitBlt" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , BYVAL cx AS LONG
 , BYVAL cy AS LONG
 , BYVAL hdcSrc AS DWORD
 , BYVAL x1 AS LONG
 , BYVAL y1 AS LONG
 , BYVAL rop AS DWORD
 ) AS LONG
DECLARE FUNCTION CancelDC LIB "gdi32.dll" ALIAS "CancelDC" ( BYVAL hdc AS DWORD
 ) AS LONG
DECLARE FUNCTION Chord LIB "gdi32.dll" ALIAS "Chord" ( BYVAL hdc AS DWORD
 , BYVAL x1 AS LONG
 , BYVAL y1 AS LONG
 , BYVAL x2 AS LONG
 , BYVAL y2 AS LONG
 , BYVAL x3 AS LONG
 , BYVAL y3 AS LONG
 , BYVAL x4 AS LONG
 , BYVAL y4 AS LONG
 ) AS LONG
DECLARE FUNCTION ChoosePixelFormat LIB "gdi32.dll" ALIAS "ChoosePixelFormat" ( BYVAL hdc AS DWORD
 , BYREF ppfd AS PIXELFORMATDESCRIPTOR
 ) AS LONG ' int
DECLARE FUNCTION CloseMetaFile LIB "gdi32.dll" ALIAS "CloseMetaFile" ( BYVAL hdc AS QUAD ) AS QUAD ' HMETAFILE
DECLARE FUNCTION CombineRgn LIB "gdi32.dll" ALIAS "CombineRgn" ( BYVAL hrgnDst AS QUAD , BYVAL hrgnSrc1 AS QUAD , BYVAL hrgnSrc2 AS QUAD , BYVAL iMode AS LONG ) AS LONG ' int
DECLARE FUNCTION CopyMetaFileA LIB "gdi32.dll" ALIAS "CopyMetaFileA" ( BYVAL hmfSrc AS QUAD , OPTIONAL BYREF lpszFile AS ASCIIZ ) AS QUAD ' HMETAFILE
DECLARE FUNCTION CopyMetaFileW LIB "gdi32.dll" ALIAS "CopyMetaFileW" ( BYVAL hmfSrc AS QUAD , OPTIONAL BYREF lpszFile AS WSTRINGZ ) AS QUAD ' HMETAFILE
#IF %DEF(%UNICODE)
 MACRO CopyMetaFile = CopyMetaFileW
#ELSE
 MACRO CopyMetaFile = CopyMetaFileA
#ENDIF
DECLARE FUNCTION CreateBitmap LIB "gdi32.dll" ALIAS "CreateBitmap" ( BYVAL nWidth AS LONG , BYVAL nHeight AS LONG , BYVAL nPlanes AS QUAD , BYVAL nBitCount AS QUAD , OPTIONAL BYREF lpBits AS ANY ) AS QUAD ' HBITMAP
DECLARE FUNCTION CreateBitmapIndirect LIB "gdi32.dll" ALIAS "CreateBitmapIndirect" ( BYREF pbm AS BITMAP ) AS QUAD ' HBITMAP
DECLARE FUNCTION CreateBrushIndirect LIB "gdi32.dll" ALIAS "CreateBrushIndirect" ( BYREF plbrush AS LOGBRUSH ) AS QUAD ' HBRUSH
DECLARE FUNCTION CreateCompatibleBitmap LIB "gdi32.dll" ALIAS "CreateCompatibleBitmap" ( BYVAL hdc AS QUAD , BYVAL cx AS LONG , BYVAL cy AS LONG ) AS QUAD ' HBITMAP
DECLARE FUNCTION CreateDiscardableBitmap LIB "gdi32.dll" ALIAS "CreateDiscardableBitmap" ( BYVAL hdc AS QUAD , BYVAL cx AS LONG , BYVAL cy AS LONG ) AS QUAD ' HBITMAP
DECLARE FUNCTION CreateCompatibleDC LIB "gdi32.dll" ALIAS "CreateCompatibleDC" ( OPTIONAL BYVAL hdc AS QUAD ) AS QUAD ' HDC
DECLARE FUNCTION CreateDCA LIB "gdi32.dll" ALIAS "CreateDCA" ( OPTIONAL BYREF pwszDriver AS ASCIIZ , OPTIONAL BYREF pwszDevice AS ASCIIZ , OPTIONAL BYREF pszPort AS ASCIIZ , OPTIONAL BYREF pdm AS DEVMODEA ) AS QUAD ' HDC
DECLARE FUNCTION CreateDCW LIB "gdi32.dll" ALIAS "CreateDCW" ( OPTIONAL BYREF pwszDriver AS WSTRINGZ , OPTIONAL BYREF pwszDevice AS WSTRINGZ , OPTIONAL BYREF pszPort AS WSTRINGZ , OPTIONAL BYREF pdm AS DEVMODEW ) AS QUAD ' HDC
#IF %DEF(%UNICODE)
 MACRO CreateDC = CreateDCW
#ELSE
 MACRO CreateDC = CreateDCA
#ENDIF
DECLARE FUNCTION CreateDIBitmap LIB "gdi32.dll" ALIAS "CreateDIBitmap" ( BYVAL hdc AS QUAD , BYREF pbmih AS BITMAPINFOHEADER , BYVAL flInit AS QUAD , BYREF pjBits AS ANY , BYREF pbmi AS BITMAPINFO , BYVAL iUsage AS QUAD ) AS QUAD ' HBITMAP
DECLARE FUNCTION CreateDIBPatternBrush LIB "gdi32.dll" ALIAS "CreateDIBPatternBrush" ( BYVAL h AS QUAD , BYVAL iUsage AS QUAD ) AS QUAD ' HBRUSH
DECLARE FUNCTION CreateDIBPatternBrushPt LIB "gdi32.dll" ALIAS "CreateDIBPatternBrushPt" ( BYREF lpPackedDIB AS ANY , BYVAL iUsage AS QUAD ) AS QUAD ' HBRUSH
DECLARE FUNCTION CreateEllipticRgn LIB "gdi32.dll" ALIAS "CreateEllipticRgn" ( BYVAL x1 AS LONG , BYVAL y1 AS LONG , BYVAL x2 AS LONG , BYVAL y2 AS LONG ) AS QUAD ' HRGN
DECLARE FUNCTION CreateEllipticRgnIndirect LIB "gdi32.dll" ALIAS "CreateEllipticRgnIndirect" ( BYREF lprect AS RECT ) AS QUAD ' HRGN
DECLARE FUNCTION CreateFontIndirectA LIB "gdi32.dll" ALIAS "CreateFontIndirectA" ( BYREF lplf AS LOGFONTA ) AS QUAD ' HFONT
DECLARE FUNCTION CreateFontIndirectW LIB "gdi32.dll" ALIAS "CreateFontIndirectW" ( BYREF lplf AS LOGFONTW ) AS QUAD ' HFONT
#IF %DEF(%UNICODE)
 MACRO CreateFontIndirect = CreateFontIndirectW
#ELSE
 MACRO CreateFontIndirect = CreateFontIndirectA
#ENDIF
DECLARE FUNCTION CreateFontA LIB "gdi32.dll" ALIAS "CreateFontA" ( BYVAL cHeight AS LONG , BYVAL cWidth AS LONG , BYVAL cEscapement AS LONG , BYVAL cOrientation AS LONG , BYVAL cWeight AS LONG , BYVAL bItalic AS QUAD , BYVAL bUnderline AS QUAD , BYVAL bStrikeOut AS QUAD , BYVAL iCharSet AS QUAD , BYVAL iOutPrecision AS QUAD , BYVAL iClipPrecision AS QUAD , BYVAL iQuality AS QUAD , BYVAL iPitchAndFamily AS QUAD , OPTIONAL BYREF pszFaceName AS ASCIIZ ) AS QUAD ' HFONT
DECLARE FUNCTION CreateFontW LIB "gdi32.dll" ALIAS "CreateFontW" ( BYVAL cHeight AS LONG , BYVAL cWidth AS LONG , BYVAL cEscapement AS LONG , BYVAL cOrientation AS LONG , BYVAL cWeight AS LONG , BYVAL bItalic AS QUAD , BYVAL bUnderline AS QUAD , BYVAL bStrikeOut AS QUAD , BYVAL iCharSet AS QUAD , BYVAL iOutPrecision AS QUAD , BYVAL iClipPrecision AS QUAD , BYVAL iQuality AS QUAD , BYVAL iPitchAndFamily AS QUAD , OPTIONAL BYREF pszFaceName AS WSTRINGZ ) AS QUAD ' HFONT
#IF %DEF(%UNICODE)
 MACRO CreateFont = CreateFontW
#ELSE
 MACRO CreateFont = CreateFontA
#ENDIF
DECLARE FUNCTION CreateHatchBrush LIB "gdi32.dll" ALIAS "CreateHatchBrush" ( BYVAL iHatch AS LONG , BYVAL color AS QUAD ) AS QUAD ' HBRUSH
DECLARE FUNCTION CreateICA LIB "gdi32.dll" ALIAS "CreateICA" ( OPTIONAL BYREF pszDriver AS ASCIIZ , OPTIONAL BYREF pszDevice AS ASCIIZ , OPTIONAL BYREF pszPort AS ASCIIZ , OPTIONAL BYREF pdm AS DEVMODEA ) AS QUAD ' HDC
DECLARE FUNCTION CreateICW LIB "gdi32.dll" ALIAS "CreateICW" ( OPTIONAL BYREF pszDriver AS WSTRINGZ , OPTIONAL BYREF pszDevice AS WSTRINGZ , OPTIONAL BYREF pszPort AS WSTRINGZ , OPTIONAL BYREF pdm AS DEVMODEW ) AS QUAD ' HDC
#IF %DEF(%UNICODE)
 MACRO CreateIC = CreateICW
#ELSE
 MACRO CreateIC = CreateICA
#ENDIF
DECLARE FUNCTION CreateMetaFileA LIB "gdi32.dll" ALIAS "CreateMetaFileA" ( OPTIONAL BYREF pszFile AS ASCIIZ ) AS QUAD ' HDC
DECLARE FUNCTION CreateMetaFileW LIB "gdi32.dll" ALIAS "CreateMetaFileW" ( OPTIONAL BYREF pszFile AS WSTRINGZ ) AS QUAD ' HDC
#IF %DEF(%UNICODE)
 MACRO CreateMetaFile = CreateMetaFileW
#ELSE
 MACRO CreateMetaFile = CreateMetaFileA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION CreatePalette LIB "GDI32.dll" ALIAS "CreatePalette" (BYVAL lpLogPalette AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION CreatePalette LIB "gdi32.dll" ALIAS "CreatePalette" ( BYREF plpal AS ANY ) AS QUAD ' HPALETTE
#ENDIF
DECLARE FUNCTION CreatePen LIB "gdi32.dll" ALIAS "CreatePen" ( BYVAL iStyle AS LONG , BYVAL cWidth AS LONG , BYVAL color AS QUAD ) AS QUAD ' HPEN
DECLARE FUNCTION CreatePenIndirect LIB "gdi32.dll" ALIAS "CreatePenIndirect" ( BYREF plpen AS LOGPEN ) AS QUAD ' HPEN
DECLARE FUNCTION CreatePolyPolygonRgn LIB "gdi32.dll" ALIAS "CreatePolyPolygonRgn" ( BYREF pptl AS POINT , BYREF pc AS LONG , BYVAL cPoly AS LONG , BYVAL iMode AS LONG ) AS QUAD ' HRGN
DECLARE FUNCTION CreatePatternBrush LIB "gdi32.dll" ALIAS "CreatePatternBrush" ( BYVAL hbm AS QUAD ) AS QUAD ' HBRUSH
DECLARE FUNCTION CreateRectRgn LIB "gdi32.dll" ALIAS "CreateRectRgn" ( BYVAL x1 AS LONG , BYVAL y1 AS LONG , BYVAL x2 AS LONG , BYVAL y2 AS LONG ) AS QUAD ' HRGN
DECLARE FUNCTION CreateRectRgnIndirect LIB "gdi32.dll" ALIAS "CreateRectRgnIndirect" ( BYREF lprect AS RECT ) AS QUAD ' HRGN
DECLARE FUNCTION CreateRoundRectRgn LIB "gdi32.dll" ALIAS "CreateRoundRectRgn" ( BYVAL x1 AS LONG , BYVAL y1 AS LONG , BYVAL x2 AS LONG , BYVAL y2 AS LONG , BYVAL w AS LONG , BYVAL h AS LONG ) AS QUAD ' HRGN
DECLARE FUNCTION CreateScalableFontResourceA LIB "gdi32.dll" ALIAS "CreateScalableFontResourceA" ( BYVAL fdwHidden AS QUAD , BYREF lpszFont AS ASCIIZ , BYREF lpszFile AS ASCIIZ , OPTIONAL BYREF lpszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION CreateScalableFontResourceW LIB "gdi32.dll" ALIAS "CreateScalableFontResourceW" ( BYVAL fdwHidden AS QUAD
 , BYREF lpszFont AS WSTRINGZ
 , BYREF lpszFile AS WSTRINGZ
 , OPTIONAL BYREF lpszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO CreateScalableFontResource = CreateScalableFontResourceW
#ELSE
 MACRO CreateScalableFontResource = CreateScalableFontResourceA
#ENDIF
DECLARE FUNCTION CreateSolidBrush LIB "gdi32.dll" ALIAS "CreateSolidBrush" ( BYVAL color AS QUAD ) AS QUAD ' HBRUSH
DECLARE FUNCTION DeleteDC LIB "gdi32.dll" ALIAS "DeleteDC" ( BYVAL hdc AS QUAD ) AS LONG
DECLARE FUNCTION DeleteMetaFile LIB "gdi32.dll" ALIAS "DeleteMetaFile" ( BYVAL hmf AS QUAD
 ) AS LONG
DECLARE FUNCTION DeleteObject LIB "gdi32.dll" ALIAS "DeleteObject" ( BYVAL ho AS DWORD
 ) AS LONG
DECLARE FUNCTION DescribePixelFormat LIB "gdi32.dll" ALIAS "DescribePixelFormat" ( BYVAL hdc AS DWORD
 , BYVAL iPixelFormat AS LONG
 , BYVAL nBytes AS DWORD
 , BYREF ppfd AS PIXELFORMATDESCRIPTOR
 ) AS LONG ' int
'/* define types of pointers to ExtDeviceMode() and DeviceCapabilities()
' * functions for Win 3.1 compatibility
' */
'typedef UINT (CALLBACK* LPFNDEVMODE)(HWND, HMODULE, LPDEVMODE, LPSTR, LPSTR, LPDEVMODE, LPSTR, UINT);
'typedef DWORD (CALLBACK* LPFNDEVCAPS)(LPSTR, LPSTR, UINT, LPSTR, LPDEVMODE);
'/* mode selections for the device mode function */
%EQUATE `DM_UPDATE = 1
%EQUATE `DM_COPY = 2
%EQUATE `DM_PROMPT = 4
%EQUATE `DM_MODIFY = 8
%EQUATE `DM_IN_BUFFER = %DM_MODIFY
%EQUATE `DM_IN_PROMPT = %DM_PROMPT
%EQUATE `DM_OUT_BUFFER = %DM_COPY
%EQUATE `DM_OUT_DEFAULT = %DM_UPDATE
'/* device capabilities indices */
%EQUATE `DC_FIELDS = 1
%EQUATE `DC_PAPERS = 2
%EQUATE `DC_PAPERSIZE = 3
%EQUATE `DC_MINEXTENT = 4
%EQUATE `DC_MAXEXTENT = 5
%EQUATE `DC_BINS = 6
%EQUATE `DC_DUPLEX = 7
%EQUATE `DC_SIZE = 8
%EQUATE `DC_EXTRA = 9
%EQUATE `DC_VERSION = 10
%EQUATE `DC_DRIVER = 11
%EQUATE `DC_BINNAMES = 12
%EQUATE `DC_ENUMRESOLUTIONS = 13
%EQUATE `DC_FILEDEPENDENCIES = 14
%EQUATE `DC_TRUETYPE = 15
%EQUATE `DC_PAPERNAMES = 16
%EQUATE `DC_ORIENTATION = 17
%EQUATE `DC_COPIES = 18
'#if(WINVER >= 0x0400)
%EQUATE `DC_BINADJUST = 19
%EQUATE `DC_EMF_COMPLIANT = 20
%EQUATE `DC_DATATYPE_PRODUCED = 21
%EQUATE `DC_COLLATE = 22
%EQUATE `DC_MANUFACTURER = 23
%EQUATE `DC_MODEL = 24
'#endif /* WINVER >= 0x0400 */
'#if(WINVER >= 0x0500)
%EQUATE `DC_PERSONALITY = 25
%EQUATE `DC_PRINTRATE = 26
%EQUATE `DC_PRINTRATEUNIT = 27
%EQUATE `PRINTRATEUNIT_PPM = 1
%EQUATE `PRINTRATEUNIT_CPS = 2
%EQUATE `PRINTRATEUNIT_LPM = 3
%EQUATE `PRINTRATEUNIT_IPM = 4
%EQUATE `DC_PRINTERMEM = 28
%EQUATE `DC_MEDIAREADY = 29
%EQUATE `DC_STAPLE = 30
%EQUATE `DC_PRINTRATEPPM = 31
%EQUATE `DC_COLORDEVICE = 32
%EQUATE `DC_NUP = 33
'#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
%EQUATE `DC_MEDIATYPENAMES = 34
%EQUATE `DC_MEDIATYPES = 35
'#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
'#endif /* WINVER >= 0x0500 */
'/* bit fields of the return value (DWORD) for DC_TRUETYPE */
%EQUATE `DCTT_BITMAP = &H0000001
%EQUATE `DCTT_DOWNLOAD = &H0000002
%EQUATE `DCTT_SUBDEV = &H0000004
'#if(WINVER >= = &H0400)
%EQUATE `DCTT_DOWNLOAD_OUTLINE = &H0000008
'/* return values for DC_BINADJUST */
%EQUATE `DCBA_FACEUPNONE = &H0000
%EQUATE `DCBA_FACEUPCENTER = &H0001
%EQUATE `DCBA_FACEUPLEFT = &H0002
%EQUATE `DCBA_FACEUPRIGHT = &H0003
%EQUATE `DCBA_FACEDOWNNONE = &H0100
%EQUATE `DCBA_FACEDOWNCENTER = &H0101
%EQUATE `DCBA_FACEDOWNLEFT = &H0102
%EQUATE `DCBA_FACEDOWNRIGHT = &H0103
'#endif /* WINVER >= 0x0400 */
' // Note: The pOutput parameter has been declared AS ANY because the type depends on the
' // fwCapability flag.
DECLARE FUNCTION DeviceCapabilitiesA LIB "winspool.drv" ALIAS "DeviceCapabilitiesA" ( BYREF pDevice AS ASCIIZ , BYREF pPort AS ASCIIZ , BYVAL fwCapability AS WORD , OPTIONAL BYREF pOutput AS ANY , OPTIONAL BYREF pDevMode AS DEVMODEA ) AS LONG ' int
' // Note: The pOutput parameter has been declared AS ANY because the type depends on the
' // fwCapability flag.
DECLARE FUNCTION DeviceCapabilitiesW LIB "winspool.drv" ALIAS "DeviceCapabilitiesW" ( BYREF pDevice AS WSTRINGZ , BYREF pPort AS WSTRINGZ , BYVAL fwCapability AS WORD , OPTIONAL BYREF pOutput AS ANY , OPTIONAL BYREF pDevMode AS DEVMODEW ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO DeviceCapabilities = DeviceCapabilitiesW
#ELSE
 MACRO DeviceCapabilities = DeviceCapabilitiesA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION DrawEscape LIB "GDI32.dll" ALIAS "DrawEscape" (BYVAL hdc AS QUAD, BYVAL nEscape AS LONG, BYVAL cbInput AS LONG, BYVAL lpszInData AS BYTE PTR) AS LONG
#ELSE
DECLARE FUNCTION DrawEscape LIB "gdi32.dll" ALIAS "DrawEscape" ( BYVAL hdc AS QUAD , BYVAL iEscape AS LONG , BYVAL cjIn AS LONG , BYREF lpIn AS ASCIIZ ) AS LONG ' int
#ENDIF
DECLARE FUNCTION Ellipse LIB "gdi32.dll" ALIAS "Ellipse" ( BYVAL hdc AS QUAD , BYVAL left AS LONG , BYVAL top AS LONG , BYVAL right AS LONG , BYVAL bottom AS LONG ) AS LONG
'#if(WINVER >= 0x0400)
DECLARE FUNCTION EnumFontFamiliesExA LIB "gdi32.dll" ALIAS "EnumFontFamiliesExA" ( BYVAL hdc AS QUAD , BYREF lpLogfont AS LOGFONTA , BYVAL lpProc AS QUAD , BYVAL lParam AS LONG , BYVAL dwFlags AS QUAD ) AS LONG ' int
DECLARE FUNCTION EnumFontFamiliesExW LIB "gdi32.dll" ALIAS "EnumFontFamiliesExW" ( BYVAL hdc AS QUAD , BYREF lpLogfont AS LOGFONTW , BYVAL lpProc AS QUAD , BYVAL lParam AS LONG , BYVAL dwFlags AS QUAD ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO EnumFontFamiliesEx = EnumFontFamiliesExW
#ELSE
 MACRO EnumFontFamiliesEx = EnumFontFamiliesExA
#ENDIF
DECLARE FUNCTION EnumFontFamiliesA LIB "gdi32.dll" ALIAS "EnumFontFamiliesA" ( BYVAL hdc AS QUAD , BYREF lpLogfont AS ASCIIZ , BYVAL lpProc AS QUAD , BYVAL lParam AS LONG ) AS LONG ' int
DECLARE FUNCTION EnumFontFamiliesW LIB "gdi32.dll" ALIAS "EnumFontFamiliesW" ( BYVAL hdc AS QUAD , BYREF lpLogfont AS WSTRINGZ , BYVAL lpProc AS QUAD , BYVAL lParam AS LONG ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO EnumFontFamilies = EnumFontFamiliesW
#ELSE
 MACRO EnumFontFamilies = EnumFontFamiliesA
#ENDIF
DECLARE FUNCTION EnumFontsA LIB "gdi32.dll" ALIAS "EnumFontsA" ( BYVAL hdc AS QUAD , BYREF lpLogfont AS ASCIIZ , BYVAL lpProc AS QUAD , BYVAL lParam AS LONG ) AS LONG ' int
DECLARE FUNCTION EnumFontsW LIB "gdi32.dll" ALIAS "EnumFontsW" ( BYVAL hdc AS QUAD , BYREF lpLogfont AS WSTRINGZ , BYVAL lpProc AS QUAD , BYVAL lParam AS LONG ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO EnumFonts = EnumFontsW
#ELSE
 MACRO EnumFonts = EnumFontsA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION EnumObjects LIB "GDI32.dll" ALIAS "EnumObjects" (BYVAL hDC AS QUAD, BYVAL n AS LONG, BYVAL lpGOBJEnumProc AS QUAD, BYVAL lpVoid AS QUAD) AS LONG
#ELSE
DECLARE FUNCTION EnumObjects LIB "gdi32.dll" ALIAS "EnumObjects" ( BYVAL hdc AS QUAD , BYVAL nType AS LONG , BYVAL lpFunc AS QUAD , BYREF lParam AS ANY ) AS LONG ' int
#ENDIF
DECLARE FUNCTION EqualRgn LIB "gdi32.dll" ALIAS "EqualRgn" ( BYVAL hrgn1 AS QUAD , BYVAL hrgn2 AS QUAD ) AS LONG
' Note The pvIn parameter has been declared as ANY because it can be
' a pointer to different data types and structures.
DECLARE FUNCTION Escape LIB "gdi32.dll" ALIAS "Escape" ( BYVAL hdc AS QUAD , BYVAL iEscape AS LONG , BYVAL cjIn AS LONG , BYREF pvIn AS ANY , OPTIONAL BYREF pvOut AS ANY ) AS LONG ' int
' Note The lpInData and lpOutData parameters have been declared as ANY because
' can be pointers to different data types and structures.
DECLARE FUNCTION ExtEscape LIB "gdi32.dll" ALIAS "ExtEscape" ( BYVAL hdc AS QUAD , BYVAL iEscape AS LONG , BYVAL cjInput AS LONG , BYREF lpInData AS ANY , BYVAL cjOutput AS LONG , BYREF lpOutData AS ANY ) AS LONG ' int
DECLARE FUNCTION ExcludeClipRect LIB "gdi32.dll" ALIAS "ExcludeClipRect" ( BYVAL hdc AS QUAD , BYVAL left AS LONG , BYVAL top AS LONG , BYVAL right AS LONG , BYVAL bottom AS LONG ) AS LONG ' int
DECLARE FUNCTION ExtCreateRegion LIB "gdi32.dll" ALIAS "ExtCreateRegion" ( BYREF lpx AS XFORM , BYVAL nCount AS QUAD , BYREF lpData AS RGNDATA ) AS QUAD ' HRGN
DECLARE FUNCTION ExtFloodFill LIB "gdi32.dll" ALIAS "ExtFloodFill" ( BYVAL hdc AS QUAD , BYVAL x AS LONG , BYVAL y AS LONG , BYVAL color AS QUAD , BYVAL type AS QUAD ) AS LONG
DECLARE FUNCTION FillRgn LIB "gdi32.dll" ALIAS "FillRgn" ( BYVAL hdc AS QUAD
 , BYVAL hrgn AS DWORD
 , BYVAL hbr AS DWORD
 ) AS LONG
DECLARE FUNCTION FloodFill LIB "gdi32.dll" ALIAS "FloodFill" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , BYVAL color AS DWORD
 ) AS LONG
DECLARE FUNCTION FrameRgn LIB "gdi32.dll" ALIAS "FrameRgn" ( BYVAL hdc AS DWORD
 , BYVAL hrgn AS DWORD
 , BYVAL hbr AS DWORD
 , BYVAL w AS LONG
 , BYVAL h AS LONG
 ) AS LONG
DECLARE FUNCTION GetROP2 LIB "gdi32.dll" ALIAS "GetROP2" ( BYVAL hdc AS DWORD
 ) AS LONG ' int
DECLARE FUNCTION GetAspectRatioFilterEx LIB "gdi32.dll" ALIAS "GetAspectRatioFilterEx" ( BYVAL hdc AS QUAD , BYREF lpsize AS SIZE ) AS LONG
DECLARE FUNCTION GetBkColor LIB "gdi32.dll" ALIAS "GetBkColor" ( BYVAL hdc AS QUAD
 ) AS DWORD ' COLORREF
'#if (_WIN32_WINNT >= 0x0500)
DECLARE FUNCTION GetDCBrushColor LIB "gdi32.dll" ALIAS "GetDCBrushColor" ( BYVAL hdc AS QUAD ) AS QUAD ' COLORREF
DECLARE FUNCTION GetDCPenColor LIB "gdi32.dll" ALIAS "GetDCPenColor" ( BYVAL hdc AS QUAD ) AS QUAD ' COLORREF
'#endif
DECLARE FUNCTION GetBkMode LIB "gdi32.dll" ALIAS "GetBkMode" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION GetBitmapBits LIB "gdi32.dll" ALIAS "GetBitmapBits" ( BYVAL hbit AS QUAD , BYVAL cb AS LONG , BYREF lpvBits AS ANY ) AS LONG
DECLARE FUNCTION GetBitmapDimensionEx LIB "gdi32.dll" ALIAS "GetBitmapDimensionEx" ( BYVAL hbit AS QUAD
 , BYREF lpsize AS SIZE
 ) AS LONG
DECLARE FUNCTION GetBoundsRect LIB "gdi32.dll" ALIAS "GetBoundsRect" ( BYVAL hdc AS DWORD
 , BYREF lprect AS RECT
 , BYVAL flags AS DWORD
 ) AS DWORD ' UINT
DECLARE FUNCTION GetBrushOrgEx LIB "gdi32.dll" ALIAS "GetBrushOrgEx" ( BYVAL hdc AS QUAD , BYREF lppt AS POINT ) AS LONG
DECLARE FUNCTION GetCharWidthA LIB "gdi32.dll" ALIAS "GetCharWidthA" ( BYVAL hdc AS QUAD
 , BYVAL iFirst AS DWORD
 , BYVAL iLast AS DWORD
 , BYREF lpBuffer AS LONG
 ) AS LONG
DECLARE FUNCTION GetCharWidthW LIB "gdi32.dll" ALIAS "GetCharWidthW" ( BYVAL hdc AS DWORD
 , BYVAL iFirst AS DWORD
 , BYVAL iLast AS DWORD
 , BYREF lpBuffer AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetCharWidth = GetCharWidthW
#ELSE
 MACRO GetCharWidth = GetCharWidthA
#ENDIF
DECLARE FUNCTION GetCharWidth32A LIB "gdi32.dll" ALIAS "GetCharWidth32A" ( BYVAL hdc AS QUAD , BYVAL iFirst AS QUAD , BYVAL iLast AS QUAD , BYREF lpBuffer AS LONG ) AS LONG
DECLARE FUNCTION GetCharWidth32W LIB "gdi32.dll" ALIAS "GetCharWidth32W" ( BYVAL hdc AS QUAD
 , BYVAL iFirst AS DWORD
 , BYVAL iLast AS DWORD
 , BYREF lpBuffer AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetCharWidth32 = GetCharWidth32W
#ELSE
 MACRO GetCharWidth32 = GetCharWidth32A
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION GetCharWidthFloatA LIB "GDI32.dll" ALIAS "GetCharWidthFloatA" (BYVAL hdc AS QUAD, BYVAL dFirstChar AS QUAD, BYVAL dLastChar AS QUAD, BYVAL pxBuffer AS SINGLE PTR) AS LONG
#ELSE
DECLARE FUNCTION GetCharWidthFloatA LIB "gdi32.dll" ALIAS "GetCharWidthFloatA" ( BYVAL hdc AS QUAD , BYVAL iFirst AS QUAD , BYVAL iLast AS QUAD , BYREF lpBuffer AS SINGLE ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION GetCharWidthFloatW LIB "GDI32.dll" ALIAS "GetCharWidthFloatW" (BYVAL hdc AS QUAD, BYVAL dFirstChar AS QUAD, BYVAL dLastChar AS QUAD, BYVAL pxBuffer AS SINGLE PTR) AS LONG
#ELSE
DECLARE FUNCTION GetCharWidthFloatW LIB "gdi32.dll" ALIAS "GetCharWidthFloatW" ( BYVAL hdc AS QUAD , BYVAL iFirst AS QUAD , BYVAL iLast AS QUAD , BYREF lpBuffer AS SINGLE ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO GetCharWidthFloat = GetCharWidthFloatW
#ELSE
 MACRO GetCharWidthFloat = GetCharWidthFloatW
#ENDIF
DECLARE FUNCTION GetCharABCWidthsA LIB "gdi32.dll" ALIAS "GetCharABCWidthsA" ( BYVAL hdc AS QUAD , BYVAL wFirst AS QUAD , BYVAL wLast AS QUAD , BYREF lpABC AS ABC ) AS LONG
DECLARE FUNCTION GetCharABCWidthsW LIB "gdi32.dll" ALIAS "GetCharABCWidthsW" ( BYVAL hdc AS QUAD
 , BYVAL wFirst AS DWORD
 , BYVAL wLast AS DWORD
 , BYREF lpABC AS ABC
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetCharABCWidths = GetCharABCWidthsW
#ELSE
 MACRO GetCharABCWidths = GetCharABCWidthsA
#ENDIF
DECLARE FUNCTION GetCharABCWidthsFloatA LIB "gdi32.dll" ALIAS "GetCharABCWidthsFloatA" ( BYVAL hdc AS QUAD , BYVAL iFirst AS QUAD , BYVAL iLast AS QUAD , BYREF lpABC AS ABCFLOAT ) AS LONG
DECLARE FUNCTION GetCharABCWidthsFloatW LIB "gdi32.dll" ALIAS "GetCharABCWidthsFloatW" ( BYVAL hdc AS QUAD
 , BYVAL iFirst AS DWORD
 , BYVAL iLast AS DWORD
 , BYREF lpABC AS ABCFLOAT
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetCharABCWidthsFloat = GetCharABCWidthsFloatW
#ELSE
 MACRO GetCharABCWidthsFloat = GetCharABCWidthsFloatW
#ENDIF
DECLARE FUNCTION GetClipBox LIB "gdi32.dll" ALIAS "GetClipBox" ( BYVAL hdc AS QUAD , BYREF lprect AS RECT ) AS LONG ' int
DECLARE FUNCTION GetClipRgn LIB "gdi32.dll" ALIAS "GetClipRgn" ( BYVAL hdc AS QUAD , BYVAL hrgn AS QUAD ) AS LONG ' int
DECLARE FUNCTION GetMetaRgn LIB "gdi32.dll" ALIAS "GetMetaRgn" ( BYVAL hdc AS QUAD , BYVAL hrgn AS QUAD ) AS LONG ' int
DECLARE FUNCTION GetCurrentObject LIB "gdi32.dll" ALIAS "GetCurrentObject" ( BYVAL hdc AS QUAD , BYVAL type AS QUAD ) AS QUAD ' HGDIOBJ
DECLARE FUNCTION GetCurrentPositionEx LIB "gdi32.dll" ALIAS "GetCurrentPositionEx" ( BYVAL hdc AS QUAD , BYREF lppt AS POINT ) AS LONG
DECLARE FUNCTION GetDeviceCaps LIB "gdi32.dll" ALIAS "GetDeviceCaps" ( BYVAL hdc AS QUAD
 , BYVAL index AS LONG
 ) AS LONG ' int
DECLARE FUNCTION GetDIBits LIB "gdi32.dll" ALIAS "GetDIBits" ( BYVAL hdc AS QUAD , BYVAL hbm AS QUAD , BYVAL start AS QUAD , BYVAL cLines AS QUAD , BYREF lpvBits AS ANY , BYREF lpbmi AS BITMAPINFO , BYVAL usage AS QUAD ) AS LONG ' int
DECLARE FUNCTION GetFontData LIB "gdi32.dll" ALIAS "GetFontData" ( BYVAL hdc AS QUAD , BYVAL dwTable AS QUAD , BYVAL dwOffset AS QUAD , BYREF pvBuffer AS ANY , BYVAL cjBuffer AS QUAD ) AS QUAD
DECLARE FUNCTION GetGlyphOutlineA LIB "gdi32.dll" ALIAS "GetGlyphOutlineA" ( BYVAL hdc AS QUAD
 , BYVAL uChar AS DWORD
 , BYVAL fuFormat AS DWORD
 , BYREF lpgm AS GLYPHMETRICS
 , BYVAL cjBuffer AS DWORD
 , BYREF pvBuffer AS ANY
 , BYREF lpmat2 AS MAT2
 ) AS DWORD
DECLARE FUNCTION GetGlyphOutlineW LIB "gdi32.dll" ALIAS "GetGlyphOutlineW" ( BYVAL hdc AS DWORD
 , BYVAL uChar AS DWORD
 , BYVAL fuFormat AS DWORD
 , BYREF lpgm AS GLYPHMETRICS
 , BYVAL cjBuffer AS DWORD
 , BYREF pvBuffer AS ANY
 , BYREF lpmat2 AS MAT2
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO GetGlyphOutline = GetGlyphOutlineW
#ELSE
 MACRO GetGlyphOutline = GetGlyphOutlineA
#ENDIF
DECLARE FUNCTION GetGraphicsMode LIB "gdi32.dll" ALIAS "GetGraphicsMode" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION GetMapMode LIB "gdi32.dll" ALIAS "GetMapMode" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION GetMetaFileBitsEx LIB "gdi32.dll" ALIAS "GetMetaFileBitsEx" ( BYVAL hmf AS QUAD , BYVAL cbBuffer AS QUAD , BYREF lpData AS ANY ) AS QUAD ' UINT
DECLARE FUNCTION GetMetaFileA LIB "gdi32.dll" ALIAS "GetMetaFileA" ( BYREF lpName AS ASCIIZ ) AS QUAD ' HMETAFILE
DECLARE FUNCTION GetMetaFileW LIB "gdi32.dll" ALIAS "GetMetaFileW" ( BYREF lpName AS WSTRINGZ ) AS QUAD ' HMETAFILE
#IF %DEF(%UNICODE)
 MACRO GetMetaFile = GetMetaFileW
#ELSE
 MACRO GetMetaFile = GetMetaFileA
#ENDIF
DECLARE FUNCTION GetNearestColor LIB "gdi32.dll" ALIAS "GetNearestColor" ( BYVAL hdc AS QUAD , BYVAL color AS QUAD ) AS QUAD ' COLORREF
DECLARE FUNCTION GetNearestPaletteIndex LIB "gdi32.dll" ALIAS "GetNearestPaletteIndex" ( BYVAL h AS QUAD , BYVAL color AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION GetObjectType LIB "gdi32.dll" ALIAS "GetObjectType" ( BYVAL h AS QUAD ) AS QUAD
#IF NOT %DEF(%NOTEXTMETRIC) ' -------------------------------------------------
'#ifndef NOTEXTMETRIC
DECLARE FUNCTION GetOutlineTextMetricsA LIB "gdi32.dll" ALIAS "GetOutlineTextMetricsA" ( BYVAL hdc AS QUAD , BYVAL cjCopy AS QUAD , BYREF potm AS OUTLINETEXTMETRICA ) AS QUAD ' UINT
DECLARE FUNCTION GetOutlineTextMetricsW LIB "gdi32.dll" ALIAS "GetOutlineTextMetricsW" ( BYVAL hdc AS QUAD , BYVAL cjCopy AS QUAD , BYREF potm AS OUTLINETEXTMETRICW ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO GetOutlineTextMetrics = GetOutlineTextMetricsW
#ELSE
 MACRO GetOutlineTextMetrics = GetOutlineTextMetricsA
#ENDIF
'#endif /* NOTEXTMETRIC */
#ENDIF ' #IF NOT %DEF(%NOTEXTMETRIC) ----------------------------------------
DECLARE FUNCTION GetPaletteEntries LIB "gdi32.dll" ALIAS "GetPaletteEntries" ( BYVAL hPal AS QUAD , BYVAL iStart AS QUAD , BYVAL cEntries AS QUAD , BYREF pPalEntries AS PALETTEENTRY ) AS QUAD ' UINT
DECLARE FUNCTION GetPixel LIB "gdi32.dll" ALIAS "GetPixel" ( BYVAL hdc AS QUAD , BYVAL x AS LONG , BYVAL y AS LONG ) AS QUAD ' COLORREF
DECLARE FUNCTION GetPixelFormat LIB "gdi32.dll" ALIAS "GetPixelFormat" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION GetPolyFillMode LIB "gdi32.dll" ALIAS "GetPolyFillMode" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION GetRasterizerCaps LIB "gdi32.dll" ALIAS "GetRasterizerCaps" ( BYREF lpraststat AS RASTERIZER_STATUS , BYVAL cjBytes AS QUAD ) AS LONG
DECLARE FUNCTION GetRandomRgn LIB "gdi32.dll" ALIAS "GetRandomRgn" ( BYVAL hdc AS QUAD
 , BYVAL hrgn AS DWORD
 , BYVAL i AS LONG
 ) AS LONG ' int
DECLARE FUNCTION GetRegionData LIB "gdi32.dll" ALIAS "GetRegionData" ( BYVAL hrgn AS QUAD , BYVAL nCount AS QUAD , BYREF lpRgnData AS RGNDATA ) AS QUAD
DECLARE FUNCTION GetRgnBox LIB "gdi32.dll" ALIAS "GetRgnBox" ( BYVAL hrgn AS QUAD
 , BYREF lprc AS RECT
 ) AS LONG ' int
DECLARE FUNCTION GetStockObject LIB "gdi32.dll" ALIAS "GetStockObject" ( BYVAL i AS LONG ) AS QUAD ' HGDIOBJ
DECLARE FUNCTION GetStretchBltMode LIB "gdi32.dll" ALIAS "GetStretchBltMode" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION GetSystemPaletteEntries LIB "gdi32.dll" ALIAS "GetSystemPaletteEntries" ( BYVAL hdc AS QUAD , BYVAL iStart AS QUAD , BYVAL cEntries AS QUAD , BYREF pPalEntries AS PALETTEENTRY ) AS QUAD ' UINT
DECLARE FUNCTION GetSystemPaletteUse LIB "gdi32.dll" ALIAS "GetSystemPaletteUse" ( BYVAL hdc AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION GetTextCharacterExtra LIB "gdi32.dll" ALIAS "GetTextCharacterExtra" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION GetTextAlign LIB "gdi32.dll" ALIAS "GetTextAlign" ( BYVAL hdc AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION GetTextColor LIB "gdi32.dll" ALIAS "GetTextColor" ( BYVAL hdc AS QUAD ) AS QUAD ' COLORREF
DECLARE FUNCTION GetTextExtentPointA LIB "gdi32.dll" ALIAS "GetTextExtentPointA" ( BYVAL hdc AS QUAD , BYREF lpString AS ASCIIZ , BYVAL c AS LONG , BYREF lpsz AS SIZE ) AS LONG
DECLARE FUNCTION GetTextExtentPointW LIB "gdi32.dll" ALIAS "GetTextExtentPointW" ( BYVAL hdc AS QUAD
 , BYREF lpString AS WSTRINGZ
 , BYVAL c AS LONG
 , BYREF lpsz AS SIZE
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetTextExtentPoint = GetTextExtentPointW
#ELSE
 MACRO GetTextExtentPoint = GetTextExtentPointA
#ENDIF
DECLARE FUNCTION GetTextExtentPoint32A LIB "gdi32.dll" ALIAS "GetTextExtentPoint32A" ( BYVAL hdc AS QUAD , BYREF lpString AS ASCIIZ , BYVAL c AS LONG , BYREF psizl AS SIZE ) AS LONG
DECLARE FUNCTION GetTextExtentPoint32W LIB "gdi32.dll" ALIAS "GetTextExtentPoint32W" ( BYVAL hdc AS QUAD
 , BYREF lpString AS WSTRINGZ
 , BYVAL c AS LONG
 , BYREF psizl AS SIZE
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetTextExtentPoint32 = GetTextExtentPoint32W
#ELSE
 MACRO GetTextExtentPoint32 = GetTextExtentPoint32A
#ENDIF
DECLARE FUNCTION GetTextExtentExPointA LIB "gdi32.dll" ALIAS "GetTextExtentExPointA" ( BYVAL hdc AS QUAD , BYREF lpszString AS ASCIIZ , BYVAL cchString AS LONG , BYVAL nMaxExtent AS LONG , BYREF lpnFit AS LONG , BYREF lpnDx AS LONG , BYREF lpSize AS SIZE ) AS LONG
DECLARE FUNCTION GetTextExtentExPointW LIB "gdi32.dll" ALIAS "GetTextExtentExPointW" ( BYVAL hdc AS QUAD
 , BYREF lpszString AS WSTRINGZ
 , BYVAL cchString AS LONG
 , BYVAL nMaxExtent AS LONG
 , BYREF lpnFit AS LONG
 , BYREF lpnDx AS LONG
 , BYREF lpSize AS SIZE
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetTextExtentExPoint = GetTextExtentExPointW
#ELSE
 MACRO GetTextExtentExPoint = GetTextExtentExPointA
#ENDIF
'#if(WINVER >= 0x0400)
DECLARE FUNCTION GetTextCharset LIB "gdi32.dll" ALIAS "GetTextCharset" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION GetTextCharsetInfo LIB "gdi32.dll" ALIAS "GetTextCharsetInfo" ( BYVAL hdc AS QUAD , BYREF lpSig AS FONTSIGNATURE , BYVAL dwFlags AS QUAD ) AS LONG ' int
DECLARE FUNCTION TranslateCharsetInfo LIB "gdi32.dll" ALIAS "TranslateCharsetInfo" ( BYREF lpSrc AS QUAD , BYREF lpCs AS CHARSETINFO , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION GetFontLanguageInfo LIB "gdi32.dll" ALIAS "GetFontLanguageInfo" ( BYVAL hdc AS QUAD
 ) AS DWORD
DECLARE FUNCTION GetCharacterPlacementA LIB "gdi32.dll" ALIAS "GetCharacterPlacementA" ( BYVAL hdc AS DWORD
 , BYREF lpString AS ASCIIZ
 , BYVAL nCount AS LONG
 , BYVAL nMexExtent AS LONG
 , BYREF lpResults AS GCP_RESULTSA
 , BYVAL dwFlags AS DWORD
 ) AS DWORD
DECLARE FUNCTION GetCharacterPlacementW LIB "gdi32.dll" ALIAS "GetCharacterPlacementW" ( BYVAL hdc AS DWORD
 , BYREF lpString AS WSTRINGZ
 , BYVAL nCount AS LONG
 , BYVAL nMexExtent AS LONG
 , BYREF lpResults AS GCP_RESULTSW
 , BYVAL dwFlags AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO GetCharacterPlacement = GetCharacterPlacementW
#ELSE
 MACRO GetCharacterPlacement = GetCharacterPlacementA
#ENDIF
'#if (_WIN32_WINNT >= 0x0500)
' // Size = 4 bytes
TYPE WCRANGE WORD
 wcLow AS WORD ' WCHAR
 cGlyphs AS WORD ' USHORT
END TYPE
' // Size = 20 bytes
TYPE GLYPHSET DWORD
 cbThis AS DWORD
 flAccel AS DWORD
 cGlyphsSupported AS DWORD
 cRanges AS DWORD
 ranges(0) AS WCRANGE ' WCRANGE ranges[1]
END TYPE
'/* flAccel flags for the GLYPHSET structure above */
%EQUATE `GS_8BIT_INDICES = &H00000001
'/* flags for GetGlyphIndices */
%EQUATE `GGI_MARK_NONEXISTING_GLYPHS = &H0001
DECLARE FUNCTION GetFontUnicodeRanges LIB "gdi32.dll" ALIAS "GetFontUnicodeRanges" ( BYVAL hdc AS QUAD , OPTIONAL BYREF lpgs AS ANY ) AS QUAD
DECLARE FUNCTION GetGlyphIndicesA LIB "gdi32.dll" ALIAS "GetGlyphIndicesA" ( BYVAL hdc AS QUAD
 , BYREF lpstr AS ASCIIZ
 , BYVAL c AS LONG
 , BYREF pgi AS WORD
 , BYVAL fl AS DWORD
 ) AS DWORD
DECLARE FUNCTION GetGlyphIndicesW LIB "gdi32.dll" ALIAS "GetGlyphIndicesW" ( BYVAL hdc AS DWORD
 , BYREF lpstr AS WSTRINGZ
 , BYVAL c AS LONG
 , BYREF pgi AS WORD
 , BYVAL fl AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO GetGlyphIndices = GetGlyphIndicesW
#ELSE
 MACRO GetGlyphIndices = GetGlyphIndicesA
#ENDIF
DECLARE FUNCTION GetTextExtentPointI LIB "gdi32.dll" ALIAS "GetTextExtentPointI" ( BYVAL hdc AS QUAD , BYREF pgiIn AS WORD , BYVAL cgi AS LONG , BYREF psize AS SIZEL ) AS LONG
DECLARE FUNCTION GetTextExtentExPointI LIB "gdi32.dll" ALIAS "GetTextExtentExPointI" ( BYVAL hdc AS QUAD
 , BYREF pgiIn AS WORD
 , BYVAL cgi AS LONG
 , BYVAL nMaxExtent AS LONG
 , BYREF lpnFit AS LONG
 , BYREF lpnDx AS LONG
 , BYREF lpSize AS SIZE
 ) AS LONG
DECLARE FUNCTION GetCharWidthI LIB "gdi32.dll" ALIAS "GetCharWidthI" ( BYVAL hdc AS DWORD
 , BYVAL giFirst AS DWORD
 , BYVAL cgi AS DWORD
 , BYREF pgi AS WORD
 , BYREF piWidths AS LONG
 ) AS LONG
DECLARE FUNCTION GetCharABCWidthsI LIB "gdi32.dll" ALIAS "GetCharABCWidthsI" ( BYVAL hdc AS DWORD
 , BYVAL giFirst AS DWORD
 , BYVAL cgi AS DWORD
 , BYREF pgi AS WORD
 , BYREF pabc AS ABC
 ) AS LONG
'#define STAMP_DESIGNVECTOR (0x8000000 + 'd' + ('v' << 8))
'#define STAMP_AXESLIST (0x8000000 + 'a' + ('l' << 8))
'#define MM_MAX_NUMAXES 16
%EQUATE `STAMP_DESIGNVECTOR = &H08007664 ' (0x8000000 + 'd' + ('v' << 8))
%EQUATE `STAMP_AXESLIST = &H08006C61 ' (0x8000000 + 'a' + ('l' << 8))
%EQUATE `MM_MAX_NUMAXES = 16
' // Size = 72 bytes
TYPE DESIGNVECTOR DWORD
 dvReserved AS DWORD
 dvNumAxes AS DWORD
 dvValues(%MM_MAX_NUMAXES - 1) AS LONG ' LONG dvValues[MM_MAX_NUMAXES]
END TYPE
DECLARE FUNCTION AddFontResourceExA LIB "gdi32.dll" ALIAS "AddFontResourceExA" ( BYREF name AS ASCIIZ , BYVAL fl AS QUAD , BYVAL res AS QUAD ) AS LONG ' int
DECLARE FUNCTION AddFontResourceExW LIB "gdi32.dll" ALIAS "AddFontResourceExW" ( BYREF name AS WSTRINGZ , BYVAL fl AS QUAD , BYVAL res AS QUAD ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO AddFontResourceEx = AddFontResourceExW
#ELSE
 MACRO AddFontResourceEx = AddFontResourceExA
#ENDIF
DECLARE FUNCTION RemoveFontResourceExA LIB "gdi32.dll" ALIAS "RemoveFontResourceExA" ( BYREF name AS ASCIIZ , BYVAL fl AS QUAD , BYVAL pdv AS QUAD ) AS LONG
DECLARE FUNCTION RemoveFontResourceExW LIB "gdi32.dll" ALIAS "RemoveFontResourceExW" ( BYREF name AS WSTRINGZ
 , BYVAL fl AS DWORD
 , BYVAL pdv AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO RemoveFontResourceEx = RemoveFontResourceExW
#ELSE
 MACRO RemoveFontResourceEx = RemoveFontResourceExA
#ENDIF
DECLARE FUNCTION AddFontMemResourceEx LIB "gdi32.dll" ALIAS "AddFontMemResourceEx" ( BYVAL pFileView AS QUAD , BYVAL cjSize AS QUAD , BYVAL pvResrved AS QUAD , BYREF pNumFonts AS QUAD ) AS QUAD
DECLARE FUNCTION RemoveFontMemResourceEx LIB "gdi32.dll" ALIAS "RemoveFontMemResourceEx" ( BYVAL h AS QUAD
 ) AS LONG
%EQUATE `FR_PRIVATE = &H10
%EQUATE `FR_NOT_ENUM = &H20
'// The actual size of the DESIGNVECTOR and ENUMLOGFONTEXDV structures
'// is determined by dvNumAxes,
'// MM_MAX_NUMAXES only detemines the maximal size allowed
%EQUATE `MM_MAX_AXES_NAMELEN = 16
' // Size = 24 bytes
TYPE AXISINFOA DWORD
 axMinValue AS LONG
 axMaxValue AS LONG
 axAxisName AS STRING * %MM_MAX_AXES_NAMELEN ' BYTE axAxisName[MM_MAX_AXES_NAMELEN]
END TYPE
' // Size = 40 bytes
TYPE AXISINFOW DWORD
 axMinValue AS LONG
 axMaxValue AS LONG
 axAxisName AS WSTRING * %MM_MAX_AXES_NAMELEN ' WCHAR axAxisName[MM_MAX_AXES_NAMELEN]
END TYPE
#IF %DEF(%UNICODE)
 MACRO AXISINFO = AXISINFOW
#ELSE
 MACRO AXISINFO = AXISINFOA
#ENDIF
' // Size = 392 bytes
TYPE AXESLISTA DWORD
 axlReserved AS DWORD
 axlNumAxes AS DWORD
 axlAxisInfo (%MM_MAX_NUMAXES - 1) AS AXISINFOA ' AXISINFOA axlAxisInfo[MM_MAX_NUMAXES]
END TYPE
' // Size = 648 bytes
TYPE AXESLISTW DWORD
 axlReserved AS DWORD
 axlNumAxes AS DWORD
 axlAxisInfo (%MM_MAX_NUMAXES - 1) AS AXISINFOW ' AXISINFOW axlAxisInfo[MM_MAX_NUMAXES]
END TYPE
#IF %DEF(%UNICODE)
 MACRO AXESLIST = AXESLISTW
#ELSE
 MACRO AXESLIST = AXESLISTA
#ENDIF
'// The actual size of the AXESLIST and ENUMTEXTMETRIC structure is
'// determined by axlNumAxes,
'// MM_MAX_NUMAXES only detemines the maximal size allowed
' // Size = 260 bytes
TYPE ENUMLOGFONTEXDVA DWORD
 elfEnumLogfontEx AS ENUMLOGFONTEX
 elfDesignVector AS DESIGNVECTOR
END TYPE
' // Size = 420 bytes
TYPE ENUMLOGFONTEXDVW DWORD
 elfEnumLogfontEx AS ENUMLOGFONTEXW
 elfDesignVector AS DESIGNVECTOR
END TYPE
#IF %DEF(%UNICODE)
 MACRO ENUMLOGFONTEXDV = ENUMLOGFONTEXDVW
#ELSE
 MACRO ENUMLOGFONTEXDV = ENUMLOGFONTEXDVA
#ENDIF
DECLARE FUNCTION CreateFontIndirectExA LIB "gdi32.dll" ALIAS "CreateFontIndirectExA" ( BYREF penumlfex AS ENUMLOGFONTEXDVA ) AS QUAD ' HFONT
DECLARE FUNCTION CreateFontIndirectExW LIB "gdi32.dll" ALIAS "CreateFontIndirectExW" ( BYREF penumlfex AS ENUMLOGFONTEXDVW ) AS QUAD ' HFONT
#IF %DEF(%UNICODE)
 MACRO CreateFontIndirectEx = CreateFontIndirectExW
#ELSE
 MACRO CreateFontIndirectEx = CreateFontIndirectExW
#ENDIF
#IF NOT %DEF(%NOTEXTMETRIC) ' -------------------------------------------------
'#ifndef NOTEXTMETRIC
' // Size = 488 bytes
TYPE ENUMTEXTMETRICA DWORD
 etmNewTextMetricEx AS NEWTEXTMETRICEX
 etmAxesList AS AXESLIST
END TYPE
' // Size = 748 bytes
TYPE ENUMTEXTMETRICW DWORD
 etmNewTextMetricEx AS NEWTEXTMETRICEXW
 etmAxesList AS AXESLISTW
END TYPE
#IF %DEF(%UNICODE)
 MACRO ENUMTEXTMETRIC = ENUMTEXTMETRICW
#ELSE
 MACRO ENUMTEXTMETRIC = ENUMTEXTMETRICA
#ENDIF
'#endif /* NOTEXTMETRIC */
#ENDIF ' #IF NOT %DEF(%NOTEXTMETRIC) ----------------------------------------
'#endif // (_WIN32_WINNT >= 0x0500)
DECLARE FUNCTION GetViewportExtEx LIB "gdi32.dll" ALIAS "GetViewportExtEx" ( BYVAL hdc AS QUAD , BYREF lpsize AS SIZE ) AS LONG
DECLARE FUNCTION GetViewportOrgEx LIB "gdi32.dll" ALIAS "GetViewportOrgEx" ( BYVAL hdc AS QUAD
 , BYREF lppoint AS POINT
 ) AS LONG
DECLARE FUNCTION GetWindowExtEx LIB "gdi32.dll" ALIAS "GetWindowExtEx" ( BYVAL hdc AS DWORD
 , BYREF lpsize AS SIZE
 ) AS LONG
DECLARE FUNCTION GetWindowOrgEx LIB "gdi32.dll" ALIAS "GetWindowOrgEx" ( BYVAL hdc AS DWORD
 , BYREF lppoint AS POINT
 ) AS LONG
DECLARE FUNCTION IntersectClipRect LIB "gdi32.dll" ALIAS "IntersectClipRect" ( BYVAL hdc AS DWORD
 , BYVAL left AS LONG
 , BYVAL top AS LONG
 , BYVAL right AS LONG
 , BYVAL bottom AS LONG
 ) AS LONG ' int
DECLARE FUNCTION InvertRgn LIB "gdi32.dll" ALIAS "InvertRgn" ( BYVAL hdc AS QUAD , BYVAL hrgn AS QUAD ) AS LONG
DECLARE FUNCTION LineDDA LIB "gdi32.dll" ALIAS "LineDDA" ( BYVAL xStart AS LONG
 , BYVAL yStart AS LONG
 , BYVAL xEnd AS LONG
 , BYVAL yEnd AS LONG
 , BYVAL lpProc AS DWORD
 , OPTIONAL BYVAL data AS LONG
 ) AS LONG
DECLARE FUNCTION LineTo LIB "gdi32.dll" ALIAS "LineTo" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 ) AS LONG
DECLARE FUNCTION MaskBlt LIB "gdi32.dll" ALIAS "MaskBlt" ( BYVAL hdc AS DWORD
 , BYVAL xDest AS LONG
 , BYVAL yDest AS LONG
 , BYVAL width AS LONG
 , BYVAL height AS LONG
 , BYVAL hdcSrc AS DWORD
 , BYVAL xSrc AS LONG
 , BYVAL ySrc AS LONG
 , BYVAL hbmMask AS DWORD
 , BYVAL xMask AS LONG
 , BYVAL yMask AS LONG
 , BYVAL rop AS DWORD
 ) AS LONG
DECLARE FUNCTION PlgBlt LIB "gdi32.dll" ALIAS "PlgBlt" ( BYVAL hdc AS DWORD
 , BYREF lpPoint AS POINT
 , BYVAL hdcSrc AS DWORD
 , BYVAL xSrc AS LONG
 , BYVAL ySrc AS LONG
 , BYVAL width AS LONG
 , BYVAL height AS LONG
 , BYVAL hbmMask AS DWORD
 , BYVAL xMask AS LONG
 , BYVAL yMask AS LONG
 ) AS LONG
DECLARE FUNCTION OffsetClipRgn LIB "gdi32.dll" ALIAS "OffsetClipRgn" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 ) AS LONG ' int
DECLARE FUNCTION OffsetRgn LIB "gdi32.dll" ALIAS "OffsetRgn" ( BYVAL hrgn AS QUAD , BYVAL x AS LONG , BYVAL y AS LONG ) AS LONG ' int
DECLARE FUNCTION PatBlt LIB "gdi32.dll" ALIAS "PatBlt" ( BYVAL hdc AS QUAD , BYVAL x AS LONG , BYVAL y AS LONG , BYVAL w AS LONG , BYVAL h AS LONG , BYVAL rop AS QUAD ) AS LONG
DECLARE FUNCTION Pie LIB "gdi32.dll" ALIAS "Pie" ( BYVAL hdc AS QUAD
 , BYVAL left AS LONG
 , BYVAL top AS LONG
 , BYVAL right AS LONG
 , BYVAL bottom AS LONG
 , BYVAL xr1 AS LONG
 , BYVAL yr1 AS LONG
 , BYVAL xr2 AS LONG
 , BYVAL yr2 AS LONG
 ) AS LONG
DECLARE FUNCTION PlayMetaFile LIB "gdi32.dll" ALIAS "PlayMetaFile" ( BYVAL hdc AS DWORD
 , BYVAL hmf AS DWORD
 ) AS LONG
DECLARE FUNCTION PaintRgn LIB "gdi32.dll" ALIAS "PaintRgn" ( BYVAL hdc AS DWORD
 , BYVAL hrgn AS DWORD
 ) AS LONG
DECLARE FUNCTION PolyPolygon LIB "gdi32.dll" ALIAS "PolyPolygon" ( BYVAL hdc AS DWORD
 , BYREF apt AS POINT
 , BYREF asz AS LONG
 , BYVAL csz AS LONG
 ) AS LONG
DECLARE FUNCTION PtInRegion LIB "gdi32.dll" ALIAS "PtInRegion" ( BYVAL hrgn AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 ) AS LONG
DECLARE FUNCTION PtVisible LIB "gdi32.dll" ALIAS "PtVisible" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 ) AS LONG
DECLARE FUNCTION RectInRegion LIB "gdi32.dll" ALIAS "RectInRegion" ( BYVAL hrgn AS DWORD
 , BYREF lprect AS RECT
 ) AS LONG
DECLARE FUNCTION RectVisible LIB "gdi32.dll" ALIAS "RectVisible" ( BYVAL hdc AS DWORD
 , BYREF lprect AS RECT
 ) AS LONG
DECLARE FUNCTION Rectangle LIB "gdi32.dll" ALIAS "Rectangle" ( BYVAL hdc AS DWORD
 , BYVAL left AS LONG
 , BYVAL top AS LONG
 , BYVAL right AS LONG
 , BYVAL bottom AS LONG
 ) AS LONG
DECLARE FUNCTION RestoreDC LIB "gdi32.dll" ALIAS "RestoreDC" ( BYVAL hdc AS DWORD
 , BYVAL nSavedDC AS LONG
 ) AS LONG
DECLARE FUNCTION ResetDCA LIB "gdi32.dll" ALIAS "ResetDCA" ( BYVAL hdc AS DWORD
 , BYREF lpdm AS DEVMODEA
 ) AS DWORD ' HDC
DECLARE FUNCTION ResetDCW LIB "gdi32.dll" ALIAS "ResetDCW" ( BYVAL hdc AS QUAD , BYREF lpdm AS DEVMODEW ) AS QUAD ' HDC
#IF %DEF(%UNICODE)
 MACRO ResetDC = ResetDCW
#ELSE
 MACRO ResetDC = ResetDCA
#ENDIF
DECLARE FUNCTION RealizePalette LIB "gdi32.dll" ALIAS "RealizePalette" ( BYVAL hdc AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION RemoveFontResourceA LIB "gdi32.dll" ALIAS "RemoveFontResourceA" ( BYREF lpFileName AS ASCIIZ ) AS LONG
DECLARE FUNCTION RemoveFontResourceW LIB "gdi32.dll" ALIAS "RemoveFontResourceW" ( BYREF lpFileName AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO RemoveFontResource = RemoveFontResourceW
#ELSE
 MACRO RemoveFontResource = RemoveFontResourceA
#ENDIF
DECLARE FUNCTION RoundRect LIB "gdi32.dll" ALIAS "RoundRect" ( BYVAL hdc AS QUAD , BYVAL left AS LONG , BYVAL top AS LONG , BYVAL right AS LONG , BYVAL bottom AS LONG , BYVAL width AS LONG , BYVAL height AS LONG ) AS LONG
DECLARE FUNCTION ResizePalette LIB "gdi32.dll" ALIAS "ResizePalette" ( BYVAL hPal AS QUAD
 , BYVAL n AS DWORD
 ) AS LONG
DECLARE FUNCTION SaveDC LIB "gdi32.dll" ALIAS "SaveDC" ( BYVAL hdc AS DWORD
 ) AS LONG ' int
DECLARE FUNCTION SelectClipRgn LIB "gdi32.dll" ALIAS "SelectClipRgn" ( BYVAL hdc AS QUAD , OPTIONAL BYVAL hrgn AS QUAD ) AS LONG ' int
DECLARE FUNCTION ExtSelectClipRgn LIB "gdi32.dll" ALIAS "ExtSelectClipRgn" ( BYVAL hdc AS QUAD , BYVAL hrgn AS QUAD , BYVAL mode AS LONG ) AS LONG ' int
DECLARE FUNCTION SetMetaRgn LIB "gdi32.dll" ALIAS "SetMetaRgn" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION SelectObject LIB "gdi32.dll" ALIAS "SelectObject" ( BYVAL hdc AS QUAD , BYVAL h AS QUAD ) AS QUAD ' HGDIOBJ
DECLARE FUNCTION SelectPalette LIB "gdi32.dll" ALIAS "SelectPalette" ( BYVAL hdc AS QUAD , BYVAL hPal AS QUAD , BYVAL bForceBkgd AS LONG ) AS QUAD ' HPALETTE
DECLARE FUNCTION SetBkColor LIB "gdi32.dll" ALIAS "SetBkColor" ( BYVAL hdc AS QUAD , BYVAL color AS QUAD ) AS QUAD ' COLORREF
'#if (_WIN32_WINNT >= 0x0500)
DECLARE FUNCTION SetDCBrushColor LIB "gdi32.dll" ALIAS "SetDCBrushColor" ( BYVAL hdc AS QUAD , BYVAL color AS QUAD ) AS QUAD ' COLORREF
DECLARE FUNCTION SetDCPenColor LIB "gdi32.dll" ALIAS "SetDCPenColor" ( BYVAL hdc AS QUAD , BYVAL color AS QUAD ) AS QUAD ' COLORREF
'#endif
DECLARE FUNCTION SetBkMode LIB "gdi32.dll" ALIAS "SetBkMode" ( BYVAL hdc AS QUAD , BYVAL mode AS LONG ) AS LONG ' int
DECLARE FUNCTION SetBitmapBits LIB "gdi32.dll" ALIAS "SetBitmapBits" ( BYVAL hbm AS QUAD , BYVAL cb AS QUAD , BYREF pvBits AS ANY ) AS LONG
DECLARE FUNCTION SetBoundsRect LIB "gdi32.dll" ALIAS "SetBoundsRect" ( BYVAL hdc AS QUAD
 , BYREF lprect AS RECT
 , BYVAL flags AS DWORD
 ) AS DWORD ' UINT
DECLARE FUNCTION SetDIBits LIB "gdi32.dll" ALIAS "SetDIBits" ( BYVAL hdc AS QUAD , BYVAL hbm AS QUAD , BYVAL start AS QUAD , BYVAL cLines AS QUAD , BYREF lpBits AS ANY , BYREF lpbmi AS BITMAPINFO , BYVAL ColorUse AS QUAD ) AS LONG ' int
DECLARE FUNCTION SetDIBitsToDevice LIB "gdi32.dll" ALIAS "SetDIBitsToDevice" ( BYVAL hdc AS QUAD , BYVAL xDest AS LONG , BYVAL yDest AS LONG , BYVAL w AS QUAD , BYVAL h AS QUAD , BYVAL xSrc AS LONG , BYVAL ySrc AS LONG , BYVAL StartScan AS QUAD , BYVAL cLines AS QUAD , BYREF lpvBits AS ANY , BYREF lpbmi AS BITMAPINFO , BYVAL ColorUse AS QUAD ) AS LONG ' int
DECLARE FUNCTION SetMapperFlags LIB "gdi32.dll" ALIAS "SetMapperFlags" ( BYVAL hdc AS QUAD , BYVAL flags AS QUAD ) AS QUAD
DECLARE FUNCTION SetGraphicsMode LIB "gdi32.dll" ALIAS "SetGraphicsMode" ( BYVAL hdc AS QUAD
 , BYVAL iMode AS LONG
 ) AS LONG ' int
DECLARE FUNCTION SetMapMode LIB "gdi32.dll" ALIAS "SetMapMode" ( BYVAL hdc AS QUAD , BYVAL iMode AS LONG ) AS LONG ' int
'#if(WINVER >= 0x0500)
DECLARE FUNCTION SetLayout LIB "gdi32.dll" ALIAS "SetLayout" ( BYVAL hdc AS QUAD , BYVAL l AS QUAD ) AS QUAD
DECLARE FUNCTION GetLayout LIB "gdi32.dll" ALIAS "GetLayout" ( BYVAL hdc AS QUAD
 ) AS DWORD
'#endif /* WINVER >= 0x0500 */
DECLARE FUNCTION SetMetaFileBitsEx LIB "gdi32.dll" ALIAS "SetMetaFileBitsEx" ( BYVAL cbBuffer AS QUAD , BYREF lpData AS BYTE ) AS QUAD ' HMETAFILE
DECLARE FUNCTION SetPaletteEntries LIB "gdi32.dll" ALIAS "SetPaletteEntries" ( BYVAL hPal AS QUAD , BYVAL iStart AS QUAD , BYVAL cEntries AS QUAD , BYREF pPalEntries AS PALETTEENTRY ) AS QUAD ' UINT
DECLARE FUNCTION SetPixel LIB "gdi32.dll" ALIAS "SetPixel" ( BYVAL hdc AS QUAD , BYVAL x AS LONG , BYVAL y AS LONG , BYVAL color AS QUAD ) AS QUAD ' COLORREF
DECLARE FUNCTION SetPixelV LIB "gdi32.dll" ALIAS "SetPixelV" ( BYVAL hdc AS QUAD , BYVAL x AS LONG , BYVAL y AS LONG , BYVAL color AS QUAD ) AS LONG
DECLARE FUNCTION SetPixelFormat LIB "gdi32.dll" ALIAS "SetPixelFormat" ( BYVAL hdc AS QUAD
 , BYVAL format AS LONG
 , BYREF ppfd AS PIXELFORMATDESCRIPTOR
 ) AS LONG
DECLARE FUNCTION SetPolyFillMode LIB "gdi32.dll" ALIAS "SetPolyFillMode" ( BYVAL hdc AS DWORD
 , BYVAL mode AS LONG
 ) AS LONG ' int
DECLARE FUNCTION StretchBlt LIB "gdi32.dll" ALIAS "StretchBlt" ( BYVAL hdc AS QUAD , BYVAL xDest AS LONG , BYVAL yDest AS LONG , BYVAL wDest AS LONG , BYVAL hDest AS LONG , BYVAL hdcSrc AS QUAD , BYVAL xSrc AS LONG , BYVAL ySrc AS LONG , BYVAL wSrc AS LONG , BYVAL hSrc AS LONG , BYVAL rop AS QUAD ) AS LONG
DECLARE FUNCTION SetRectRgn LIB "gdi32.dll" ALIAS "SetRectRgn" ( BYVAL hrgn AS QUAD
 , BYVAL left AS LONG
 , BYVAL top AS LONG
 , BYVAL right AS LONG
 , BYVAL bottom AS LONG
 ) AS LONG
DECLARE FUNCTION StretchDIBits LIB "gdi32.dll" ALIAS "StretchDIBits" ( BYVAL hdc AS DWORD
 , BYVAL xDest AS LONG
 , BYVAL yDest AS LONG
 , BYVAL DestWidth AS LONG
 , BYVAL DestHeight AS LONG
 , BYVAL xSrc AS LONG
 , BYVAL ySrc AS LONG
 , BYVAL SrcWidth AS LONG
 , BYVAL SrcHeight AS LONG
 , BYREF lpBits AS ANY
 , BYREF lpbmi AS BITMAPINFO
 , BYVAL iUsage AS DWORD
 , BYVAL rop AS DWORD
 ) AS LONG ' int
DECLARE FUNCTION SetROP2 LIB "gdi32.dll" ALIAS "SetROP2" ( BYVAL hdc AS QUAD , BYVAL rop2 AS LONG ) AS LONG ' int
DECLARE FUNCTION SetStretchBltMode LIB "gdi32.dll" ALIAS "SetStretchBltMode" ( BYVAL hdc AS QUAD , BYVAL mode AS LONG ) AS LONG ' int
DECLARE FUNCTION SetSystemPaletteUse LIB "gdi32.dll" ALIAS "SetSystemPaletteUse" ( BYVAL hdc AS QUAD , BYVAL use AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION SetTextCharacterExtra LIB "gdi32.dll" ALIAS "SetTextCharacterExtra" ( BYVAL hdc AS QUAD , BYVAL extra AS LONG ) AS LONG ' int
DECLARE FUNCTION SetTextColor LIB "gdi32.dll" ALIAS "SetTextColor" ( BYVAL hdc AS QUAD , BYVAL color AS QUAD ) AS QUAD ' COLORREF
DECLARE FUNCTION SetTextAlign LIB "gdi32.dll" ALIAS "SetTextAlign" ( BYVAL hdc AS QUAD , BYVAL align AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION SetTextJustification LIB "gdi32.dll" ALIAS "SetTextJustification" ( BYVAL hdc AS QUAD , BYVAL extra AS LONG , BYVAL count AS LONG ) AS LONG
DECLARE FUNCTION UpdateColors LIB "gdi32.dll" ALIAS "UpdateColors" ( BYVAL hdc AS QUAD
 ) AS LONG
'#if (WINVER >= 0x0400)
'#ifdef COMBOX_SANDBOX
'#if (_WIN32_WINNT >= 0x0600)
'typedef PVOID (WINAPI *GDIMARSHALLOC)(DWORD dwSize, __in LPVOID pGdiRef);
'typedef HRESULT (WINAPI *DDRAWMARSHCALLBACKMARSHAL)(__in HGDIOBJ hGdiObj, __in LPVOID pGdiRef, __out LPVOID *ppDDrawRef);
'typedef HRESULT (WINAPI *DDRAWMARSHCALLBACKUNMARSHAL)(__in LPVOID pData, __out HDC *phdc, __out LPVOID *ppDDrawRef);
'typedef HRESULT (WINAPI *DDRAWMARSHCALLBACKRELEASE)(__in LPVOID pDDrawRef);
%EQUATE `GDIREGISTERDDRAWPACKETVERSION = &H1
' // Size = 20 bytes
TYPE GDIREGISTERDDRAWPACKET DWORD
 dwSize AS DWORD
 dwVersion AS DWORD
 pfnDdMarshal AS DWORD ' DDRAWMARSHCALLBACKMARSHAL
 pfnDdUnmarshal AS DWORD ' DDRAWMARSHCALLBACKUNMARSHAL
 pfnDdRelease AS DWORD ' DDRAWMARSHCALLBACKRELEASE
END TYPE
'WINGDIAPI BOOL WINAPI GdiRegisterDdraw(__in PGDIREGISTERDDRAWPACKET pPacket, __out GDIMARSHALLOC *ppfnGdiAlloc);
'WINGDIAPI ULONG WINAPI GdiMarshalSize(VOID);
'WINGDIAPI VOID WINAPI GdiMarshal(DWORD dwProcessIdTo, __in HGDIOBJ hGdiObj, __in_out PVOID pData, ULONG ulFlags);
'WINGDIAPI HGDIOBJ WINAPI GdiUnmarshal(__in PVOID pData, ULONG ulFlags);
'#endif // (_WIN32_WINNT >= 0x0600)
'#endif // COMBOX_SANDBOX
'#if (WINVER >= 0x0400)
'//
'// image blt
'//
'typedef USHORT COLOR16;
' // Size = 16 bytes
TYPE TRIVERTEX WORD
 x AS LONG
 y AS LONG
 Red AS WORD ' COLOR16
 Green AS WORD ' COLOR16
 Blue AS WORD ' COLOR16
 Alpha AS WORD ' COLOR16
END TYPE
' // Size = 12 bytes
TYPE GRADIENT_TRIANGLE DWORD
 Vertex1 AS DWORD ' ULONG
 Vertex2 AS DWORD ' ULONG
 Vertex3 AS DWORD ' ULONG
END TYPE
' // Size = 8 bytes
TYPE GRADIENT_RECT DWORD
 UpperLeft AS DWORD ' ULONG
 LowerRight AS DWORD ' ULONG
END TYPE
' // Size = 4 bytes
TYPE BLENDFUNCTION BYTE
 BlendOp AS BYTE
 BlendFlags AS BYTE
 SourceConstantAlpha AS BYTE
 AlphaFormat AS BYTE
END TYPE
'//
'// currentlly defined blend function
'//
%EQUATE `AC_SRC_OVER = &H00
'//
'// alpha format flags
'//
%EQUATE `AC_SRC_ALPHA = &H01
' Note: The last parameter was declared as DWORD in old versions of PB's WIN32API.INC
' because earlier versions of PB couldn't pass an structure by value.
' This forced the use of CVDWD to convert the four byte structure into a DWORD.
DECLARE FUNCTION AlphaBlend LIB "msimg32.dll" ALIAS "AlphaBlend" ( BYVAL hdc AS QUAD , BYVAL xoriginDest AS LONG , BYVAL yoriginDest AS LONG , BYVAL wDest AS LONG , BYVAL hDest AS LONG , BYVAL hdcSrc AS QUAD , BYVAL xoriginSrc AS LONG , BYVAL yoriginSrc AS LONG , BYVAL wSrc AS LONG , BYVAL hSrc AS LONG , BYVAL ftn AS BLENDFUNCTION ) AS LONG
DECLARE FUNCTION TransparentBlt LIB "msimg32.dll" ALIAS "TransparentBlt" ( BYVAL hdc AS QUAD
 , BYVAL xoriginDest AS LONG
 , BYVAL yoriginDest AS LONG
 , BYVAL wDest AS LONG
 , BYVAL hDest AS LONG
 , BYVAL hdcSrc AS DWORD
 , BYVAL xoriginSrc AS LONG
 , BYVAL yoriginSrc AS LONG
 , BYVAL wSrc AS LONG
 , BYVAL hSrc AS LONG
 , BYVAL crTransparent AS DWORD
 ) AS LONG
'//
'// gradient drawing modes
'//
%EQUATE `GRADIENT_FILL_RECT_H = &H00000000
%EQUATE `GRADIENT_FILL_RECT_V = &H00000001
%EQUATE `GRADIENT_FILL_TRIANGLE = &H00000002
%EQUATE `GRADIENT_FILL_OP_FLAG = &H000000ff
DECLARE FUNCTION GradientFill LIB "msimg32.dll" ALIAS "GradientFill" ( BYVAL hdc AS QUAD , BYREF pVertex AS TRIVERTEX , BYVAL nVertex AS QUAD , BYREF pMesh AS ANY , BYVAL nMesh AS QUAD , BYVAL ulMode AS QUAD ) AS LONG
'#endif
'#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
'WINGDIAPI BOOL WINAPI GdiAlphaBlend(__in HDC hdcDest, __in int xoriginDest, __in int yoriginDest, __in int wDest, __in int hDest, __in HDC hdcSrc, __in int xoriginSrc, __in int yoriginSrc, __in int wSrc, __in int hSrc, __in BLENDFUNCTION ftn);
DECLARE FUNCTION GdiAlphaBlend LIB "gdi32.dll" ALIAS "GdiAlphaBlend" ( BYVAL hdc AS QUAD , BYVAL xoriginDest AS LONG , BYVAL yoriginDest AS LONG , BYVAL wDest AS LONG , BYVAL hDest AS LONG , BYVAL hdcSrc AS QUAD , BYVAL xoriginSrc AS LONG , BYVAL yoriginSrc AS LONG , BYVAL wSrc AS LONG , BYVAL hSrc AS LONG , BYVAL ftn AS BLENDFUNCTION ) AS LONG
'WINGDIAPI BOOL WINAPI GdiTransparentBlt(__in HDC hdcDest,__in int xoriginDest, __in int yoriginDest, __in int wDest, __in int hDest, __in HDC hdcSrc,
DECLARE FUNCTION GdiTransparentBlt LIB "gdi32.dll" ALIAS "GdiTransparentBlt" ( BYVAL hdc AS QUAD , BYVAL xoriginDest AS LONG , BYVAL yoriginDest AS LONG , BYVAL wDest AS LONG , BYVAL hDest AS LONG , BYVAL hdcSrc AS QUAD , BYVAL xoriginSrc AS LONG , BYVAL yoriginSrc AS LONG , BYVAL wSrc AS LONG , BYVAL hSrc AS LONG , BYVAL crTransparent AS QUAD ) AS LONG
'WINGDIAPI BOOL WINAPI GdiGradientFill( __in HDC hdc,
DECLARE FUNCTION GdiGradientFill LIB "gdi32.dll" ALIAS "GdiGradientFill" ( BYVAL hdc AS QUAD , BYREF pVertex AS TRIVERTEX , BYVAL nVertex AS QUAD , BYREF pMesh AS ANY , BYVAL nMesh AS QUAD , BYVAL ulMode AS QUAD ) AS LONG
'#endif
#IF NOT %DEF(%NOMETAFILE) ' ---------------------------------------------------
'#ifndef NOMETAFILE
DECLARE FUNCTION PlayMetaFileRecord LIB "gdi32.dll" ALIAS "PlayMetaFileRecord" ( BYVAL hdc AS QUAD , BYREF lpHandleTable AS HANDLETABLE , BYREF lpMR AS METARECORD , BYVAL noObjs AS QUAD ) AS LONG
'typedef int (CALLBACK* MFENUMPROC)( __in HDC hdc, __in_ecount(nObj) HANDLETABLE FAR* lpht, __in METARECORD FAR* lpMR, __in int nObj, __in_opt LPARAM param);
DECLARE FUNCTION EnumMetaFile LIB "gdi32.dll" ALIAS "EnumMetaFile" ( BYVAL hdc AS QUAD , BYVAL hmf AS QUAD , BYVAL proc AS QUAD , OPTIONAL BYVAL param AS LONG ) AS LONG
'typedef int (CALLBACK* ENHMFENUMPROC)(__in HDC hdc, __in_ecount(nHandles) HANDLETABLE FAR* lpht, __in CONST ENHMETARECORD * lpmr, __in int nHandles, __in_opt LPARAM data);
'// Enhanced Metafile Function Declarations
DECLARE FUNCTION CloseEnhMetaFile LIB "gdi32.dll" ALIAS "CloseEnhMetaFile" ( BYVAL hdc AS QUAD ) AS QUAD ' HENHMETAFILE
DECLARE FUNCTION CopyEnhMetaFileA LIB "gdi32.dll" ALIAS "CopyEnhMetaFileA" ( BYVAL hEnh AS QUAD , OPTIONAL BYREF lpFileName AS ASCIIZ ) AS QUAD ' HENHMETAFILE
DECLARE FUNCTION CopyEnhMetaFileW LIB "gdi32.dll" ALIAS "CopyEnhMetaFileW" ( BYVAL hEnh AS QUAD , OPTIONAL BYREF lpFileName AS WSTRINGZ ) AS QUAD ' HENHMETAFILE
#IF %DEF(%UNICODE)
 MACRO CopyEnhMetaFile = CopyEnhMetaFileW
#ELSE
 MACRO CopyEnhMetaFile = CopyEnhMetaFileA
#ENDIF
DECLARE FUNCTION CreateEnhMetaFileA LIB "gdi32.dll" ALIAS "CreateEnhMetaFileA" ( OPTIONAL BYVAL hdc AS QUAD , OPTIONAL BYREF lpFilename AS ASCIIZ , OPTIONAL BYREF lprc AS RECT , OPTIONAL BYREF lpDesc AS ASCIIZ ) AS QUAD ' HDC
DECLARE FUNCTION CreateEnhMetaFileW LIB "gdi32.dll" ALIAS "CreateEnhMetaFileW" ( OPTIONAL BYVAL hdc AS QUAD , OPTIONAL BYREF lpFilename AS WSTRINGZ , OPTIONAL BYREF lprc AS RECT , OPTIONAL BYREF lpDesc AS WSTRINGZ ) AS QUAD ' HDC
#IF %DEF(%UNICODE)
 MACRO CreateEnhMetaFile = CreateEnhMetaFileW
#ELSE
 MACRO CreateEnhMetaFile = CreateEnhMetaFileA
#ENDIF
DECLARE FUNCTION DeleteEnhMetaFile LIB "gdi32.dll" ALIAS "DeleteEnhMetaFile" ( BYVAL hmf AS QUAD ) AS LONG
DECLARE FUNCTION EnumEnhMetaFile LIB "gdi32.dll" ALIAS "EnumEnhMetaFile" ( BYVAL hdc AS QUAD
 , BYVAL hmf AS DWORD
 , BYVAL proc AS DWORD
 , OPTIONAL BYREF param AS ANY
 , OPTIONAL BYREF lpRect AS RECT
 ) AS LONG
DECLARE FUNCTION GetEnhMetaFileA LIB "gdi32.dll" ALIAS "GetEnhMetaFileA" ( BYREF lpName AS ASCIIZ
 ) AS DWORD ' HENHMETAFILE
DECLARE FUNCTION GetEnhMetaFileW LIB "gdi32.dll" ALIAS "GetEnhMetaFileW" ( BYREF lpName AS WSTRINGZ ) AS QUAD ' HENHMETAFILE
#IF %DEF(%UNICODE)
 MACRO GetEnhMetaFile = GetEnhMetaFileW
#ELSE
 MACRO GetEnhMetaFile = GetEnhMetaFileA
#ENDIF
DECLARE FUNCTION GetEnhMetaFileBits LIB "gdi32.dll" ALIAS "GetEnhMetaFileBits" ( BYVAL hEMF AS QUAD , BYVAL nSize AS QUAD , BYREF lpData AS BYTE ) AS QUAD ' UINT
DECLARE FUNCTION GetEnhMetaFileDescriptionA LIB "gdi32.dll" ALIAS "GetEnhMetaFileDescriptionA" ( BYVAL hemf AS QUAD , BYVAL cchBuffer AS QUAD , BYREF lpszDescription AS ASCIIZ ) AS QUAD ' UINT
DECLARE FUNCTION GetEnhMetaFileDescriptionW LIB "gdi32.dll" ALIAS "GetEnhMetaFileDescriptionW" ( BYVAL hemf AS QUAD , BYVAL cchBuffer AS QUAD , BYREF lpszDescription AS WSTRINGZ ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO GetEnhMetaFileDescription = GetEnhMetaFileDescriptionW
#ELSE
 MACRO GetEnhMetaFileDescription = GetEnhMetaFileDescriptionA
#ENDIF
DECLARE FUNCTION GetEnhMetaFileHeader LIB "gdi32.dll" ALIAS "GetEnhMetaFileHeader" ( BYVAL hemf AS QUAD , BYVAL nSize AS QUAD , BYREF lpEnhMetaHeader AS ENHMETAHEADER ) AS QUAD ' UINT
DECLARE FUNCTION GetEnhMetaFilePaletteEntries LIB "gdi32.dll" ALIAS "GetEnhMetaFilePaletteEntries" ( BYVAL hemf AS QUAD , BYVAL nNumEntries AS QUAD , BYREF lpPaletteEntries AS PALETTEENTRY ) AS QUAD ' UINT
DECLARE FUNCTION GetEnhMetaFilePixelFormat LIB "gdi32.dll" ALIAS "GetEnhMetaFilePixelFormat" ( BYVAL hemf AS QUAD , BYVAL cbBuffer AS QUAD , BYREF ppfd AS PIXELFORMATDESCRIPTOR ) AS QUAD ' UINT
DECLARE FUNCTION GetWinMetaFileBits LIB "gdi32.dll" ALIAS "GetWinMetaFileBits" ( BYVAL hemf AS QUAD , BYVAL cbData16 AS QUAD , BYREF pData16 AS BYTE , BYVAL iMapMode AS LONG , BYVAL hdcRef AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION PlayEnhMetaFile LIB "gdi32.dll" ALIAS "PlayEnhMetaFile" ( BYVAL hdc AS QUAD , BYVAL hmf AS QUAD , BYREF lprect AS RECT ) AS LONG
DECLARE FUNCTION PlayEnhMetaFileRecord LIB "gdi32.dll" ALIAS "PlayEnhMetaFileRecord" ( BYVAL hdc AS QUAD
 , BYREF pht AS HANDLETABLE
 , BYREF pmr AS ENHMETARECORD
 , BYVAL cht AS DWORD
 ) AS LONG
DECLARE FUNCTION SetEnhMetaFileBits LIB "gdi32.dll" ALIAS "SetEnhMetaFileBits" ( BYVAL nSize AS DWORD
 , BYREF pb AS BYTE
 ) AS DWORD ' HENHMETAFILE
DECLARE FUNCTION SetWinMetaFileBits LIB "gdi32.dll" ALIAS "SetWinMetaFileBits" ( BYVAL nSize AS QUAD , BYREF lpMeta16Data AS BYTE , OPTIONAL BYVAL hdcRef AS QUAD , OPTIONAL BYREF lpMFP AS METAFILEPICT ) AS QUAD ' HENHMETAFILE
DECLARE FUNCTION GdiComment LIB "gdi32.dll" ALIAS "GdiComment" ( BYVAL hdc AS QUAD , BYVAL nSize AS QUAD , BYVAL lpData AS BYTE PTR ) AS LONG
'#endif /* NOMETAFILE */
#ENDIF ' #IF NOT %DEF(%NOMETAFILE) ------------------------------------------
#IF NOT %DEF(%NOTEXTMETRIC) ' -------------------------------------------------
'#ifndef NOTEXTMETRIC
DECLARE FUNCTION GetTextMetricsA LIB "gdi32.dll" ALIAS "GetTextMetricsA" ( BYVAL hdc AS QUAD , BYREF lpMetrics AS TEXTMETRICA ) AS LONG
DECLARE FUNCTION GetTextMetricsW LIB "gdi32.dll" ALIAS "GetTextMetricsW" ( BYVAL hdc AS QUAD
 , BYREF lptm AS TEXTMETRICW
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetTextMetrics = GetTextMetricsW
#ELSE
 MACRO GetTextMetrics = GetTextMetricsA
#ENDIF
#ENDIF ' #IF NOT %DEF(%NOTEXTMETRIC) ' --------------------------------------
'/* new GDI */
' // Size = 84 bytes
TYPE DIBSECTION DWORD
 dsBm AS BITMAP
 dsBmih AS BITMAPINFOHEADER
 dsBitfields(2) AS DWORD ' DWORD dsBitfields[3]
 dshSection AS DWORD
 dsOffset AS DWORD
END TYPE
DECLARE FUNCTION AngleArc LIB "gdi32.dll" ALIAS "AngleArc" ( BYVAL hdc AS QUAD , BYVAL x AS LONG , BYVAL y AS LONG , BYVAL r AS QUAD , BYVAL StartAngle AS SINGLE , BYVAL SweepAngle AS SINGLE ) AS LONG
DECLARE FUNCTION PolyPolyline LIB "gdi32.dll" ALIAS "PolyPolyline" ( BYVAL hdc AS QUAD
 , BYREF apt AS POINT
 , BYREF asz AS DWORD
 , BYVAL csz AS DWORD
 ) AS LONG
DECLARE FUNCTION GetWorldTransform LIB "gdi32.dll" ALIAS "GetWorldTransform" ( BYVAL hdc AS DWORD
 , BYREF lpxf AS XFORM
 ) AS LONG
DECLARE FUNCTION SetWorldTransform LIB "gdi32.dll" ALIAS "SetWorldTransform" ( BYVAL hdc AS DWORD
 , BYREF lpxf AS XFORM
 ) AS LONG
DECLARE FUNCTION ModifyWorldTransform LIB "gdi32.dll" ALIAS "ModifyWorldTransform" ( BYVAL hdc AS DWORD
 , BYREF lpxf AS XFORM
 , BYVAL mode AS DWORD
 ) AS LONG
DECLARE FUNCTION CombineTransform LIB "gdi32.dll" ALIAS "CombineTransform" ( BYREF lpxfOut AS XFORM
 , BYREF lpxf1 AS XFORM
 , BYREF lpxf2 AS XFORM
 ) AS LONG
DECLARE FUNCTION CreateDIBSection LIB "gdi32.dll" ALIAS "CreateDIBSection" ( BYVAL hdc AS DWORD
 , BYREF lpbmi AS BITMAPINFO
 , BYVAL usage AS DWORD
 , BYVAL ppvBits AS DWORD
 , BYVAL hSection AS DWORD
 , BYVAL offset AS DWORD
 ) AS DWORD ' HBITMAP
DECLARE FUNCTION GetDIBColorTable LIB "gdi32.dll" ALIAS "GetDIBColorTable" ( BYVAL hdc AS QUAD , BYVAL iStart AS QUAD , BYVAL cEntries AS QUAD , BYREF prgbq AS RGBQUAD ) AS QUAD ' UINT
DECLARE FUNCTION SetDIBColorTable LIB "gdi32.dll" ALIAS "SetDIBColorTable" ( BYVAL hdc AS QUAD , BYVAL iStart AS QUAD , BYVAL cEntries AS QUAD , BYREF prgbq AS RGBQUAD ) AS QUAD ' UINT
'/* Flags value for COLORADJUSTMENT */
%EQUATE `CA_NEGATIVE = &H0001
%EQUATE `CA_LOG_FILTER = &H0002
'/* IlluminantIndex values */
%EQUATE `ILLUMINANT_DEVICE_DEFAULT = 0
%EQUATE `ILLUMINANT_A = 1
%EQUATE `ILLUMINANT_B = 2
%EQUATE `ILLUMINANT_C = 3
%EQUATE `ILLUMINANT_D50 = 4
%EQUATE `ILLUMINANT_D55 = 5
%EQUATE `ILLUMINANT_D65 = 6
%EQUATE `ILLUMINANT_D75 = 7
%EQUATE `ILLUMINANT_F2 = 8
%EQUATE `ILLUMINANT_MAX_INDEX = %ILLUMINANT_F2
%EQUATE `ILLUMINANT_TUNGSTEN = %ILLUMINANT_A
%EQUATE `ILLUMINANT_DAYLIGHT = %ILLUMINANT_C
%EQUATE `ILLUMINANT_FLUORESCENT = %ILLUMINANT_F2
%EQUATE `ILLUMINANT_NTSC = %ILLUMINANT_C
'/* Min and max for RedGamma, GreenGamma, BlueGamma */
'#define RGB_GAMMA_MIN (WORD)02500
'#define RGB_GAMMA_MAX (WORD)65000
%EQUATE `RGB_GAMMA_MIN = 2500
%EQUATE `RGB_GAMMA_MAX = 65000
'/* Min and max for ReferenceBlack and ReferenceWhite */
'#define REFERENCE_WHITE_MIN (WORD)6000
'#define REFERENCE_WHITE_MAX (WORD)10000
'#define REFERENCE_BLACK_MIN (WORD)0
'#define REFERENCE_BLACK_MAX (WORD)4000
%EQUATE `REFERENCE_WHITE_MIN = 6000
%EQUATE `REFERENCE_WHITE_MAX = 10000
%EQUATE `REFERENCE_BLACK_MIN = 0
%EQUATE `REFERENCE_BLACK_MAX = 4000
'/* Min and max for Contrast, Brightness, Colorfulness, RedGreenTint */
'#define COLOR_ADJ_MIN (SHORT)-100
'#define COLOR_ADJ_MAX (SHORT)100
%EQUATE `COLOR_ADJ_MIN = -100%
%EQUATE `COLOR_ADJ_MAX = 100%
' // Size = 24 bytes
TYPE COLORADJUSTMENT WORD
 caSize AS WORD
 caFlags AS WORD
 caIlluminantIndex AS WORD
 caRedGamma AS WORD
 caGreenGamma AS WORD
 caBlueGamma AS WORD
 caReferenceBlack AS WORD
 caReferenceWhite AS WORD
 caContrast AS INTEGER ' SHORT
 caBrightness AS INTEGER ' SHORT
 caColorfulness AS INTEGER ' SHORT
 caRedGreenTint AS INTEGER ' SHORT
END TYPE
DECLARE FUNCTION SetColorAdjustment LIB "gdi32.dll" ALIAS "SetColorAdjustment" ( BYVAL hdc AS QUAD , BYREF lpca AS COLORADJUSTMENT ) AS LONG
DECLARE FUNCTION GetColorAdjustment LIB "gdi32.dll" ALIAS "GetColorAdjustment" ( BYVAL hdc AS QUAD
 , BYREF lpca AS COLORADJUSTMENT
 ) AS LONG
DECLARE FUNCTION CreateHalftonePalette LIB "gdi32.dll" ALIAS "CreateHalftonePalette" ( BYVAL hdc AS DWORD
 ) AS DWORD ' HPALETTE
'#ifdef STRICT
'typedef BOOL (CALLBACK* ABORTPROC)( __in HDC, __in int);
'#else
'typedef FARPROC ABORTPROC;
'#endif
' // Size = 20 bytes
TYPE DOCINFOA DWORD
 cbSize AS LONG ' int
 lpszDocName AS ASCIIZ PTR
 lpszOutput AS ASCIIZ PTR
'#if (WINVER >= 0x0400)
 lpszDataType AS ASCIIZ PTR
 fwType AS DWORD
'#endif /* WINVER */
END TYPE
' // Size = 20 bytes
TYPE DOCINFOW DWORD
 cbSize AS LONG ' int
 lpszDocName AS WSTRINGZ PTR
 lpszOutput AS WSTRINGZ PTR
'#if (WINVER >= 0x0400)
 lpszDataType AS WSTRINGZ PTR
 fwType AS DWORD
'#endif /* WINVER */
END TYPE
#IF %DEF(%UNICODE)
 MACRO DOCINFO = DOCINFOW
#ELSE
 MACRO DOCINFO = DOCINFOA
#ENDIF
'#if(WINVER >= 0x0400)
%EQUATE `DI_APPBANDING = &H00000001
%EQUATE `DI_ROPS_READ_DESTINATION = &H00000002
'#endif /* WINVER >= 0x0400 */
DECLARE FUNCTION StartDocA LIB "gdi32.dll" ALIAS "StartDocA" ( BYVAL hdc AS QUAD , BYREF lpdi AS DOCINFOA ) AS LONG ' int
DECLARE FUNCTION StartDocW LIB "gdi32.dll" ALIAS "StartDocW" ( BYVAL hdc AS QUAD , BYREF lpdi AS DOCINFOW ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StartDoc = StartDocW
#ELSE
 MACRO StartDoc = StartDocA
#ENDIF
DECLARE FUNCTION EndDoc LIB "gdi32.dll" ALIAS "EndDoc" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION StartPage LIB "gdi32.dll" ALIAS "StartPage" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION EndPage LIB "gdi32.dll" ALIAS "EndPage" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION AbortDoc LIB "gdi32.dll" ALIAS "AbortDoc" ( BYVAL hdc AS QUAD ) AS LONG ' int
DECLARE FUNCTION SetAbortProc LIB "gdi32.dll" ALIAS "SetAbortProc" ( BYVAL hdc AS QUAD , BYVAL proc AS QUAD ) AS LONG ' int
DECLARE FUNCTION AbortPath LIB "gdi32.dll" ALIAS "AbortPath" ( BYVAL hdc AS QUAD ) AS LONG
DECLARE FUNCTION ArcTo LIB "gdi32.dll" ALIAS "ArcTo" ( BYVAL hdc AS QUAD
 , BYVAL left AS LONG
 , BYVAL top AS LONG
 , BYVAL right AS LONG
 , BYVAL bottom AS LONG
 , BYVAL xr1 AS LONG
 , BYVAL yr1 AS LONG
 , BYVAL xr2 AS LONG
 , BYVAL yr2 AS LONG
 ) AS LONG
DECLARE FUNCTION BeginPath LIB "gdi32.dll" ALIAS "BeginPath" ( BYVAL hdc AS DWORD
 ) AS LONG
DECLARE FUNCTION CloseFigure LIB "gdi32.dll" ALIAS "CloseFigure" ( BYVAL hdc AS DWORD
 ) AS LONG
DECLARE FUNCTION EndPath LIB "gdi32.dll" ALIAS "EndPath" ( BYVAL hdc AS DWORD
 ) AS LONG
DECLARE FUNCTION FillPath LIB "gdi32.dll" ALIAS "FillPath" ( BYVAL hdc AS DWORD
 ) AS LONG
DECLARE FUNCTION FlattenPath LIB "gdi32.dll" ALIAS "FlattenPath" ( BYVAL hdc AS DWORD
 ) AS LONG
DECLARE FUNCTION GetPath LIB "gdi32.dll" ALIAS "GetPath" ( BYVAL hdc AS DWORD
 , BYREF apt AS POINT
 , BYREF aj AS BYTE
 , BYVAL cpt AS DWORD ' int cpt
 ) AS LONG ' int
DECLARE FUNCTION PathToRegion LIB "gdi32.dll" ALIAS "PathToRegion" ( BYVAL hdc AS QUAD ) AS QUAD ' HRGN
DECLARE FUNCTION PolyDraw LIB "gdi32.dll" ALIAS "PolyDraw" ( BYVAL hdc AS QUAD , BYREF apt AS POINT , BYREF aj AS BYTE , BYVAL cpt AS LONG ) AS LONG
DECLARE FUNCTION SelectClipPath LIB "gdi32.dll" ALIAS "SelectClipPath" ( BYVAL hdc AS QUAD
 , BYVAL mode AS LONG
 ) AS LONG
DECLARE FUNCTION SetArcDirection LIB "gdi32.dll" ALIAS "SetArcDirection" ( BYVAL hdc AS DWORD
 , BYVAL dir AS LONG
 ) AS LONG ' int
DECLARE FUNCTION SetMiterLimit LIB "gdi32.dll" ALIAS "SetMiterLimit" ( BYVAL hdc AS QUAD , BYVAL limit AS SINGLE , OPTIONAL BYREF old AS SINGLE ) AS LONG
DECLARE FUNCTION StrokeAndFillPath LIB "gdi32.dll" ALIAS "StrokeAndFillPath" ( BYVAL hdc AS QUAD
 ) AS LONG
DECLARE FUNCTION StrokePath LIB "gdi32.dll" ALIAS "StrokePath" ( BYVAL hdc AS DWORD
 ) AS LONG
DECLARE FUNCTION WidenPath LIB "gdi32.dll" ALIAS "WidenPath" ( BYVAL hdc AS DWORD
 ) AS LONG
DECLARE FUNCTION ExtCreatePen LIB "gdi32.dll" ALIAS "ExtCreatePen" ( BYVAL iPenStyle AS DWORD
 , BYVAL cWidth AS DWORD
 , BYREF plbrush AS LOGBRUSH
 , BYVAL cStyle AS DWORD
 , BYREF pstyle AS DWORD
 ) AS DWORD ' HPEN
DECLARE FUNCTION GetMiterLimit LIB "gdi32.dll" ALIAS "GetMiterLimit" ( BYVAL hdc AS QUAD , BYREF plimit AS SINGLE ) AS LONG
DECLARE FUNCTION GetArcDirection LIB "gdi32.dll" ALIAS "GetArcDirection" ( BYVAL hdc AS QUAD
 ) AS LONG ' int
DECLARE FUNCTION GetObjectA LIB "gdi32.dll" ALIAS "GetObjectA" ( BYVAL h AS QUAD , BYVAL c AS LONG , BYREF pv AS ANY ) AS LONG ' int
DECLARE FUNCTION GetObjectW LIB "gdi32.dll" ALIAS "GetObjectW" ( BYVAL h AS QUAD , BYVAL c AS LONG , BYREF pv AS ANY ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO GetObject = GetObjectW
#ELSE
 MACRO GetObject = GetObjectA
#ENDIF
DECLARE FUNCTION MoveToEx LIB "gdi32.dll" ALIAS "MoveToEx" ( BYVAL hdc AS QUAD , BYVAL x AS LONG , BYVAL y AS LONG , OPTIONAL BYREF lppt AS POINT ) AS LONG
FUNCTION MoveTo (BYVAL hDC AS QUAD, BYVAL x AS LONG, BYVAL y AS LONG) AS LONG
 FUNCTION = MoveToEx(hDC, x, y, BYVAL %NULL)
END FUNCTION
DECLARE FUNCTION TextOutA LIB "gdi32.dll" ALIAS "TextOutA" ( BYVAL hdc AS QUAD , BYVAL x AS LONG , BYVAL y AS LONG , BYREF lpString AS ASCIIZ , BYVAL c AS LONG ) AS LONG
DECLARE FUNCTION TextOutW LIB "gdi32.dll" ALIAS "TextOutW" ( BYVAL hdc AS QUAD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , BYREF lpString AS WSTRINGZ
 , BYVAL c AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO TextOut = TextOutW
#ELSE
 MACRO TextOut = TextOutA
#ENDIF
DECLARE FUNCTION ExtTextOutA LIB "gdi32.dll" ALIAS "ExtTextOutA" ( BYVAL hdc AS QUAD , BYVAL x AS LONG , BYVAL y AS LONG , BYVAL options AS QUAD , BYREF lprect AS RECT , BYREF lpString AS ASCIIZ , BYVAL c AS QUAD , BYREF lpDx AS LONG ) AS LONG
DECLARE FUNCTION ExtTextOutW LIB "gdi32.dll" ALIAS "ExtTextOutW" ( BYVAL hdc AS QUAD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , BYVAL options AS DWORD
 , BYREF lprect AS RECT
 , BYREF lpString AS WSTRINGZ
 , BYVAL c AS DWORD
 , BYREF lpDx AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO ExtTextOut = ExtTextOutW
#ELSE
 MACRO ExtTextOut = ExtTextOutA
#ENDIF
DECLARE FUNCTION PolyTextOutA LIB "gdi32.dll" ALIAS "PolyTextOutA" ( BYVAL hdc AS QUAD , BYREF ppt AS POLYTEXTA , BYVAL nstrings AS LONG ) AS LONG
DECLARE FUNCTION PolyTextOutW LIB "gdi32.dll" ALIAS "PolyTextOutW" ( BYVAL hdc AS QUAD
 , BYREF ppt AS POLYTEXTW
 , BYVAL nstrings AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PolyTextOut = PolyTextOutW
#ELSE
 MACRO PolyTextOut = PolyTextOutA
#ENDIF
DECLARE FUNCTION CreatePolygonRgn LIB "gdi32.dll" ALIAS "CreatePolygonRgn" ( BYREF pptl AS POINT , BYVAL cPoint AS LONG , BYVAL iMode AS LONG ) AS QUAD ' HRGN
DECLARE FUNCTION DPtoLP LIB "gdi32.dll" ALIAS "DPtoLP" ( BYVAL hdc AS QUAD , BYREF lppt AS POINT , BYVAL c AS LONG ) AS LONG
DECLARE FUNCTION LPtoDP LIB "gdi32.dll" ALIAS "LPtoDP" ( BYVAL hdc AS QUAD
 , BYREF lppt AS POINT
 , BYVAL c AS LONG
 ) AS LONG
DECLARE FUNCTION Polygon LIB "gdi32.dll" ALIAS "Polygon" ( BYVAL hdc AS DWORD
 , BYREF apt AS POINT
 , BYVAL cpt AS LONG
 ) AS LONG
DECLARE FUNCTION Polyline LIB "gdi32.dll" ALIAS "Polyline" ( BYVAL hdc AS DWORD
 , BYREF apt AS POINT
 , BYVAL cpt AS LONG
 ) AS LONG
DECLARE FUNCTION PolyBezier LIB "gdi32.dll" ALIAS "PolyBezier" ( BYVAL hdc AS DWORD
 , BYREF apt AS POINT
 , BYVAL cpt AS DWORD
 ) AS LONG
DECLARE FUNCTION PolyBezierTo LIB "gdi32.dll" ALIAS "PolyBezierTo" ( BYVAL hdc AS DWORD
 , BYREF apt AS POINT
 , BYVAL cpt AS DWORD
 ) AS LONG
DECLARE FUNCTION PolylineTo LIB "gdi32.dll" ALIAS "PolylineTo" ( BYVAL hdc AS DWORD
 , BYREF apt AS POINT
 , BYVAL cpt AS DWORD
 ) AS LONG
DECLARE FUNCTION SetViewportExtEx LIB "gdi32.dll" ALIAS "SetViewportExtEx" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , OPTIONAL BYREF lpsz AS SIZE
 ) AS LONG
DECLARE FUNCTION SetViewportOrgEx LIB "gdi32.dll" ALIAS "SetViewportOrgEx" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , OPTIONAL BYREF lppt AS POINT
 ) AS LONG
DECLARE FUNCTION SetWindowExtEx LIB "gdi32.dll" ALIAS "SetWindowExtEx" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , OPTIONAL BYREF lpsz AS SIZE
 ) AS LONG
DECLARE FUNCTION SetWindowOrgEx LIB "gdi32.dll" ALIAS "SetWindowOrgEx" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , OPTIONAL BYREF lppt AS POINT
 ) AS LONG
DECLARE FUNCTION OffsetViewportOrgEx LIB "gdi32.dll" ALIAS "OffsetViewportOrgEx" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , OPTIONAL BYREF lppt AS POINT
 ) AS LONG
DECLARE FUNCTION OffsetWindowOrgEx LIB "gdi32.dll" ALIAS "OffsetWindowOrgEx" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , OPTIONAL BYREF lppt AS POINT
 ) AS LONG
DECLARE FUNCTION ScaleViewportExtEx LIB "gdi32.dll" ALIAS "ScaleViewportExtEx" ( BYVAL hdc AS DWORD
 , BYVAL xn AS LONG
 , BYVAL dx AS LONG
 , BYVAL yn AS LONG
 , BYVAL yd AS LONG
 , OPTIONAL BYREF lpsz AS SIZE
 ) AS LONG
DECLARE FUNCTION ScaleWindowExtEx LIB "gdi32.dll" ALIAS "ScaleWindowExtEx" ( BYVAL hdc AS DWORD
 , BYVAL xn AS LONG
 , BYVAL xd AS LONG
 , BYVAL yn AS LONG
 , BYVAL yd AS LONG
 , OPTIONAL BYREF lpsz AS SIZE
 ) AS LONG
DECLARE FUNCTION SetBitmapDimensionEx LIB "gdi32.dll" ALIAS "SetBitmapDimensionEx" ( BYVAL hbm AS DWORD
 , BYVAL w AS LONG
 , BYVAL h AS LONG
 , OPTIONAL BYREF lpsz AS SIZE
 ) AS LONG
DECLARE FUNCTION SetBrushOrgEx LIB "gdi32.dll" ALIAS "SetBrushOrgEx" ( BYVAL hdc AS DWORD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , OPTIONAL BYREF lppt AS POINT
 ) AS LONG
DECLARE FUNCTION GetTextFaceA LIB "gdi32.dll" ALIAS "GetTextFaceA" ( BYVAL hdc AS DWORD
 , BYVAL c AS LONG
 , BYREF lpName AS ASCIIZ
 ) AS LONG ' int
DECLARE FUNCTION GetTextFaceW LIB "gdi32.dll" ALIAS "GetTextFaceW" ( BYVAL hdc AS QUAD , BYVAL c AS LONG , BYREF lpName AS WSTRINGZ ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO GetTextFace = GetTextFaceW
#ELSE
 MACRO GetTextFace = GetTextFaceA
#ENDIF
%EQUATE `FONTMAPPER_MAX = 10
' // Size = 8 bytes
TYPE KERNINGPAIR DWORD FILL
 wFirst AS WORD ' WORD
 wSecond AS WORD ' WORD
 iKernAmount AS LONG ' int
END TYPE
DECLARE FUNCTION GetKerningPairsA LIB "gdi32.dll" ALIAS "GetKerningPairsA" ( BYVAL hdc AS QUAD , BYVAL nPairs AS QUAD , BYREF lpKernPair AS KERNINGPAIR ) AS QUAD
DECLARE FUNCTION GetKerningPairsW LIB "gdi32.dll" ALIAS "GetKerningPairsW" ( BYVAL hdc AS QUAD
 , BYVAL nPairs AS DWORD
 , BYREF lpKernPair AS KERNINGPAIR
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO GetKerningPairs = GetKerningPairsW
#ELSE
 MACRO GetKerningPairs = GetKerningPairsA
#ENDIF
DECLARE FUNCTION GetDCOrgEx LIB "gdi32.dll" ALIAS "GetDCOrgEx" ( BYVAL hdc AS QUAD , BYREF lppt AS POINT ) AS LONG
DECLARE FUNCTION FixBrushOrgEx LIB "gdi32.dll" ALIAS "FixBrushOrgEx" ( BYVAL hdc AS QUAD
 , BYVAL x AS LONG
 , BYVAL y AS LONG
 , OPTIONAL BYREF ptl AS POINT
 ) AS LONG
DECLARE FUNCTION UnrealizeObject LIB "gdi32.dll" ALIAS "UnrealizeObject" ( BYVAL h AS DWORD
 ) AS LONG
DECLARE FUNCTION GdiFlush LIB "gdi32.dll" ALIAS "GdiFlush" ( ) AS LONG
DECLARE FUNCTION GdiSetBatchLimit LIB "gdi32.dll" ALIAS "GdiSetBatchLimit" ( BYVAL dw AS DWORD
 ) AS DWORD
DECLARE FUNCTION GdiGetBatchLimit LIB "gdi32.dll" ALIAS "GdiGetBatchLimit" ( ) AS DWORD
'#if(WINVER >= 0x0400)
%EQUATE `ICM_OFF = 1
%EQUATE `ICM_ON = 2
%EQUATE `ICM_QUERY = 3
%EQUATE `ICM_DONE_OUTSIDEDC = 4
'typedef int (CALLBACK* ICMENUMPROCA)(LPSTR, LPARAM);
'typedef int (CALLBACK* ICMENUMPROCW)(LPWSTR, LPARAM);
DECLARE FUNCTION SetICMMode LIB "gdi32.dll" ALIAS "SetICMMode" ( BYVAL hdc AS QUAD , BYVAL mode AS LONG ) AS LONG ' int
DECLARE FUNCTION CheckColorsInGamut LIB "gdi32.dll" ALIAS "CheckColorsInGamut" ( BYVAL hdc AS QUAD , BYREF lpRGBTriple AS ANY , BYREF dlpBuffer AS ANY , BYVAL nCount AS QUAD ) AS LONG
DECLARE FUNCTION GetColorSpace LIB "gdi32.dll" ALIAS "GetColorSpace" ( BYVAL hdc AS QUAD
 ) AS DWORD ' HCOLORSPACE
DECLARE FUNCTION GetLogColorSpaceA LIB "gdi32.dll" ALIAS "GetLogColorSpaceA" ( BYVAL hColorSpace AS QUAD , BYREF lpBuffer AS LOGCOLORSPACEA , BYVAL nSize AS QUAD ) AS LONG
DECLARE FUNCTION GetLogColorSpaceW LIB "gdi32.dll" ALIAS "GetLogColorSpaceW" ( BYVAL hColorSpace AS QUAD
 , BYREF lpBuffer AS LOGCOLORSPACEW
 , BYVAL nSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetLogColorSpace = GetLogColorSpaceW
#ELSE
 MACRO GetLogColorSpace = GetLogColorSpaceA
#ENDIF
DECLARE FUNCTION CreateColorSpaceA LIB "gdi32.dll" ALIAS "CreateColorSpaceA" ( BYREF lplcs AS LOGCOLORSPACEA ) AS QUAD ' HCOLORSPACE
DECLARE FUNCTION CreateColorSpaceW LIB "gdi32.dll" ALIAS "CreateColorSpaceW" ( BYREF lplcs AS LOGCOLORSPACEW ) AS QUAD ' HCOLORSPACE
#IF %DEF(%UNICODE)
 MACRO CreateColorSpace = CreateColorSpaceW
#ELSE
 MACRO CreateColorSpace = CreateColorSpaceA
#ENDIF
DECLARE FUNCTION SetColorSpace LIB "gdi32.dll" ALIAS "SetColorSpace" ( BYVAL hdc AS QUAD , BYVAL hcs AS QUAD ) AS QUAD ' HCOLORSPACE
DECLARE FUNCTION DeleteColorSpace LIB "gdi32.dll" ALIAS "DeleteColorSpace" ( BYVAL hcs AS QUAD ) AS LONG
DECLARE FUNCTION GetICMProfileA LIB "gdi32.dll" ALIAS "GetICMProfileA" ( BYVAL hdc AS QUAD
 , BYREF pBufSize AS DWORD
 , BYREF pszFilename AS ASCIIZ
 ) AS LONG
DECLARE FUNCTION GetICMProfileW LIB "gdi32.dll" ALIAS "GetICMProfileW" ( BYVAL hdc AS DWORD
 , BYREF pBufSize AS DWORD
 , BYREF pszFilename AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetICMProfile = GetICMProfileW
#ELSE
 MACRO GetICMProfile = GetICMProfileA
#ENDIF
DECLARE FUNCTION SetICMProfileA LIB "gdi32.dll" ALIAS "SetICMProfileA" ( BYVAL hdc AS QUAD , BYREF lpFileName AS ASCIIZ ) AS LONG
DECLARE FUNCTION SetICMProfileW LIB "gdi32.dll" ALIAS "SetICMProfileW" ( BYVAL hdc AS QUAD
 , BYREF lpFileName AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetICMProfile = SetICMProfileW
#ELSE
 MACRO SetICMProfile = SetICMProfileA
#ENDIF
DECLARE FUNCTION GetDeviceGammaRamp LIB "gdi32.dll" ALIAS "GetDeviceGammaRamp" ( BYVAL hdc AS QUAD , BYREF lpRamp AS ANY ) AS LONG
DECLARE FUNCTION SetDeviceGammaRamp LIB "gdi32.dll" ALIAS "SetDeviceGammaRamp" ( BYVAL hdc AS QUAD
 , BYREF lpRamp AS ANY
 ) AS LONG
DECLARE FUNCTION ColorMatchToTarget LIB "gdi32.dll" ALIAS "ColorMatchToTarget" ( BYVAL hdc AS DWORD
 , BYVAL hdcTarget AS DWORD
 , BYVAL action AS DWORD
 ) AS LONG
DECLARE FUNCTION EnumICMProfilesA LIB "gdi32.dll" ALIAS "EnumICMProfilesA" ( BYVAL hdc AS DWORD
 , BYVAL proc AS DWORD
 , OPTIONAL BYVAL param AS LONG
 ) AS LONG ' int
DECLARE FUNCTION EnumICMProfilesW LIB "gdi32.dll" ALIAS "EnumICMProfilesW" ( BYVAL hdc AS QUAD , BYVAL proc AS QUAD , OPTIONAL BYVAL param AS LONG ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO EnumICMProfiles = EnumICMProfilesW
#ELSE
 MACRO EnumICMProfiles = EnumICMProfilesA
#ENDIF
DECLARE FUNCTION UpdateICMRegKeyA LIB "gdi32.dll" ALIAS "UpdateICMRegKeyA" ( BYVAL reserved AS QUAD , BYREF lpszCMID AS ASCIIZ , BYREF lpszFileName AS ASCIIZ , BYVAL command AS QUAD ) AS LONG
DECLARE FUNCTION UpdateICMRegKeyW LIB "gdi32.dll" ALIAS "UpdateICMRegKeyW" ( BYVAL reserved AS QUAD
 , BYREF lpszCMID AS WSTRINGZ
 , BYREF lpszFileName AS WSTRINGZ
 , BYVAL command AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UpdateICMRegKey = UpdateICMRegKeyW
#ELSE
 MACRO UpdateICMRegKey = UpdateICMRegKeyA
#ENDIF
'#endif /* WINVER >= 0x0400 */
'#if (WINVER >= 0x0500)
DECLARE FUNCTION ColorCorrectPalette LIB "gdi32.dll" ALIAS "ColorCorrectPalette" ( BYVAL hdc AS QUAD , BYVAL hPal AS QUAD , BYVAL deFirst AS QUAD , BYVAL num AS QUAD ) AS LONG
'#endif
#IF NOT %DEF(%NOMETAFILE) ' ---------------------------------------------------
'#ifndef NOMETAFILE
'// Enhanced metafile constants.
'#ifndef _MAC
'#define ENHMETA_SIGNATURE 0x464D4520
%EQUATE `ENHMETA_SIGNATURE = &H464D4520
'#else
'#define ENHMETA_SIGNATURE 0x20454D46
'#endif
'// Stock object flag used in the object handle index in the enhanced
'// metafile records.
'// E.g. The object handle index (META_STOCK_OBJECT | BLACK_BRUSH)
'// represents the stock object BLACK_BRUSH.
%EQUATE `ENHMETA_STOCK_OBJECT = &H80000000
'// Enhanced metafile record types.
%EQUATE `EMR_HEADER = 1
%EQUATE `EMR_POLYBEZIER = 2
%EQUATE `EMR_POLYGON = 3
%EQUATE `EMR_POLYLINE = 4
%EQUATE `EMR_POLYBEZIERTO = 5
%EQUATE `EMR_POLYLINETO = 6
%EQUATE `EMR_POLYPOLYLINE = 7
%EQUATE `EMR_POLYPOLYGON = 8
%EQUATE `EMR_SETWINDOWEXTEX = 9
%EQUATE `EMR_SETWINDOWORGEX = 10
%EQUATE `EMR_SETVIEWPORTEXTEX = 11
%EQUATE `EMR_SETVIEWPORTORGEX = 12
%EQUATE `EMR_SETBRUSHORGEX = 13
%EQUATE `EMR_EOF = 14
%EQUATE `EMR_SETPIXELV = 15
%EQUATE `EMR_SETMAPPERFLAGS = 16
%EQUATE `EMR_SETMAPMODE = 17
%EQUATE `EMR_SETBKMODE = 18
%EQUATE `EMR_SETPOLYFILLMODE = 19
%EQUATE `EMR_SETROP2 = 20
%EQUATE `EMR_SETSTRETCHBLTMODE = 21
%EQUATE `EMR_SETTEXTALIGN = 22
%EQUATE `EMR_SETCOLORADJUSTMENT = 23
%EQUATE `EMR_SETTEXTCOLOR = 24
%EQUATE `EMR_SETBKCOLOR = 25
%EQUATE `EMR_OFFSETCLIPRGN = 26
%EQUATE `EMR_MOVETOEX = 27
%EQUATE `EMR_SETMETARGN = 28
%EQUATE `EMR_EXCLUDECLIPRECT = 29
%EQUATE `EMR_INTERSECTCLIPRECT = 30
%EQUATE `EMR_SCALEVIEWPORTEXTEX = 31
%EQUATE `EMR_SCALEWINDOWEXTEX = 32
%EQUATE `EMR_SAVEDC = 33
%EQUATE `EMR_RESTOREDC = 34
%EQUATE `EMR_SETWORLDTRANSFORM = 35
%EQUATE `EMR_MODIFYWORLDTRANSFORM = 36
%EQUATE `EMR_SELECTOBJECT = 37
%EQUATE `EMR_CREATEPEN = 38
%EQUATE `EMR_CREATEBRUSHINDIRECT = 39
%EQUATE `EMR_DELETEOBJECT = 40
%EQUATE `EMR_ANGLEARC = 41
%EQUATE `EMR_ELLIPSE = 42
%EQUATE `EMR_RECTANGLE = 43
%EQUATE `EMR_ROUNDRECT = 44
%EQUATE `EMR_ARC = 45
%EQUATE `EMR_CHORD = 46
%EQUATE `EMR_PIE = 47
%EQUATE `EMR_SELECTPALETTE = 48
%EQUATE `EMR_CREATEPALETTE = 49
%EQUATE `EMR_SETPALETTEENTRIES = 50
%EQUATE `EMR_RESIZEPALETTE = 51
%EQUATE `EMR_REALIZEPALETTE = 52
%EQUATE `EMR_EXTFLOODFILL = 53
%EQUATE `EMR_LINETO = 54
%EQUATE `EMR_ARCTO = 55
%EQUATE `EMR_POLYDRAW = 56
%EQUATE `EMR_SETARCDIRECTION = 57
%EQUATE `EMR_SETMITERLIMIT = 58
%EQUATE `EMR_BEGINPATH = 59
%EQUATE `EMR_ENDPATH = 60
%EQUATE `EMR_CLOSEFIGURE = 61
%EQUATE `EMR_FILLPATH = 62
%EQUATE `EMR_STROKEANDFILLPATH = 63
%EQUATE `EMR_STROKEPATH = 64
%EQUATE `EMR_FLATTENPATH = 65
%EQUATE `EMR_WIDENPATH = 66
%EQUATE `EMR_SELECTCLIPPATH = 67
%EQUATE `EMR_ABORTPATH = 68
%EQUATE `EMR_GDICOMMENT = 70
%EQUATE `EMR_FILLRGN = 71
%EQUATE `EMR_FRAMERGN = 72
%EQUATE `EMR_INVERTRGN = 73
%EQUATE `EMR_PAINTRGN = 74
%EQUATE `EMR_EXTSELECTCLIPRGN = 75
%EQUATE `EMR_BITBLT = 76
%EQUATE `EMR_STRETCHBLT = 77
%EQUATE `EMR_MASKBLT = 78
%EQUATE `EMR_PLGBLT = 79
%EQUATE `EMR_SETDIBITSTODEVICE = 80
%EQUATE `EMR_STRETCHDIBITS = 81
%EQUATE `EMR_EXTCREATEFONTINDIRECTW = 82
%EQUATE `EMR_EXTTEXTOUTA = 83
%EQUATE `EMR_EXTTEXTOUTW = 84
%EQUATE `EMR_POLYBEZIER16 = 85
%EQUATE `EMR_POLYGON16 = 86
%EQUATE `EMR_POLYLINE16 = 87
%EQUATE `EMR_POLYBEZIERTO16 = 88
%EQUATE `EMR_POLYLINETO16 = 89
%EQUATE `EMR_POLYPOLYLINE16 = 90
%EQUATE `EMR_POLYPOLYGON16 = 91
%EQUATE `EMR_POLYDRAW16 = 92
%EQUATE `EMR_CREATEMONOBRUSH = 93
%EQUATE `EMR_CREATEDIBPATTERNBRUSHPT = 94
%EQUATE `EMR_EXTCREATEPEN = 95
%EQUATE `EMR_POLYTEXTOUTA = 96
%EQUATE `EMR_POLYTEXTOUTW = 97
'#if(WINVER >= 0x0400)
%EQUATE `EMR_SETICMMODE = 98
%EQUATE `EMR_CREATECOLORSPACE = 99
%EQUATE `EMR_SETCOLORSPACE = 100
%EQUATE `EMR_DELETECOLORSPACE = 101
%EQUATE `EMR_GLSRECORD = 102
%EQUATE `EMR_GLSBOUNDEDRECORD = 103
%EQUATE `EMR_PIXELFORMAT = 104
'#endif /* WINVER >= 0x0400 */
'#if(WINVER >= 0x0500)
%EQUATE `EMR_DRAWESCAPE = 105
%EQUATE `EMR_EXTESCAPE = 106
%EQUATE `EMR_STARTDOC = 107
%EQUATE `EMR_SMALLTEXTOUT = 108
%EQUATE `EMR_FORCEUFIMAPPING = 109
%EQUATE `EMR_NAMEDESCAPE = 110
%EQUATE `EMR_COLORCORRECTPALETTE = 111
%EQUATE `EMR_SETICMPROFILEA = 112
%EQUATE `EMR_SETICMPROFILEW = 113
%EQUATE `EMR_ALPHABLEND = 114
%EQUATE `EMR_ALPHADIBBLEND = 115
%EQUATE `EMR_TRANSPARENTBLT = 116
'#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
%EQUATE `EMR_TRANSPARENTDIB = 117
'#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
%EQUATE `EMR_GRADIENTFILL = 118
%EQUATE `EMR_SETLINKEDUFIS = 119
%EQUATE `EMR_SETTEXTJUSTIFICATION = 120
%EQUATE `EMR_COLORMATCHTOTARGETW = 121
%EQUATE `EMR_CREATECOLORSPACEW = 122
'#endif /* WINVER >= 0x0500 */
%EQUATE `EMR_MIN = 1
'#if (WINVER >= 0x0500)
'#define EMR_MAX 122
'#elif (WINVER >= 0x0400)
'#define EMR_MAX 104
'#else
'#define EMR_MAX 97
'#endif
%EQUATE `EMR_MAX = 122 ' depending on Windows version, may be 97, 104, or 120 (so far)
'// Base record type for the enhanced metafile.
' // Size = 8 bytes
TYPE EMR DWORD
 iType AS DWORD ' DWORD // Enhanced metafile record type
 nSize AS DWORD ' DWORD // Length of the record in bytes. Must be a multiple of 4.
END TYPE
'// Base text record type for the enhanced metafile.
' // Size = 40 bytes
TYPE EMRTEXT DWORD
 ptlReference AS POINTL
 nChars AS DWORD
 offString AS DWORD
 fOptions AS DWORD
 rcl AS RECTL
 offDx AS DWORD
END TYPE
'// Record structures for the enhanced metafile.
' // Size = 8 bytes
TYPE EMRABORTPATH DWORD
 emr AS EMR
END TYPE
MACRO EMRBEGINPATH = EMRABORTPATH
MACRO EMRENDPATH = EMRABORTPATH
MACRO EMRCLOSEFIGURE = EMRABORTPATH
MACRO EMRFLATTENPATH = EMRABORTPATH
MACRO EMRWIDENPATH = EMRABORTPATH
MACRO EMRSETMETARGN = EMRABORTPATH
MACRO EMREMRSAVEDC = EMRABORTPATH
MACRO EMRREALIZEPALETTE = EMRABORTPATH
' // Size = 12 bytes
TYPE EMRSELECTCLIPPATH DWORD
 emr AS EMR
 iMode AS DWORD
END TYPE
MACRO EMRSETBKMODE = EMRSELECTCLIPPATH
MACRO EMRSETMAPMODE = EMRSELECTCLIPPATH
MACRO EMRSETPOLYFILLMODE = EMRSELECTCLIPPATH
MACRO EMRSETROP2 = EMRSELECTCLIPPATH
MACRO EMRSETSTRETCHBLTMODE = EMRSELECTCLIPPATH
MACRO EMRSETICMMODE = EMRSELECTCLIPPATH
MACRO EMRSETTEXTALIGN = EMRSELECTCLIPPATH
' // Size = 12 bytes
TYPE EMRSETMITERLIMIT DWORD
 emr AS EMR
 eMiterLimit AS SINGLE
END TYPE
' // Size = 12 bytes
TYPE EMRRESTOREDC DWORD
 emr AS EMR
 iRelative AS LONG ' Specifies a relative instance
END TYPE
' // Size = 12 bytes
TYPE EMRSETARCDIRECTION DWORD
 emr AS EMR
 iArcDirection AS DWORD ' Specifies the arc direction in the advanced graphics mode
END TYPE
' // Size = 12 bytes
TYPE EMRSETMAPPERFLAGS DWORD
 emr AS EMR
 dwFlags AS DWORD
END TYPE
' // Size = 12 bytes
TYPE EMRSETTEXTCOLOR DWORD
 emr AS EMR
 crColor AS DWORD
END TYPE
MACRO EMRSETBKCOLOR = EMRSETTEXTCOLOR
' // Size = 12 bytes
TYPE EMRSELECTOBJECT DWORD
 emr AS EMR
 ihObject AS DWORD ' Object handle index
END TYPE
MACRO EMRDELETEOBJECT = EMRSELECTOBJECT
' // Size = 12 bytes
TYPE EMRSELECTPALETTE DWORD
 emr AS EMR
 ihPal AS DWORD ' Palette handle index, background mode only
END TYPE
' // Size = 16 bytes
TYPE EMRRESIZEPALETTE DWORD
 emr AS EMR
 ihPal AS DWORD ' Palette handle index
 cEntries AS DWORD
END TYPE
' // Size = 24 bytes
TYPE EMRSETPALETTEENTRIES DWORD
 emr AS EMR
 ihPal AS DWORD ' // Palette handle index
 iStart AS DWORD
 cEntries AS DWORD
 aPalEntries(0) AS PALETTEENTRY ' PALETTEENTRY aPalEntries[1];// The peFlags fields do not contain any flags
END TYPE
' // Size = 32 bytes
TYPE EMRSETCOLORADJUSTMENT DWORD
 emr AS EMR
 ColorAdjustment AS ColorAdjustment
END TYPE
' // Size = 16 bytes
TYPE EMRGDICOMMENT DWORD
 emr AS EMR
 cbData AS DWORD ' // Size of data in bytes
 Data(0) AS BYTE ' BYTE Data[1]
END TYPE
' // Size = 20 bytes
TYPE EMREOF DWORD
 emr AS EMR
 nPalEntries AS DWORD ' Number of palette entries
 offPalEntries AS DWORD ' Offset to the palette entries
 nSizeLast AS DWORD ' Same as nSize and must be the last DWORD
 ' of the record. The palette entries, if they
 ' exist, precede this field.
END TYPE
' // Size = 16 bytes
TYPE EMRLINETO DWORD
 emr AS EMR
 ptl AS POINTL
END TYPE
MACRO EMRMOVETOEX = EMRLINETO
' // Size = 16 bytes
TYPE EMROFFSETCLIPRGN DWORD
 emr AS EMR
 ptlOffset AS POINTL
END TYPE
' // Size = 24 bytes
TYPE EMRFILLPATH DWORD
 emr AS EMR
 rclBounds AS RECTL ' inclusive-inclusive bounds in device units
END TYPE
MACRO EMRSTROKEANDFILLPATH = EMRFILLPATH
MACRO EMRSTROKEPATH = EMRFILLPATH
' // Size = 24 bytes
TYPE EMREXCLUDECLIPRECT DWORD
 emr AS EMR
 rclClip AS RECTL
END TYPE
MACRO EMRINTERSECTCLIPRECT = EMREXCLUDECLIPRECT
' // Size = 16 bytes
TYPE EMRSETVIEWPORTORGEX DWORD
 emr AS EMR
 ptlOrigin AS POINTL
END TYPE
MACRO EMRSETWINDOWORGEX = EMRSETVIEWPORTORGEX
MACRO EMRSETBRUSHORGEX = EMRSETVIEWPORTORGEX
' // Size = 16 bytes
TYPE EMRSETVIEWPORTEXTEX DWORD
 emr AS EMR
 szlExtent AS SIZEL
END TYPE
MACRO EMRSETWINDOWEXTEX = EMRSETVIEWPORTEXTEX
' // Size = 24 bytes
TYPE EMRSCALEVIEWPORTEXTEX DWORD
 emr AS EMR
 xNum AS LONG
 xDenom AS LONG
 yNum AS LONG
 yDemon AS LONG
END TYPE
MACRO EMRSCALEWINDOWEXTEX = EMRSCALEVIEWPORTEXTEX
' // Size = 32 bytes
TYPE EMRSETWORLDTRANSFORM DWORD
 emr AS EMR
 xform AS XFORM
END TYPE
' // Size = 36 bytes
TYPE EMRMODIFYWORLDTRANSFORM DWORD
 emr AS EMR
 xform AS XFORM
 iMode AS DWORD
END TYPE
' // Size = 20 bytes
TYPE EMRSETPIXELV DWORD
 emr AS EMR
 ptlPixel AS POINTL
 crColor AS DWORD
END TYPE
' // Size = 24 bytes
TYPE EMREXTFLOODFILL DWORD
 emr AS EMR
 ptlStart AS POINTL
 crColor AS DWORD
 iMode AS DWORD
END TYPE
' // Size = 24 bytes
TYPE EMRELLIPSE DWORD
 emr AS EMR
 rclBox AS RECTL ' Inclusive-inclusive bounding rectangle
END TYPE
MACRO EMRRECTANGLE = EMRELLIPSE
' // Size = 32 bytes
TYPE EMRROUNDRECT DWORD
 emr AS EMR
 rclBox AS RECTL ' Inclusive-inclusive bounding rectangle
 szlCorner AS SIZEL
END TYPE
' // Size = 40 bytes
TYPE EMRARC DWORD
 emr AS EMR
 rclBox AS RECTL ' Inclusive-inclusive bounding rectangle
 ptlStart AS POINTL
 ptlEnd AS POINTL
END TYPE
MACRO EMRARCTO = EMRARC
MACRO EMRCHORD = EMRARC
MACRO EMRPIE = EMRARC
' // Size = 28 bytes
TYPE EMRANGLEARC DWORD
 emr AS EMR
 ptlCenter AS POINTL
 nRadius AS LONG
 eStartAngle AS SINGLE
 eSweepAngle AS SINGLE
END TYPE
' // Size = 36 bytes
TYPE EMRPOLYLINE DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 cptl AS DWORD
 aptl(0) AS POINTL ' POINTL aptl[1]
END TYPE
MACRO EMRPOLYBEZIER = EMRPOLYLINE
MACRO EMRPOLYGON = EMRPOLYLINE
MACRO EMRPOLYBEZIERTO = EMRPOLYLINE
MACRO EMRPOLYLINETO = EMRPOLYLINE
' // Size = 32 bytes
TYPE EMRPOLYLINE16 DWORD
 emr AS emr
 rclBounds AS RECTL ' // Inclusive-inclusive bounds in device units
 cpts AS DWORD
 aptl(0) AS POINTS ' POINTS apts[1]
END TYPE
MACRO EMRPOLYBEZIER16 = EMRPOLYLINE16
MACRO EMRPOLYGON16 = EMRPOLYLINE16
MACRO EMRPOLYBEZIERTO16 = EMRPOLYLINE16
MACRO EMRPOLYLINETO16 = EMRPOLYLINE16
' // Size = 40 bytes
TYPE EMRPOLYDRAW DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 cptl AS DWORD ' Number of points
 aptl(0) AS POINTL ' POINTL aptl[1] // Array of points
 abTypes(0) AS BYTE ' BYTE abTypes[1] // Array of point types
END TYPE
' // Size = 36 bytes
TYPE EMRPOLYDRAW16 DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 cpts AS DWORD ' Number of points
 apts(0) AS POINTS ' POINTS apts[1] // Array of points
 abTypes(0) AS BYTE ' BYTE abTypes[1] // Array of point types
END TYPE
' // Size = 44 bytes
TYPE EMRPOLYPOLYLINE DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 nPolys AS DWORD ' Number of polys
 cptl AS DWORD ' Total number of points in all polys
 aPolyCounts(0) AS DWORD ' DWORD aPolyCounts[1] // Array of point counts for each poly
 aptl(0) AS POINTL ' POINTL aptl[1]; // Array of points
END TYPE
MACRO EMRPOLYPOLYGON = EMRPOLYPOLYLINE
' // Size = 40 bytes
TYPE EMRPOLYPOLYLINE16 DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 nPolys AS DWORD ' Number of polys
 cpts AS DWORD ' Total number of points in all polys
 aPolyCounts(0) AS DWORD ' DWORD aPolyCounts[1] // Array of point counts for each poly
 apts(0) AS POINTS ' POINTS apts[1] // Array of points
END TYPE
MACRO EMRPOLYPOLYGON16 = EMRPOLYPOLYLINE16
' // Size = 32 bytes
TYPE EMRINVERTRGN DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 cbRgnData AS DWORD ' Size of region data in bytes
 RgnData(0) AS BYTE ' BYTE RgnData[1]
END TYPE
MACRO EMRPAINTRGN = EMRINVERTRGN
' // Size = 36 bytes
TYPE EMRFILLRGN DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 cbRgnData AS DWORD ' Size of region data in bytes
 ihBrush AS DWORD ' Brush handle index
 RgnData(0) AS BYTE ' BYTE RgnData[1]
END TYPE
' // Size = 44 bytes
TYPE EMRFRAMERGN DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 cbRgnData AS DWORD ' Size of region data in bytes
 ihBrush AS DWORD ' Brush handle index
 szlStroke AS SIZEL
 RgnData(0) AS BYTE ' BYTE RgnData[1]
END TYPE
' // Size = 20 bytes
TYPE EMREXTSELECTCLIPRGN DWORD
 emr AS EMR
 cbRgnData AS DWORD ' Size of region data in bytes
 iMode AS DWORD
 RgnData(0) AS BYTE ' BYTE RgnData[1];
END TYPE
' // Size = 76 bytes
TYPE EMREXTTEXTOUTA DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 iGraphicsMode AS DWORD ' Current graphics mode
 exScale AS SINGLE ' X and Y scales from Page units to .01mm units
 eyScale AS SINGLE ' if graphics mode is %GM_COMPATIBLE.
 pemrtext AS EMRTEXT ' This is followed by the string and spacing array
END TYPE
MACRO EMREXTTEXTOUTW = EMREXTTEXTOUTA
MACRO EMREXTTEXTOUT = EMREXTTEXTOUTA
' // Size = 80 bytes
TYPE EMRPOLYTEXTOUTA DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 iGraphicsMode AS DWORD ' Current graphics mode
 exScale AS SINGLE ' X and Y scales from Page units to .01mm units
 eyScale AS SINGLE ' if graphics mode is %GM_COMPATIBLE.
 cStrings AS LONG
 aemrtext(0) AS EMRTEXT ' EMRTEXT aemrtext[1] // Array of EMRTEXT structures. This is
 ' // followed by the strings and spacing arrays.
END TYPE
MACRO EMRPOLYTEXTOUTW = EMRPOLYTEXTOUTA
MACRO EMRPOLYTEXTOUT = EMRPOLYTEXTOUTA
' // Size = 100 bytes
TYPE EMRBITBLT DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 xDest AS LONG
 yDest AS LONG
 cxDest AS LONG
 cyDest AS LONG
 dwRop AS DWORD
 xSrc AS LONG
 ySrc AS LONG
 xformSrc AS XFORM ' Source DC transform
 crBkColorSrc AS DWORD ' Source DC BkColor in RGB
 iUsageSrc AS DWORD ' Source bitmap info color table usage (%DIB_RGB_COLORS)
 offBmiSrc AS DWORD ' Offset to the source BITMAPINFO structure
 cbBmiSrc AS DWORD ' Size of the source BITMAPINFO structure
 offBitsSrc AS DWORD ' Offset to the source bitmap bits
 cbBitsSrc AS DWORD ' Size of the source bitmap bits
END TYPE
' // Size = 108 bytes
TYPE EMRSTRETCHBLT DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 xDest AS LONG
 yDest AS LONG
 cxDest AS LONG
 cyDest AS LONG
 dwRop AS DWORD
 xSrc AS LONG
 ySrc AS LONG
 xformSrc AS XFORM ' Source DC transform
 crBkColorSrc AS DWORD ' Source DC BkColor in RGB
 iUsageSrc AS DWORD ' Source bitmap info color table usage (%DIB_RGB_COLORS)
 offBmiSrc AS DWORD ' Offset to the source BITMAPINFO structure
 cbBmiSrc AS DWORD ' Size of the source BITMAPINFO structure
 offBitsSrc AS DWORD ' Offset to the source bitmap bits
 cbBitsSrc AS DWORD ' Size of the source bitmap bits
 cxSrc AS LONG
 cySrc AS LONG
END TYPE
' // Size = 128 bytes
TYPE EMRMASKBLT DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 xDest AS LONG
 yDest AS LONG
 cxDest AS LONG
 cyDest AS LONG
 dwRop AS DWORD
 xSrc AS LONG
 ySrc AS LONG
 xformSrc AS XFORM ' Source DC transform
 crBkColorSrc AS DWORD ' Source DC BkColor in RGB
 iUsageSrc AS DWORD ' Source bitmap info color table usage (%DIB_RGB_COLORS)
 offBmiSrc AS DWORD ' Offset to the source BITMAPINFO structure
 cbBmiSrc AS DWORD ' Size of the source BITMAPINFO structure
 offBitsSrc AS DWORD ' Offset to the source bitmap bits
 cbBitsSrc AS DWORD ' Size of the source bitmap bits
 xMask AS LONG
 yMask AS LONG
 iUsageMask AS DWORD ' Mask bitmap info color table usage
 offBmiMask AS DWORD ' Offset to the mask BITMAPINFO structure if any
 cbBmiMask AS DWORD ' Size of the mask BITMAPINFO structure if any
 offBitsMask AS DWORD ' Offset to the mask bitmap bits if any
 cbBitsMask AS DWORD ' Size of the mask bitmap bits if any
END TYPE
' // Size = 140 bytes
TYPE EMRPLGBLT DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 aptlDest(2) AS POINTL
 xSrc AS LONG
 ySrc AS LONG
 cxSrc AS LONG
 cySrc AS LONG
 xformSrc AS XFORM ' Source DC transform
 crBkColorSrc AS DWORD ' Source DC BkColor in RGB
 iUsageSrc AS DWORD ' Source bitmap info color table usage (%DIB_RGB_COLORS)
 offBmiSrc AS DWORD ' Offset to the source BITMAPINFO structure
 cbBmiSrc AS DWORD ' Size of the source BITMAPINFO structure
 offBitsSrc AS DWORD ' Offset to the source bitmap bits
 cbBitsSrc AS DWORD ' Size of the source bitmap bits
 xMask AS LONG
 yMask AS LONG
 iUsageMask AS DWORD ' Mask bitmap info color table usage
 offBmiMask AS DWORD ' Offset to the mask BITMAPINFO structure if any
 cbBmiMask AS DWORD ' Size of the mask BITMAPINFO structure if any
 offBitsMask AS DWORD ' Offset to the mask bitmap bits if any
 cbBitsMask AS DWORD ' Size of the mask bitmap bits if any
END TYPE
' // Size = 76 bytes
TYPE EMRSETDIBITSTODEVICE DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 xDest AS LONG
 yDest AS LONG
 xSrc AS LONG
 ySrc AS LONG
 cxSrc AS LONG
 cySrc AS LONG
 offBmiSrc AS DWORD ' Offset to the source BITMAPINFO structure
 cbBmiSrc AS DWORD ' Size of the source BITMAPINFO structure
 offBitsSrc AS DWORD ' Offset to the source bitmap bits
 cbBitsSrc AS DWORD ' Size of the source bitmap bits
 iUsageSrc AS DWORD ' Source bitmap info color table usage
 iStartScan AS DWORD
 cScans AS DWORD
END TYPE
' // Size = 80 bytes
TYPE EMRSTRETCHDIBITS DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 xDest AS LONG
 yDest AS LONG
 xSrc AS LONG
 ySrc AS LONG
 cxSrc AS LONG
 cySrc AS LONG
 offBmiSrc AS DWORD ' Offset to the source BITMAPINFO structure
 cbBmiSrc AS DWORD ' Size of the source BITMAPINFO structure
 offBitsSrc AS DWORD ' Offset to the source bitmap bits
 cbBitsSrc AS DWORD ' Size of the source bitmap bits
 iUsageSrc AS DWORD ' Source bitmap info color table usage
 dwRop AS DWORD
 cxDest AS LONG
 cyDest AS LONG
END TYPE
' // Size = 332 bytes
TYPE EMREXTCREATEFONTINDIRECTW
 emr AS emr
 ihFont AS DWORD
 elfw AS EXTLOGFONTW
END TYPE
MACRO EMREXTCREATEFONTINDIRECT = EMREXTCREATEFONTINDIRECTW
' // Size = 20 bytes
TYPE EMRCREATEPALETTE DWORD ' fake type
 emr AS EMR
 ihPal AS DWORD ' Palette handle index
 lgpl AS LOGPALETTE ' The peFlags fields in the palette entries
 ' do not contain any flags
END TYPE
' // Size = 28 bytes
TYPE EMRCREATEPEN DWORD
 emr AS EMR
 ihPen AS DWORD ' Pen handle index
 lopn AS LOGPEN
END TYPE
' // Size = 56 bytes
TYPE EMREXTCREATEPEN DWORD
 emr AS EMR
 ihPen AS DWORD ' Pen handle index
 offBmi AS DWORD ' Offset to the BITMAPINFO structure if any
 cbBmi AS DWORD ' Size of the BITMAPINFO structure if any
 ' The bitmap info is followed by the bitmap bits
 ' to form a packed DIB.
 offBits AS DWORD ' Offset to the brush bitmap bits if any
 cbBits AS DWORD ' Size of the brush bitmap bits if any
 elp AS EXTLOGPEN32 ' The extended pen with the style array
END TYPE
' // Size = 24 bytes
TYPE EMRCREATEBRUSHINDIRECT DWORD
 emr AS EMR
 ihBrush AS DWORD ' Brush handle index
 lb AS LOGBRUSH32 ' The style must be %BS_SOLID, %BS_HOLLOW, %BS_NULL or
 ' %BS_HATCHED.
END TYPE
' // Size = 32 bytes
TYPE EMRCREATEMONOBRUSH DWORD
 emr AS EMR
 ihBrush AS DWORD ' Brush handle index
 iUsage AS DWORD ' Bitmap info color table usage
 offBmi AS DWORD ' Offset to the BITMAPINFO structure
 cbBmi AS DWORD ' Size of the BITMAPINFO structure
 offBits AS DWORD ' Offset to the bitmap bits
 cbBits AS DWORD ' Size of the bitmap bits
END TYPE
' // Size = 32 bytes
TYPE EMRCREATEDIBPATTERNBRUSHPT DWORD
 emr AS EMR
 ihBursh AS DWORD ' Brush handle index
 iUsage AS DWORD ' Bitmap info color table usage
 offBmi AS DWORD ' Offset to the BITMAPINFO structure
 cbBmi AS DWORD ' Size of the BITMAPINFO structure
 ' The bitmap info is followed by the bitmap bits
 ' to form a packed DIB.
 offBits AS DWORD ' Offset to the bitmap bits
 cbBits AS DWORD ' Size of the bitmap bits
END TYPE
' // Size = 16 bytes
TYPE EMRFORMAT DWORD
 dSignature AS DWORD ' Format signature, e.g. %ENHMETA_SIGNATURE.
 nVersion AS DWORD ' Format version number.
 cbData AS DWORD ' Size of data in bytes.
 offData AS DWORD ' Offset to data from %GDICOMMENT_IDENTIFIER.
 ' It must begin at a DWORD offset.
END TYPE
'#if(WINVER >= 0x0400)
' // Size = 16 bytes
TYPE EMRGLSRECORD DWORD
 emr AS EMR
 cbData AS DWORD ' // Size of data in bytes
 Data(0) AS BYTE ' BYTE Data[1]
END TYPE
' // Size = 32 bytes
TYPE EMRGLSBOUNDEDRECORD DWORD
 emr AS EMR
 rclBounds AS RECTL ' Bounds in recording coordinates
 cbData AS DWORD ' Size of data in bytes
 Data(0) AS BYTE ' BYTE Data[1]
END TYPE
' // Size = 48 bytes
TYPE EMRPIXELFORMAT DWORD
 emr AS EMR
 pfd AS PIXELFORMATDESCRIPTOR
END TYPE
' // Size = 340 bytes
TYPE EMRCREATECOLORSPACE DWORD
 emr AS EMR
 ihCS AS DWORD ' ColorSpace handle index
 lcs AS LOGCOLORSPACE
END TYPE
' // Size = 12 bytes
TYPE EMRSETCOLORSPACE DWORD
 emr AS EMR
 ihCS AS DWORD ' ColorSpace handle index
END TYPE
MACRO EMRSELECTCOLORSPACE = EMRSETCOLORSPACE
MACRO EMRDELETECOLORSPACE = EMRSETCOLORSPACE
'#endif /* WINVER >= 0x0400 */
'#if(WINVER >= 0x0500)
' // Size = 20 bytes
TYPE EMREXTESCAPE DWORD
 emr AS EMR
 iEscape AS LONG ' // Escape code
 cbEscData AS LONG ' // Size of escape data
 EscData(0) AS BYTE ' // Escape data
END TYPE
' // Size = 20 bytes
TYPE EMRDRAWESCAPE DWORD
 emr AS EMR
 iEscape AS LONG ' // Escape code
 cbEscData AS LONG ' // Size of escape data
 EscData(0) AS BYTE ' // Escape data
END TYPE
' // Size = 24 bytes
TYPE EMRNAMEDESCAPE DWORD
 emr AS EMR
 iEscape AS LONG ' // Escape code
 cbDriver AS LONG ' // Size of driver name
 cbEscData AS LONG ' // Size of escape data
 EscData(0) AS BYTE ' // Driver name and Escape data
END TYPE
%EQUATE `SETICMPROFILE_EMBEDED = &H00000001
' // Size = 24 bytes
TYPE EMRSETICMPROFILEA DWORD
 emr AS EMR
 dwFlags AS DWORD ' flags
 cbName AS DWORD ' Size of desired profile name
 cbData AS DWORD ' Size of raw profile data if attached
 Data(0) AS BYTE ' BYTE Data[1] // Array size is cbName + cbData
END TYPE
MACRO EMRSETICMPROFILEW = EMRSETICMPROFILEA
MACRO EMRSETICMPROFILE = EMRSETICMPROFILEA
%EQUATE `CREATECOLORSPACE_EMBEDED = &H00000001
' // Size = 612 bytes
TYPE EMRCREATECOLORSPACEW DWORD
 emr AS EMR
 ihCS AS DWORD ' // ColorSpace handle index
 lcs AS LOGCOLORSPACEW ' // Unicode version of logical color space structure
 dwFlags AS DWORD ' // flags
 cbData AS DWORD ' // size of raw source profile data if attached
 Data(0) AS BYTE ' BYTE Data[1] // Array size is cbData
END TYPE
%EQUATE `COLORMATCHTOTARGET_EMBEDED = &H00000001
' // Size = 28 bytes
TYPE EMRCOLORMATCHTOTARGET DWORD
 emr AS EMR
 dwAction AS DWORD ' // CS_ENABLE, CS_DISABLE or CS_DELETE_TRANSFORM
 dwFlags AS DWORD ' // flags
 cbName AS DWORD ' // Size of desired target profile name
 cbData AS DWORD ' // Size of raw target profile data if attached
 Data(0) AS BYTE ' BYTE Data[1] // Array size is cbName + cbData
END TYPE
' // Size = 24 bytes
TYPE EMRCOLORCORRECTPALETTE DWORD
 emr AS EMR
 ihPalette AS DWORD ' // Palette handle index
 nFirstEntry AS DWORD ' // Index of first entry to correct
 nPalEntries AS DWORD ' // Number of palette entries to correct
 nReserved AS DWORD ' // Reserved
END TYPE
' // Size = 108 bytes
TYPE EMRALPHABLEND DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 xDest AS LONG
 yDest AS LONG
 cxDest AS LONG
 cyDest AS LONG
 dwRop AS DWORD
 xSrc AS LONG
 ySrc AS LONG
 xformSrc AS XFORM ' Source DC transform
 crBkColorSrc AS DWORD ' Source DC BkColor in RGB
 iUsageSrc AS DWORD ' Source bitmap info color table usage (%DIB_RGB_COLORS)
 offBmiSrc AS DWORD ' Offset to the source BITMAPINFO structure
 cbBmiSrc AS DWORD ' Size of the source BITMAPINFO structure
 offBitsSrc AS DWORD ' Offset to the source bitmap bits
 cbBitsSrc AS DWORD ' Size of the source bitmap bits
 cxSrc AS LONG
 cySrc AS LONG
END TYPE
' // Size = 52 bytes
TYPE EMRGRADIENTFILL DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 nVer AS DWORD
 nTri AS DWORD
 ulMode AS DWORD
 Ver(0) AS TRIVERTEX ' TRIVERTEX Ver[1]
END TYPE
' // Size = 108 bytes
TYPE EMRTRANSPARENTBLT DWORD
 emr AS EMR
 rclBounds AS RECTL ' Inclusive-inclusive bounds in device units
 xDest AS LONG
 yDest AS LONG
 cxDest AS LONG
 cyDest AS LONG
 dwRop AS DWORD
 xSrc AS LONG
 ySrc AS LONG
 xformSrc AS XFORM ' Source DC transform
 crBkColorSrc AS DWORD ' COLORREF // Source DC BkColor in RGB
 iUsageSrc AS DWORD ' Source bitmap info color table usage (%DIB_RGB_COLORS)
 offBmiSrc AS DWORD ' Offset to the source BITMAPINFO structure
 cbBmiSrc AS DWORD ' Size of the source BITMAPINFO structure
 offBitsSrc AS DWORD ' Offset to the source bitmap bits
 cbBitsSrc AS DWORD ' Size of the source bitmap bits
 cxSrc AS LONG
 cySrc AS LONG
END TYPE
'#endif /* WINVER >= 0x0500 */
%EQUATE `GDICOMMENT_IDENTIFIER = &H43494447
%EQUATE `GDICOMMENT_WINDOWS_METAFILE = &H80000001
%EQUATE `GDICOMMENT_BEGINGROUP = &H00000002
%EQUATE `GDICOMMENT_ENDGROUP = &H00000003
%EQUATE `GDICOMMENT_MULTIFORMATS = &H40000004
%EQUATE `EPS_SIGNATURE = &H46535045
%EQUATE `GDICOMMENT_UNICODE_STRING = &H00000040
%EQUATE `GDICOMMENT_UNICODE_END = &H00000080
'#endif /* NOMETAFILE */
#ENDIF ' #IF NOT %DEF(%NOMETAFILE) ------------------------------------------
'// OpenGL wgl prototypes
DECLARE FUNCTION wglCopyContext LIB "opengl32.dll" ALIAS "wglCopyContext" ( BYVAL hglrcSrc AS QUAD , BYVAL hglrcDst AS QUAD , BYVAL mask AS QUAD ) AS LONG
DECLARE FUNCTION wglCreateContext LIB "opengl32.dll" ALIAS "wglCreateContext" ( BYVAL hdc AS QUAD
 ) AS DWORD ' HGLRC
DECLARE FUNCTION wglCreateLayerContext LIB "opengl32.dll" ALIAS "wglCreateLayerContext" ( BYVAL hdc AS QUAD , BYVAL iLayerPlane AS LONG ) AS QUAD ' HGLRC
DECLARE FUNCTION wglDeleteContext LIB "opengl32.dll" ALIAS "wglDeleteContext" ( BYVAL hglrc AS QUAD ) AS LONG
DECLARE FUNCTION wglGetCurrentContext LIB "opengl32.dll" ALIAS "wglGetCurrentContext" ( ) AS QUAD ' HGLRC
DECLARE FUNCTION wglGetCurrentDC LIB "opengl32.dll" ALIAS "wglGetCurrentDC" ( ) AS QUAD ' HDC
DECLARE FUNCTION wglGetProcAddress LIB "opengl32.dll" ALIAS "wglGetProcAddress" ( BYREF lpszProc AS ASCIIZ ) AS QUAD
DECLARE FUNCTION wglMakeCurrent LIB "opengl32.dll" ALIAS "wglMakeCurrent" ( BYVAL hdc AS QUAD
 , BYVAL hglrc AS DWORD
 ) AS LONG
DECLARE FUNCTION wglShareLists LIB "opengl32.dll" ALIAS "wglShareLists" ( BYVAL hglrc1 AS DWORD ' HGLRC hglrc1
 , BYVAL hglrc2 AS DWORD ' HGLRC hglrc2
 ) AS LONG
DECLARE FUNCTION wglUseFontBitmapsA LIB "opengl32.dll" ALIAS "wglUseFontBitmapsA" ( BYVAL hdc AS DWORD
 , BYVAL dFirst AS DWORD
 , BYVAL dCount AS DWORD
 , BYVAL dListBase AS DWORD
 ) AS LONG
DECLARE FUNCTION wglUseFontBitmapsW LIB "opengl32.dll" ALIAS "wglUseFontBitmapsW" ( BYVAL hdc AS DWORD
 , BYVAL dFirst AS DWORD
 , BYVAL dCount AS DWORD
 , BYVAL dListBase AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO wglUseFontBitmaps = wglUseFontBitmapsW
#ELSE
 MACRO wglUseFontBitmaps = wglUseFontBitmapsA
#ENDIF
' ** NOTE ** Microsoft incorrectly documents SwapBuffers as being in OPENGL32.DLL
DECLARE FUNCTION SwapBuffers LIB "gdi32.dll" ALIAS "SwapBuffers" ( BYVAL hdc AS QUAD ) AS LONG
' // Size = 8 bytes
TYPE POINTFLOAT DWORD
 x AS SINGLE
 y AS SINGLE
END TYPE
' // Size = 24 bytes
TYPE GLYPHMETRICSFLOAT DWORD
 gmfBlackBoxX AS SINGLE
 gmfBlackBoxY AS SINGLE
 gmfptGlyphOrigin AS POINTFLOAT
 gmfCellIncX AS SINGLE
 gmfCellIncY AS SINGLE
END TYPE
%EQUATE `WGL_FONT_LINES = 0
%EQUATE `WGL_FONT_POLYGONS = 1
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION wglUseFontOutlinesA LIB "OPENGL32.dll" ALIAS "wglUseFontOutlinesA" (BYVAL hdc AS QUAD, BYVAL dFirst AS QUAD, BYVAL dCount AS QUAD, BYVAL dListBase AS QUAD, BYVAL deviation AS SINGLE, BYVAL extrusion AS SINGLE, BYVAL iFormat AS LONG, BYVAL lpgmf AS QUAD) AS LONG
#ELSE
DECLARE FUNCTION wglUseFontOutlinesA LIB "opengl32.dll" ALIAS "wglUseFontOutlinesA" ( BYVAL hdc AS QUAD , BYVAL dFirst AS QUAD , BYVAL dCount AS QUAD , BYVAL dListBase AS QUAD , BYVAL deviation AS SINGLE , BYVAL extrusion AS SINGLE , BYVAL iFormat AS LONG , BYREF lpgmf AS GLYPHMETRICSFLOAT ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION wglUseFontOutlinesW LIB "OPENGL32.dll" ALIAS "wglUseFontOutlinesW" (BYVAL hdc AS QUAD, BYVAL dFirst AS QUAD, BYVAL dCount AS QUAD, BYVAL dListBase AS QUAD, BYVAL deviation AS SINGLE, BYVAL extrusion AS SINGLE, BYVAL iFormat AS LONG, BYVAL lpgmf AS QUAD) AS LONG
#ELSE
DECLARE FUNCTION wglUseFontOutlinesW LIB "opengl32.dll" ALIAS "wglUseFontOutlinesW" ( BYVAL hdc AS QUAD , BYVAL dFirst AS QUAD , BYVAL dCount AS QUAD , BYVAL dListBase AS QUAD , BYVAL deviation AS SINGLE , BYVAL extrusion AS SINGLE , BYVAL iFormat AS LONG , BYREF lpgmf AS GLYPHMETRICSFLOAT ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO wglUseFontOutlines = wglUseFontOutlinesW
#ELSE
 MACRO wglUseFontOutlines = wglUseFontOutlinesA
#ENDIF
'/* Layer plane descriptor */
' // Size = 32 bytes
TYPE LAYERPLANEDESCRIPTOR DWORD FILL
 nSize AS WORD
 nVersion AS WORD
 dwFlags AS DWORD
 iPixelType AS BYTE
 cColorBits AS BYTE
 cRedBits AS BYTE
 cRedShift AS BYTE
 cGreenBits AS BYTE
 cGreenShift AS BYTE
 cBlueBits AS BYTE
 cBlueShift AS BYTE
 cAlphaBits AS BYTE
 cAlphaShift AS BYTE
 cAccumBits AS BYTE
 cAccumRedBits AS BYTE
 cAccumGreenBits AS BYTE
 cAccumBlueBits AS BYTE
 cAccumAlphaBits AS BYTE
 cDepthBits AS BYTE
 cStencilBits AS BYTE
 cAuxBuffers AS BYTE
 iLayerPlane AS BYTE
 bReserved AS BYTE
 crTransparent AS DWORD
END TYPE
'/* LAYERPLANEDESCRIPTOR flags */
%EQUATE `LPD_DOUBLEBUFFER = &H00000001
%EQUATE `LPD_STEREO = &H00000002
%EQUATE `LPD_SUPPORT_GDI = &H00000010
%EQUATE `LPD_SUPPORT_OPENGL = &H00000020
%EQUATE `LPD_SHARE_DEPTH = &H00000040
%EQUATE `LPD_SHARE_STENCIL = &H00000080
%EQUATE `LPD_SHARE_ACCUM = &H00000100
%EQUATE `LPD_SWAP_EXCHANGE = &H00000200
%EQUATE `LPD_SWAP_COPY = &H00000400
%EQUATE `LPD_TRANSPARENT = &H00001000
'#define LPD_TYPE_RGBA 0
'#define LPD_TYPE_COLORINDEX 1
%EQUATE `LPD_TYPE_RGBA = 0
%EQUATE `LPD_TYPE_COLORINDEX = 1
'/* wglSwapLayerBuffers flags */
%EQUATE `WGL_SWAP_MAIN_PLANE = &H00000001
%EQUATE `WGL_SWAP_OVERLAY1 = &H00000002
%EQUATE `WGL_SWAP_OVERLAY2 = &H00000004
%EQUATE `WGL_SWAP_OVERLAY3 = &H00000008
%EQUATE `WGL_SWAP_OVERLAY4 = &H00000010
%EQUATE `WGL_SWAP_OVERLAY5 = &H00000020
%EQUATE `WGL_SWAP_OVERLAY6 = &H00000040
%EQUATE `WGL_SWAP_OVERLAY7 = &H00000080
%EQUATE `WGL_SWAP_OVERLAY8 = &H00000100
%EQUATE `WGL_SWAP_OVERLAY9 = &H00000200
%EQUATE `WGL_SWAP_OVERLAY10 = &H00000400
%EQUATE `WGL_SWAP_OVERLAY11 = &H00000800
%EQUATE `WGL_SWAP_OVERLAY12 = &H00001000
%EQUATE `WGL_SWAP_OVERLAY13 = &H00002000
%EQUATE `WGL_SWAP_OVERLAY14 = &H00004000
%EQUATE `WGL_SWAP_OVERLAY15 = &H00008000
%EQUATE `WGL_SWAP_UNDERLAY1 = &H00010000
%EQUATE `WGL_SWAP_UNDERLAY2 = &H00020000
%EQUATE `WGL_SWAP_UNDERLAY3 = &H00040000
%EQUATE `WGL_SWAP_UNDERLAY4 = &H00080000
%EQUATE `WGL_SWAP_UNDERLAY5 = &H00100000
%EQUATE `WGL_SWAP_UNDERLAY6 = &H00200000
%EQUATE `WGL_SWAP_UNDERLAY7 = &H00400000
%EQUATE `WGL_SWAP_UNDERLAY8 = &H00800000
%EQUATE `WGL_SWAP_UNDERLAY9 = &H01000000
%EQUATE `WGL_SWAP_UNDERLAY10 = &H02000000
%EQUATE `WGL_SWAP_UNDERLAY11 = &H04000000
%EQUATE `WGL_SWAP_UNDERLAY12 = &H08000000
%EQUATE `WGL_SWAP_UNDERLAY13 = &H10000000
%EQUATE `WGL_SWAP_UNDERLAY14 = &H20000000
%EQUATE `WGL_SWAP_UNDERLAY15 = &H40000000
DECLARE FUNCTION wglDescribeLayerPlane LIB "opengl32.dll" ALIAS "wglDescribeLayerPlane" ( BYVAL hdc AS QUAD , BYVAL iPixelFormat AS LONG , BYVAL iLayerPlane AS LONG , BYVAL nBytes AS QUAD , BYREF plpd As LAYERPLANEDESCRIPTOR ) AS LONG
DECLARE FUNCTION wglSetLayerPaletteEntries LIB "opengl32.dll" ALIAS "wglSetLayerPaletteEntries" ( BYVAL hdc AS QUAD
 , BYVAL iLayerPlane AS LONG
 , BYVAL iStart AS LONG
 , BYVAL cEntries AS LONG
 , BYREF pcr AS DWORD
 ) AS LONG ' int
DECLARE FUNCTION wglGetLayerPaletteEntries LIB "opengl32.dll" ALIAS "wglGetLayerPaletteEntries" ( BYVAL hdc AS QUAD , BYVAL iLayerPlane AS LONG , BYVAL iStart AS LONG , BYVAL cEntries AS LONG , BYREF pcr AS QUAD ) AS LONG ' int
DECLARE FUNCTION wglRealizeLayerPalette LIB "opengl32.dll" ALIAS "wglRealizeLayerPalette" ( BYVAL hdc AS QUAD , BYVAL iLayerPlane AS LONG , BYVAL fRealize AS LONG ) AS LONG
DECLARE FUNCTION wglSwapLayerBuffers LIB "opengl32.dll" ALIAS "wglSwapLayerBuffers" ( BYVAL hdc AS QUAD
 , BYVAL dfPlanes AS DWORD
 ) AS LONG
'#if (WINVER >= 0x0500)
' // Size = 8 bytes
TYPE WGLSWAP DWORD
 hdc AS DWORD ' HDC
 uiFlags AS DWORD ' UINT
END TYPE
%EQUATE `WGL_SWAPMULTIPLE_MAX = 16
' Undocumented.
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION wglSwapMultipleBuffers LIB "OPENGL32.dll" ALIAS "wglSwapMultipleBuffers" (BYVAL u AS QUAD, BYVAL wglswapptr AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION wglSwapMultipleBuffers LIB "opengl32.dll" ALIAS "wglSwapMultipleBuffers" ( BYVAL DWORD , BYREF WGLSWAP ) AS QUAD
#ENDIF
'#endif // (WINVER >= 0x0500)
'#endif /* NOGDI */
'#ENDIF ' #IF NOT %DEF(%NOGDI) -----------------------------------------------
#ENDIF
