C
C  WINDOWS.FD -
C
C Author       : Kevin B Black
C Date written : 12 Oct 1991
C Abstract     :
C
C INCLUDE FILE FOR FORTRAN WINDOWS 3.0 APPLICATIONS
C
C  General Purpose Defines
C

      INTEGER*2 NULL,FALSE,TRUE
      PARAMETER (NULL=      0)
      PARAMETER (FALSE=     0)
      PARAMETER (TRUE=      1)
      CHARACTER*(*) NULLSTR [C]
      PARAMETER (NULLSTR=CHAR(0))

$IF .NOT.DEFINED(WIN_INTERNAL)
      STRUCTURE /RECT/
	 INTEGER*2 LEFT
	 INTEGER*2 TOP
	 INTEGER*2 RIGHT
	 INTEGER*2 BOTTOM
      END STRUCTURE
$ENDIF

      STRUCTURE /POINT/
	 INTEGER*2 X
	 INTEGER*2 Y
      END STRUCTURE

C
C  KERNEL Section
C

$IF DEFINED(KERNEL)

C
C Loader Routines
C
      INTEGER*2 GetVersion [EXTERN]
      INTEGER*2 GetNumTasks [EXTERN]
      INTEGER*2 GetCodeHandle [EXTERN]
      INTEGER*2 GetModuleHandle [EXTERN]
      INTEGER*2 GetModuleUsage [EXTERN]
      INTEGER*2 GetModuleFileName [EXTERN]
      INTEGER*2 GetInstanceData [EXTERN]
      INTEGER*4 GetProcAddress [EXTERN]
      INTEGER*4 MakeProcInstance [EXTERN]
      INTEGER*2 LoadLibrary [EXTERN]
      INTEGER*2 LoadModule [EXTERN]
      INTEGER*2 FreeModule [EXTERN]
      INTEGER*4 GetFreeSpace [EXTERN]
      INTEGER*2 WinExec [EXTERN]
      INTEGER*2 GetCurrentPDB [EXTERN]

$IF DEFINED(OPENFILE)

C
C OpenFile() Structure
C

      STRUCTURE /OFSTRUCT/
	 BYTE cBytes
	 BYTE fFixedDisk
	 INTEGER*2 nErrCode
	 BYTE reserved(4)
	 CHARACTER*128 szPathName
      END STRUCTURE

C
C OpenFile() Flags
C
      INTEGER*2 OF_READ
      PARAMETER (OF_READ =          #0000)
      INTEGER*2 OF_WRITE
      PARAMETER (OF_WRITE=          #0001)
      INTEGER*2 OF_READWRITE
      PARAMETER (OF_READWRITE=      #0002)
      INTEGER*2 OF_SHARE_COMPAT
      PARAMETER (OF_SHARE_COMPAT=   #0000)
      INTEGER*2 OF_SHARE_EXCLUSIVE
      PARAMETER (OF_SHARE_EXCLUSIVE=#0010)
      INTEGER*2 OF_SHARE_DENY_WRITE
      PARAMETER (OF_SHARE_DENY_WRITE=#0020)
      INTEGER*2 OF_SHARE_DENY_READ
      PARAMETER (OF_SHARE_DENY_READ= #0030)
      INTEGER*2 OF_SHARE_DENY_NONE
      PARAMETER (OF_SHARE_DENY_NONE= #0040)
      INTEGER*2 OF_PARSE
      PARAMETER (OF_PARSE=          #0100)
      INTEGER*2 OF_DELETE
      PARAMETER (OF_DELETE=         #0200)
      INTEGER*2 OF_VERIFY
      PARAMETER (OF_VERIFY=         #0400)
      INTEGER*2 OF_CANCEL
      PARAMETER (OF_CANCEL=         #0800)
      INTEGER*2 OF_CREATE
      PARAMETER (OF_CREATE=         #1000)
      INTEGER*2 OF_PROMPT
      PARAMETER (OF_PROMPT=         #2000)
      INTEGER*2 OF_EXIST
      PARAMETER (OF_EXIST=          #4000)
      INTEGER*2 OF_REOPEN
      PARAMETER (OF_REOPEN=         #8000)

C
C GetTempFileName() Flags
C

      BYTE TF_FORCEDRIVE
      PARAMETER (TF_FORCEDRIVE=#80)

      BYTE GetTempDrive [EXTERN]
      INTEGER*2 GetTempFileName [EXTERN]
      INTEGER*2 SetHandleCount [EXTERN]
      INTEGER*2 GetDriveType [EXTERN]

C
C GetDriveType return values
C
      INTEGER*2 DRIVE_REMOVABLE
      PARAMETER (DRIVE_REMOVABLE=2)
      INTEGER*2 DRIVE_FIXED
      PARAMETER (DRIVE_FIXED=    3)
      INTEGER*2 DRIVE_REMOTE
      PARAMETER (DRIVE_REMOTE=   4)

C
C OpenFile function
C
      INTEGER*2 OpenFile [EXTERN]

$ENDIF ! NOOPENFILE

$IF DEFINED(MEMMGR)

C
C Global Memory Flags
C

      INTEGER*2 GMEM_FIXED
      PARAMETER (GMEM_FIXED=        #0000)
      INTEGER*2 GMEM_MOVEABLE
      PARAMETER (GMEM_MOVEABLE=     #0002)
      INTEGER*2 GMEM_NOCOMPACT
      PARAMETER (GMEM_NOCOMPACT=    #0010)
      INTEGER*2 GMEM_NODISCARD
      PARAMETER (GMEM_NODISCARD=    #0020)
      INTEGER*2 GMEM_ZEROINIT
      PARAMETER (GMEM_ZEROINIT=     #0040)
      INTEGER*2 GMEM_MODIFY
      PARAMETER (GMEM_MODIFY=       #0080)
      INTEGER*2 GMEM_DISCARDABLE
      PARAMETER (GMEM_DISCARDABLE=  #0100)
      INTEGER*2 GMEM_NOT_BANKED
      PARAMETER (GMEM_NOT_BANKED=   #1000)
      INTEGER*2 GMEM_SHARE
      PARAMETER (GMEM_SHARE=        #2000)
      INTEGER*2 GMEM_DDESHARE
      PARAMETER (GMEM_DDESHARE=     #2000)
      INTEGER*2 GMEM_NOTIFY
      PARAMETER (GMEM_NOTIFY=       #4000)
      INTEGER*2 GMEM_LOWER
      PARAMETER (GMEM_LOWER=        GMEM_NOT_BANKED)

      INTEGER*2 GHND
      PARAMETER (GHND=GMEM_MOVEABLE.OR.GMEM_ZEROINIT)
      INTEGER*2 GPTR
      PARAMETER (GPTR=GMEM_FIXED.OR.GMEM_ZEROINIT)


      INTEGER*2 GlobalAlloc [EXTERN]
      INTEGER*4 GlobalCompact [EXTERN]
      INTEGER*2 GlobalDiscard [EXTERN]
      INTEGER*2 GlobalFlags [EXTERN]
      INTEGER*2 GlobalFree [EXTERN]
      INTEGER*4 GlobalHandle [EXTERN]
      CHARACTER*(*) GlobalLock [EXTERN]
      INTEGER*2 GlobalLRUNewest [EXTERN]
      INTEGER*2 GlobalLRUOldest [EXTERN]
      INTEGER*2 GlobalPageLock [EXTERN]
      INTEGER*2 GlobalPageUnlock [EXTERN]
      INTEGER*2 GlobalReAlloc [EXTERN]
      INTEGER*4 GlobalSize [EXTERN]
      INTEGER*2 GlobalUnfix [EXTERN]
      INTEGER*2 GlobalUnlock [EXTERN]
      INTEGER*2 GlobalUnWire [EXTERN]
      CHARACTER*(*) GlobalWire [EXTERN]

C
C Flags returned by GlobalFlags (in addition to GMEM_DISCARDABLE)
C
      INTEGER*2 GMEM_DISCARDED
      PARAMETER (GMEM_DISCARDED=    #4000)
      INTEGER*2 GMEM_LOCKCOUNT
      PARAMETER (GMEM_LOCKCOUNT=    #00FF)

      INTEGER*2 LockData [EXTERN]
      INTEGER*2 UnlockData [EXTERN]
      INTEGER*2 LockSegment [EXTERN]
      INTEGER*2 UnlockSegment [EXTERN]

C
C Local Memory Flags
C
      INTEGER*2 LMEM_FIXED
      PARAMETER (LMEM_FIXED=        #0000)
      INTEGER*2 LMEM_MOVEABLE
      PARAMETER (LMEM_MOVEABLE=     #0002)
      INTEGER*2 LMEM_NOCOMPACT
      PARAMETER (LMEM_NOCOMPACT=    #0010)
      INTEGER*2 LMEM_NODISCARD
      PARAMETER (LMEM_NODISCARD=    #0020)
      INTEGER*2 LMEM_ZEROINIT
      PARAMETER (LMEM_ZEROINIT=     #0040)
      INTEGER*2 LMEM_MODIFY
      PARAMETER (LMEM_MODIFY=       #0080)
      INTEGER*2 LMEM_DISCARDABLE
      PARAMETER (LMEM_DISCARDABLE=  #0F00)

      INTEGER*2 LHND
      PARAMETER (LHND=LMEM_MOVEABLE.OR.LMEM_ZEROINIT)
      INTEGER*2 LPTR
      PARAMETER (LPTR=LMEM_FIXED.OR.LMEM_ZEROINIT)

      INTEGER*2 NONZEROLHND
      PARAMETER (NONZEROLHND=LMEM_MOVEABLE)
      INTEGER*2 NONZEROLPTR
      PARAMETER (NONZEROLPTR=LMEM_FIXED)

      INTEGER*2 LNOTIFY_OUTOFMEM
      PARAMETER (LNOTIFY_OUTOFMEM=    0)
      INTEGER*2 LNOTIFY_MOVE
      PARAMETER (LNOTIFY_MOVE=        1)
      INTEGER*2 LNOTIFY_DISCARD
      PARAMETER (LNOTIFY_DISCARD=     2)

C
C Flags returned by LocalFlags (in addition to LMEM_DISCARDABLE)
C
      INTEGER*2 LMEM_DISCARDED
      PARAMETER (LMEM_DISCARDED=#4000)
      INTEGER*2 LMEM_LOCKCOUNT
      PARAMETER (LMEM_LOCKCOUNT=#00FF)

      INTEGER*2 LocalAlloc [EXTERN]
      INTEGER*2 LocalCompact [EXTERN]
      INTEGER*2 LocalDiscard [EXTERN]
      INTEGER*2 LocalFree [EXTERN]
      INTEGER*2 LocalFlags [EXTERN]
      INTEGER*2 LocalHandle [EXTERN]
      INTEGER*2 LocalInit [EXTERN]
      CHARACTER*(*) LocalLock [EXTERN]
      INTEGER*4 LocalNotify [EXTERN]
      INTEGER*2 LocalReAlloc [EXTERN]
      INTEGER*2 LocalShrink [EXTERN]
      INTEGER*2 LocalSize [EXTERN]
      INTEGER*2 LocalUnlock [EXTERN]

$ENDIF ! NOMEMMGR

      INTEGER*4 SetSwapAreaSize [EXTERN]
      INTEGER*4 ValidateFreeSpaces [EXTERN]
      INTEGER*2 SetErrorMode [EXTERN]

      INTEGER*4 GetDOSEnvironment [EXTERN]

      INTEGER*2 AllocDStoCSAlias [EXTERN]
      INTEGER*2 AllocSelector [EXTERN]
      INTEGER*2 ChangeSelector [EXTERN]
      INTEGER*2 FreeSelector [EXTERN]

      INTEGER*2 UnlockResource [EXTERN]

      INTEGER*2 FindResource [EXTERN]
      INTEGER*2 LoadResource [EXTERN]
      INTEGER*2 FreeResource [EXTERN]
      INTEGER*4 LockResource [EXTERN]
      INTEGER*4 SetResourceHandler [EXTERN]
      INTEGER*2 AllocResource [EXTERN]
      INTEGER*2 SizeofResource [EXTERN]
      INTEGER*2 AccessResource [EXTERN]

!#define MAKEINTRESOURCE(i)  (LPSTR)((DWORD)((WORD)(i)))

$IF DEFINED(RESOURCE)

C
C Predefined Resource Types. NOTE The following were defined in the WINDOWS.H
C file as follows :
C
!#define MAKEINTRESOURCE(i)  (LPSTR)((DWORD)((WORD)(i)))
!#define RT_CURSOR          MAKEINTRESOURCE(1)
C
      INTEGER*4 RT_CURSOR
      PARAMETER (RT_CURSOR=1)
      INTEGER*4 RT_BITMAP
      PARAMETER (RT_BITMAP=2)
      INTEGER*4 RT_ICON
      PARAMETER (RT_ICON=3)
      INTEGER*4 RT_MENU
      PARAMETER (RT_MENU=4)
      INTEGER*4 RT_DIALOG
      PARAMETER (RT_DIALOG=5)
      INTEGER*4 RT_STRING
      PARAMETER (RT_STRING=6)
      INTEGER*4 RT_FONTDIR
      PARAMETER (RT_FONTDIR=7)
      INTEGER*4 RT_FONT
      PARAMETER (RT_FONT=8)
      INTEGER*4 RT_ACCELERATOR
      PARAMETER (RT_ACCELERATOR=9)
      INTEGER*4 RT_RCDATA
      PARAMETER (RT_RCDATA=10)

$ENDIF ! NORESOURCE

      INTEGER*2 GetCurrentTask [EXTERN]

$IF DEFINED(ATOM)
!typedef WORD               ATOM;

!%#define MAKEINTATOM(i)            (LPSTR)((DWORD)((WORD)(i)))

      INTEGER*2 InitAtomTable [EXTERN]
      INTEGER*2 AddAtom [EXTERN]
      INTEGER*2 DeleteAtom [EXTERN]
      INTEGER*2 FindAtom [EXTERN]
      INTEGER*2 GetAtomName [EXTERN]
      INTEGER*2 GlobalAddAtom [EXTERN]
      INTEGER*2 GlobalDeleteAtom [EXTERN]
      INTEGER*2 GlobalFindAtom [EXTERN]
      INTEGER*2 GlobalGetAtomName [EXTERN]
      INTEGER*2 GetAtomHandle [EXTERN]

$ENDIF ! NOATOM

C
C User Profile Routines
C
      INTEGER*2 GetProfileInt [EXTERN]
      INTEGER*2 GetProfileString [EXTERN]
      INTEGER*2 WriteProfileString [EXTERN]
      INTEGER*2 GetPrivateProfileInt [EXTERN]
      INTEGER*2 GetPrivateProfileString [EXTERN]
      INTEGER*2 WritePrivateProfileString [EXTERN]

      INTEGER*2 GetWindowsDirectory [EXTERN]
      INTEGER*2 GetSystemDirectory [EXTERN]

C
C Catch()
C
      INTEGER*2 Catch [EXTERN]
C
C Character Translation Routines
C
      INTEGER*2 AnsiToOem [EXTERN]
      INTEGER*2 OemToAnsi [EXTERN]
      INTEGER*4 AnsiUpper [EXTERN]
      INTEGER*2 AnsiUpperBuff [EXTERN]
      INTEGER*4 AnsiLower [EXTERN]
      INTEGER*2 AnsiLowerBuff [EXTERN]
      INTEGER*4 AnsiNext [EXTERN]
      INTEGER*4 AnsiPrev [EXTERN]
C
C Keyboard Information Routines
C
$IF DEFINED(KEYBOARDINFO)
      INTEGER*2 OemKeyScan [EXTERN]
      INTEGER*2 VkKeyScan [EXTERN]
      INTEGER*2 GetKeyboardType [EXTERN]
      INTEGER*2 MapVirtualKey [EXTERN]
      INTEGER*2 GetKBCodePage [EXTERN]
      INTEGER*2 GetKeyNameText [EXTERN]
      INTEGER*2 ToAscii [EXTERN]
$ENDIF

$IF DEFINED(LANGUAGE)
C
C Language dependent Routines
C
!%BOOL  FAR  PASCAL IsCharAlpha(char);
!%BOOL  FAR  PASCAL IsCharAlphaNumeric(char);
!%BOOL  FAR  PASCAL IsCharUpper(char);
!%BOOL  FAR  PASCAL IsCharLower(char);
$ENDIF

      INTEGER*4 GetWinFlags [EXTERN]

C
C Windows info flags
C
      INTEGER*2 WF_PMODE
      PARAMETER (WF_PMODE=      #0001)
      INTEGER*2 WF_CPU286
      PARAMETER (WF_CPU286=     #0002)
      INTEGER*2 WF_CPU386
      PARAMETER (WF_CPU386=     #0004)
      INTEGER*2 WF_CPU486
      PARAMETER (WF_CPU486=     #0008)
      INTEGER*2 WF_STANDARD
      PARAMETER (WF_STANDARD=   #0010)
      INTEGER*2 WF_WIN286
      PARAMETER (WF_WIN286=     #0010)
      INTEGER*2 WF_ENHANCED
      PARAMETER (WF_ENHANCED=   #0020)
      INTEGER*2 WF_WIN386
      PARAMETER (WF_WIN386=     #0020)
      INTEGER*2 WF_CPU086
      PARAMETER (WF_CPU086=     #0040)
      INTEGER*2 WF_CPU186
      PARAMETER (WF_CPU186=     #0080)
      INTEGER*2 WF_LARGEFRAME
      PARAMETER (WF_LARGEFRAME= #0100)
      INTEGER*2 WF_SMALLFRAME
      PARAMETER (WF_SMALLFRAME= #0200)
      INTEGER*2 WF_80x87
      PARAMETER (WF_80x87=      #0400)

C
C WEP fSystemExit flag values
C
      INTEGER*2 WEP_SYSTEM_EXIT
      PARAMETER (WEP_SYSTEM_EXIT=1)
      INTEGER*2 WEP_FREE_DLL
      PARAMETER (WEP_FREE_DLL=   0)

$IF DEFINED(OEMRESOURCE)

C
C OEM Resource Ordinal Numbers
C
      INTEGER*2 OBM_CLOSE
      PARAMETER (OBM_CLOSE=           32754)
      INTEGER*2 OBM_UPARROW
      PARAMETER (OBM_UPARROW=         32753)
      INTEGER*2 OBM_DNARROW
      PARAMETER (OBM_DNARROW=         32752)
      INTEGER*2 OBM_RGARROW
      PARAMETER (OBM_RGARROW=         32751)
      INTEGER*2 OBM_LFARROW
      PARAMETER (OBM_LFARROW=         32750)
      INTEGER*2 OBM_REDUCE
      PARAMETER (OBM_REDUCE=          32749)
      INTEGER*2 OBM_ZOOM
      PARAMETER (OBM_ZOOM=            32748)
      INTEGER*2 OBM_RESTORE
      PARAMETER (OBM_RESTORE=         32747)
      INTEGER*2 OBM_REDUCED
      PARAMETER (OBM_REDUCED=         32746)
      INTEGER*2 OBM_ZOOMD
      PARAMETER (OBM_ZOOMD=           32745)
      INTEGER*2 OBM_RESTORED
      PARAMETER (OBM_RESTORED=        32744)
      INTEGER*2 OBM_UPARROWD
      PARAMETER (OBM_UPARROWD=        32743)
      INTEGER*2 OBM_DNARROWD
      PARAMETER (OBM_DNARROWD=        32742)
      INTEGER*2 OBM_RGARROWD
      PARAMETER (OBM_RGARROWD=        32741)
      INTEGER*2 OBM_LFARROWD
      PARAMETER (OBM_LFARROWD=        32740)
      INTEGER*2 OBM_MNARROW
      PARAMETER (OBM_MNARROW=         32739)
      INTEGER*2 OBM_COMBO
      PARAMETER (OBM_COMBO=           32738)

      INTEGER*2 OBM_OLD_CLOSE
      PARAMETER (OBM_OLD_CLOSE=       32767)
      INTEGER*2 OBM_SIZE
      PARAMETER (OBM_SIZE=            32766)
      INTEGER*2 OBM_OLD_UPARROW
      PARAMETER (OBM_OLD_UPARROW=     32765)
      INTEGER*2 OBM_OLD_DNARROW
      PARAMETER (OBM_OLD_DNARROW=     32764)
      INTEGER*2 OBM_OLD_RGARROW
      PARAMETER (OBM_OLD_RGARROW=     32763)
      INTEGER*2 OBM_OLD_LFARROW
      PARAMETER (OBM_OLD_LFARROW=     32762)
      INTEGER*2 OBM_BTSIZE
      PARAMETER (OBM_BTSIZE=          32761)
      INTEGER*2 OBM_CHECK
      PARAMETER (OBM_CHECK=           32760)
      INTEGER*2 OBM_CHECKBOXES
      PARAMETER (OBM_CHECKBOXES=      32759)
      INTEGER*2 OBM_BTNCORNERS
      PARAMETER (OBM_BTNCORNERS=      32758)
      INTEGER*2 OBM_OLD_REDUCE
      PARAMETER (OBM_OLD_REDUCE=      32757)
      INTEGER*2 OBM_OLD_ZOOM
      PARAMETER (OBM_OLD_ZOOM=        32756)
      INTEGER*2 OBM_OLD_RESTORE
      PARAMETER (OBM_OLD_RESTORE=     32755)

      INTEGER*2 OCR_NORMAL
      PARAMETER (OCR_NORMAL=        32512)
      INTEGER*2 OCR_IBEAM
      PARAMETER (OCR_IBEAM=         32513)
      INTEGER*2 OCR_WAIT
      PARAMETER (OCR_WAIT=          32514)
      INTEGER*2 OCR_CROSS
      PARAMETER (OCR_CROSS=         32515)
      INTEGER*2 OCR_UP
      PARAMETER (OCR_UP=            32516)
      INTEGER*2 OCR_SIZE
      PARAMETER (OCR_SIZE=          32640)
      INTEGER*2 OCR_ICON
      PARAMETER (OCR_ICON=          32641)
      INTEGER*2 OCR_SIZENWSE
      PARAMETER (OCR_SIZENWSE=      32642)
      INTEGER*2 OCR_SIZENESW
      PARAMETER (OCR_SIZENESW=      32643)
      INTEGER*2 OCR_SIZEWE
      PARAMETER (OCR_SIZEWE=        32644)
      INTEGER*2 OCR_SIZENS
      PARAMETER (OCR_SIZENS=        32645)
      INTEGER*2 OCR_SIZEALL
      PARAMETER (OCR_SIZEALL=       32646)
      INTEGER*2 OCR_ICOCUR
      PARAMETER (OCR_ICOCUR=        32647)

      INTEGER*2 OIC_SAMPLE
      PARAMETER (OIC_SAMPLE=        32512)
      INTEGER*2 OIC_HAND
      PARAMETER (OIC_HAND=          32513)
      INTEGER*2 OIC_QUES
      PARAMETER (OIC_QUES=          32514)
      INTEGER*2 OIC_BANG
      PARAMETER (OIC_BANG=          32515)
      INTEGER*2 OIC_NOTE
      PARAMETER (OIC_NOTE=          32516)

$ENDIF ! OEMRESOURCE

$ENDIF ! NOKERNEL

C
C GDI Section
C

$IF DEFINED(GDI)

$IF DEFINED(RASTEROPS)

C
C Binary raster ops
C
      INTEGER*2 R2_BLACK                !  0
      PARAMETER (R2_BLACK=1)
      INTEGER*2 R2_NOTMERGEPEN          ! DPon
      PARAMETER (R2_NOTMERGEPEN=2)
      INTEGER*2 R2_MASKNOTPEN           ! DPna
      PARAMETER (R2_MASKNOTPEN=3)
      INTEGER*2 R2_NOTCOPYPEN           ! PN
      PARAMETER (R2_NOTCOPYPEN=4)
      INTEGER*2 R2_MASKPENNOT           ! PDna
      PARAMETER (R2_MASKPENNOT=5)
      INTEGER*2 R2_NOT                  ! Dn
      PARAMETER (R2_NOT=6)
      INTEGER*2 R2_XORPEN               ! DPx
      PARAMETER (R2_XORPEN=7)
      INTEGER*2 R2_NOTMASKPEN           ! DPan
      PARAMETER (R2_NOTMASKPEN=8)
      INTEGER*2 R2_MASKPEN              ! DPa
      PARAMETER (R2_MASKPEN=9)
      INTEGER*2 R2_NOTXORPEN            ! DPxn
      PARAMETER (R2_NOTXORPEN=10)
      INTEGER*2 R2_NOP                  ! D
      PARAMETER (R2_NOP=11)
      INTEGER*2 R2_MERGENOTPEN          ! DPno
      PARAMETER (R2_MERGENOTPEN=12)
      INTEGER*2 R2_COPYPEN              ! P
      PARAMETER (R2_COPYPEN=13)
      INTEGER*2 R2_MERGEPENNOT          ! PDno
      PARAMETER (R2_MERGEPENNOT=14)
      INTEGER*2 R2_MERGEPEN             ! DPo
      PARAMETER (R2_MERGEPEN=15)
      INTEGER*2 R2_WHITE                !  1
      PARAMETER (R2_WHITE=16)

C
C Ternary raster operations
C
      INTEGER*4 SRCCOPY             ! dest = source
      PARAMETER (SRCCOPY=           #00CC0020)
      INTEGER*4 SRCPAINT            ! dest = source OR dest
      PARAMETER (SRCPAINT=          #00EE0086)
      INTEGER*4 SRCAND              ! dest = source AND dest
      PARAMETER (SRCAND=            #008800C6)
      INTEGER*4 SRCINVERT           ! dest = source XOR dest
      PARAMETER (SRCINVERT=         #00660046)
      INTEGER*4 SRCERASE            ! dest = source AND (NOT dest )
      PARAMETER (SRCERASE=          #00440328)
      INTEGER*4 NOTSRCCOPY          ! dest = (NOT source)
      PARAMETER (NOTSRCCOPY=        #00330008)
      INTEGER*4 NOTSRCERASE         ! dest = (NOT src) AND (NOT dest)
      PARAMETER (NOTSRCERASE=       #001100A6)
      INTEGER*4 MERGECOPY           ! dest = (source AND pattern)
      PARAMETER (MERGECOPY=         #00C000CA)
      INTEGER*4 MERGEPAINT          ! dest = (NOT source) OR dest
      PARAMETER (MERGEPAINT=        #00BB0226)
      INTEGER*4 PATCOPY             ! dest = pattern
      PARAMETER (PATCOPY=           #00F00021)
      INTEGER*4 PATPAINT            ! dest = DPSnoo
      PARAMETER (PATPAINT=          #00FB0A09)
      INTEGER*4 PATINVERT           ! dest = pattern XOR dest
      PARAMETER (PATINVERT=         #005A0049)
      INTEGER*4 DSTINVERT           ! dest = (NOT dest)
      PARAMETER (DSTINVERT=         #00550009)
      INTEGER*4 BLACKNESS           ! dest = BLACK
      PARAMETER (BLACKNESS=         #00000042)
      INTEGER*4 WHITENESS           ! dest = WHITE
      PARAMETER (WHITENESS=         #00FF0062)

$ENDIF ! NORASTEROPS

C
C StretchBlt() Modes
C
      INTEGER*2 BLACKONWHITE
      PARAMETER (BLACKONWHITE=               1)
      INTEGER*2 WHITEONBLACK
      PARAMETER (WHITEONBLACK=               2)
      INTEGER*2 COLORONCOLOR
      PARAMETER (COLORONCOLOR=               3)

C
C PolyFill() Modes
C
      INTEGER*2 ALTERNATE
      PARAMETER (ALTERNATE=                  1)
      INTEGER*2 WINDING
      PARAMETER (WINDING=                    2)

C
C Text Alignment Options
C
      INTEGER*2 TA_NOUPDATECP
      PARAMETER (TA_NOUPDATECP=      0)
      INTEGER*2 TA_UPDATECP
      PARAMETER (TA_UPDATECP=        1)

      INTEGER*2 TA_LEFT
      PARAMETER (TA_LEFT=            0)
      INTEGER*2 TA_RIGHT
      PARAMETER (TA_RIGHT=           2)
      INTEGER*2 TA_CENTER
      PARAMETER (TA_CENTER=          6)

      INTEGER*2 TA_TOP
      PARAMETER (TA_TOP=             0)
      INTEGER*2 TA_BOTTOM
      PARAMETER (TA_BOTTOM=          8)
      INTEGER*2 TA_BASELINE
      PARAMETER (TA_BASELINE=        24)

      INTEGER*2 ETO_GRAYED
      PARAMETER (ETO_GRAYED=         1)
      INTEGER*2 ETO_OPAQUE
      PARAMETER (ETO_OPAQUE=         2)
      INTEGER*2 ETO_CLIPPED
      PARAMETER (ETO_CLIPPED=        4)

      INTEGER*2 ASPECT_FILTERING
      PARAMETER (ASPECT_FILTERING=   #0001)

$IF DEFINED(METAFILE)

C
C Metafile Functions
C
      INTEGER*2 META_SETBKCOLOR
      PARAMETER (META_SETBKCOLOR=            #0201)
      INTEGER*2 META_SETBKMODE
      PARAMETER (META_SETBKMODE=             #0102)
      INTEGER*2 META_SETMAPMODE
      PARAMETER (META_SETMAPMODE=            #0103)
      INTEGER*2 META_SETROP2
      PARAMETER (META_SETROP2=               #0104)
      INTEGER*2 META_SETRELABS
      PARAMETER (META_SETRELABS=             #0105)
      INTEGER*2 META_SETPOLYFILLMODE
      PARAMETER (META_SETPOLYFILLMODE=       #0106)
      INTEGER*2 META_SETSTRETCHBLTMODE
      PARAMETER (META_SETSTRETCHBLTMODE=     #0107)
      INTEGER*2 META_SETTEXTCHAREXTRA
      PARAMETER (META_SETTEXTCHAREXTRA=      #0108)
      INTEGER*2 META_SETTEXTCOLOR
      PARAMETER (META_SETTEXTCOLOR=          #0209)
      INTEGER*2 META_SETTEXTJUSTIFICATION
      PARAMETER (META_SETTEXTJUSTIFICATION=  #020A)
      INTEGER*2 META_SETWINDOWORG
      PARAMETER (META_SETWINDOWORG=          #020B)
      INTEGER*2 META_SETWINDOWEXT
      PARAMETER (META_SETWINDOWEXT=          #020C)
      INTEGER*2 META_SETVIEWPORTORG
      PARAMETER (META_SETVIEWPORTORG=        #020D)
      INTEGER*2 META_SETVIEWPORTEXT
      PARAMETER (META_SETVIEWPORTEXT=        #020E)
      INTEGER*2 META_OFFSETWINDOWORG
      PARAMETER (META_OFFSETWINDOWORG=       #020F)
      INTEGER*2 META_SCALEWINDOWEXT
      PARAMETER (META_SCALEWINDOWEXT=        #0400)
      INTEGER*2 META_OFFSETVIEWPORTORG
      PARAMETER (META_OFFSETVIEWPORTORG=     #0211)
      INTEGER*2 META_SCALEVIEWPORTEXT
      PARAMETER (META_SCALEVIEWPORTEXT=      #0412)
      INTEGER*2 META_LINETO
      PARAMETER (META_LINETO=                #0213)
      INTEGER*2 META_MOVETO
      PARAMETER (META_MOVETO=                #0214)
      INTEGER*2 META_EXCLUDECLIPRECT
      PARAMETER (META_EXCLUDECLIPRECT=       #0415)
      INTEGER*2 META_INTERSECTCLIPRECT
      PARAMETER (META_INTERSECTCLIPRECT=     #0416)
      INTEGER*2 META_ARC
      PARAMETER (META_ARC=                   #0817)
      INTEGER*2 META_ELLIPSE
      PARAMETER (META_ELLIPSE=               #0418)
      INTEGER*2 META_FLOODFILL
      PARAMETER (META_FLOODFILL=             #0419)
      INTEGER*2 META_PIE
      PARAMETER (META_PIE=                   #081A)
      INTEGER*2 META_RECTANGLE
      PARAMETER (META_RECTANGLE=             #041B)
      INTEGER*2 META_ROUNDRECT
      PARAMETER (META_ROUNDRECT=             #061C)
      INTEGER*2 META_PATBLT
      PARAMETER (META_PATBLT=                #061D)
      INTEGER*2 META_SAVEDC
      PARAMETER (META_SAVEDC=                #001E)
      INTEGER*2 META_SETPIXEL
      PARAMETER (META_SETPIXEL=              #041F)
      INTEGER*2 META_OFFSETCLIPRGN
      PARAMETER (META_OFFSETCLIPRGN=         #0220)
      INTEGER*2 META_TEXTOUT
      PARAMETER (META_TEXTOUT=               #0521)
      INTEGER*2 META_BITBLT
      PARAMETER (META_BITBLT=                #0922)
      INTEGER*2 META_STRETCHBLT
      PARAMETER (META_STRETCHBLT=            #0B23)
      INTEGER*2 META_POLYGON
      PARAMETER (META_POLYGON=               #0324)
      INTEGER*2 META_POLYLINE
      PARAMETER (META_POLYLINE=              #0325)
      INTEGER*2 META_ESCAPE
      PARAMETER (META_ESCAPE=                #0626)
      INTEGER*2 META_RESTOREDC
      PARAMETER (META_RESTOREDC=             #0127)
      INTEGER*2 META_FILLREGION
      PARAMETER (META_FILLREGION=            #0228)
      INTEGER*2 META_FRAMEREGION
      PARAMETER (META_FRAMEREGION=           #0429)
      INTEGER*2 META_INVERTREGION
      PARAMETER (META_INVERTREGION=          #012A)
      INTEGER*2 META_PAINTREGION
      PARAMETER (META_PAINTREGION=           #012B)
      INTEGER*2 META_SELECTCLIPREGION
      PARAMETER (META_SELECTCLIPREGION=      #012C)
      INTEGER*2 META_SELECTOBJECT
      PARAMETER (META_SELECTOBJECT=          #012D)
      INTEGER*2 META_SETTEXTALIGN
      PARAMETER (META_SETTEXTALIGN=          #012E)
      INTEGER*2 META_DRAWTEXT
      PARAMETER (META_DRAWTEXT=              #062F)

      INTEGER*2 META_CHORD
      PARAMETER (META_CHORD=                 #0830)
      INTEGER*2 META_SETMAPPERFLAGS
      PARAMETER (META_SETMAPPERFLAGS=        #0231)
      INTEGER*2 META_EXTTEXTOUT
      PARAMETER (META_EXTTEXTOUT=            #0a32 )
      INTEGER*2 META_SETDIBTODEV
      PARAMETER (META_SETDIBTODEV=           #0d33)
      INTEGER*2 META_SELECTPALETTE
      PARAMETER (META_SELECTPALETTE=         #0234)
      INTEGER*2 META_REALIZEPALETTE
      PARAMETER (META_REALIZEPALETTE=        #0035)
      INTEGER*2 META_ANIMATEPALETTE
      PARAMETER (META_ANIMATEPALETTE=        #0436)
      INTEGER*2 META_SETPALENTRIES
      PARAMETER (META_SETPALENTRIES=         #0037)
      INTEGER*2 META_POLYPOLYGON
      PARAMETER (META_POLYPOLYGON=           #0538)
      INTEGER*2 META_RESIZEPALETTE
      PARAMETER (META_RESIZEPALETTE=         #0139)

      INTEGER*2 META_DIBBITBLT
      PARAMETER (META_DIBBITBLT=             #0940)
      INTEGER*2 META_DIBSTRETCHBLT
      PARAMETER (META_DIBSTRETCHBLT=         #0b41)
      INTEGER*2 META_DIBCREATEPATTERNBRUSH
      PARAMETER (META_DIBCREATEPATTERNBRUSH= #0142)
      INTEGER*2 META_STRETCHDIB
      PARAMETER (META_STRETCHDIB=            #0f43)

      INTEGER*2 META_DELETEOBJECT
      PARAMETER (META_DELETEOBJECT=          #01f0)

      INTEGER*2 META_CREATEPALETTE
      PARAMETER (META_CREATEPALETTE=         #00f7)
      INTEGER*2 META_CREATEBRUSH
      PARAMETER (META_CREATEBRUSH=           #00F8)
      INTEGER*2 META_CREATEPATTERNBRUSH
      PARAMETER (META_CREATEPATTERNBRUSH=    #01F9)
      INTEGER*2 META_CREATEPENINDIRECT
      PARAMETER (META_CREATEPENINDIRECT=     #02FA)
      INTEGER*2 META_CREATEFONTINDIRECT
      PARAMETER (META_CREATEFONTINDIRECT=    #02FB)
      INTEGER*2 META_CREATEBRUSHINDIRECT
      PARAMETER (META_CREATEBRUSHINDIRECT=   #02FC)
      INTEGER*2 META_CREATEBITMAPINDIRECT
      PARAMETER (META_CREATEBITMAPINDIRECT=  #02FD)
      INTEGER*2 META_CREATEBITMAP
      PARAMETER (META_CREATEBITMAP=          #06FE)
      INTEGER*2 META_CREATEREGION
      PARAMETER (META_CREATEREGION=          #06FF)

$ENDIF ! NOMETAFILE

C
C GDI Escapes
C
      INTEGER*2 NEWFRAME
      PARAMETER (NEWFRAME=                   1)
      INTEGER*2 ABORTDOC
      PARAMETER (ABORTDOC=                   2)
      INTEGER*2 NEXTBAND
      PARAMETER (NEXTBAND=                   3)
      INTEGER*2 SETCOLORTABLE
      PARAMETER (SETCOLORTABLE=              4)
      INTEGER*2 GETCOLORTABLE
      PARAMETER (GETCOLORTABLE=              5)
      INTEGER*2 FLUSHOUTPUT
      PARAMETER (FLUSHOUTPUT=                6)
      INTEGER*2 DRAFTMODE
      PARAMETER (DRAFTMODE=                  7)
      INTEGER*2 QUERYESCSUPPORT
      PARAMETER (QUERYESCSUPPORT=            8)
      INTEGER*2 SETABORTPROC
      PARAMETER (SETABORTPROC=               9)
      INTEGER*2 STARTDOC
      PARAMETER (STARTDOC=                   10)
      INTEGER*2 ENDDOC
      PARAMETER (ENDDOC=                     11)
      INTEGER*2 GETPHYSPAGESIZE
      PARAMETER (GETPHYSPAGESIZE=            12)
      INTEGER*2 GETPRINTINGOFFSET
      PARAMETER (GETPRINTINGOFFSET=          13)
      INTEGER*2 GETSCALINGFACTOR
      PARAMETER (GETSCALINGFACTOR=           14)
      INTEGER*2 MFCOMMENT
      PARAMETER (MFCOMMENT=                  15)
      INTEGER*2 GETPENWIDTH
      PARAMETER (GETPENWIDTH=                16)
      INTEGER*2 SETCOPYCOUNT
      PARAMETER (SETCOPYCOUNT=               17)
      INTEGER*2 SELECTPAPERSOURCE
      PARAMETER (SELECTPAPERSOURCE=          18)
      INTEGER*2 DEVICEDATA
      PARAMETER (DEVICEDATA=                 19)
      INTEGER*2 PASSTHROUGH
      PARAMETER (PASSTHROUGH=                19)
      INTEGER*2 GETTECHNOLGY
      PARAMETER (GETTECHNOLGY=               20)
      INTEGER*2 GETTECHNOLOGY
      PARAMETER (GETTECHNOLOGY=              20)
      INTEGER*2 SETENDCAP
      PARAMETER (SETENDCAP=                  21)
      INTEGER*2 SETLINEJOIN
      PARAMETER (SETLINEJOIN=                22)
      INTEGER*2 SETMITERLIMIT
      PARAMETER (SETMITERLIMIT=              23)
      INTEGER*2 BANDINFO
      PARAMETER (BANDINFO=                   24)
      INTEGER*2 DRAWPATTERNRECT
      PARAMETER (DRAWPATTERNRECT=            25)
      INTEGER*2 GETVECTORPENSIZE
      PARAMETER (GETVECTORPENSIZE=           26)
      INTEGER*2 GETVECTORBRUSHSIZE
      PARAMETER (GETVECTORBRUSHSIZE=         27)
      INTEGER*2 ENABLEDUPLEX
      PARAMETER (ENABLEDUPLEX=               28)
      INTEGER*2 GETSETPAPERBINS
      PARAMETER (GETSETPAPERBINS=            29)
      INTEGER*2 GETSETPRINTORIENT
      PARAMETER (GETSETPRINTORIENT=          30)
      INTEGER*2 ENUMPAPERBINS
      PARAMETER (ENUMPAPERBINS=              31)
      INTEGER*2 SETDIBSCALING
      PARAMETER (SETDIBSCALING=              32)
      INTEGER*2 EPSPRINTING
      PARAMETER (EPSPRINTING=                33)
      INTEGER*2 ENUMPAPERMETRICS
      PARAMETER (ENUMPAPERMETRICS=           34)
      INTEGER*2 GETSETPAPERMETRICS
      PARAMETER (GETSETPAPERMETRICS=         35)
      INTEGER*2 POSTSCRIPT_DATA
      PARAMETER (POSTSCRIPT_DATA=            37)
      INTEGER*2 POSTSCRIPT_IGNORE
      PARAMETER (POSTSCRIPT_IGNORE=          38)
      INTEGER*2 GETEXTENDEDTEXTMETRICS
      PARAMETER (GETEXTENDEDTEXTMETRICS=     256)
      INTEGER*2 GETEXTENTTABLE
      PARAMETER (GETEXTENTTABLE=             257)
      INTEGER*2 GETPAIRKERNTABLE
      PARAMETER (GETPAIRKERNTABLE=           258)
      INTEGER*2 GETTRACKKERNTABLE
      PARAMETER (GETTRACKKERNTABLE=          259)
      INTEGER*2 EXT_TEXTOUT ! EXISTS AS FUNCTION
      PARAMETER (EXT_TEXTOUT=                 512)
      INTEGER*2 ENABLERELATIVEWIDTHS
      PARAMETER (ENABLERELATIVEWIDTHS=       768)
      INTEGER*2 ENABLEPAIRKERNING
      PARAMETER (ENABLEPAIRKERNING=          769)
      INTEGER*2 SETKERNTRACK
      PARAMETER (SETKERNTRACK=               770)
      INTEGER*2 SETALLJUSTVALUES
      PARAMETER (SETALLJUSTVALUES=           771)
      INTEGER*2 SETCHARSET
      PARAMETER (SETCHARSET=                 772)

      INTEGER*2 STRETCH_BLT ! CONFLICTS WITH FUNCTION STRETCHBLT
      PARAMETER (STRETCH_BLT=                2048)
      INTEGER*2 BEGIN_PATH
      PARAMETER (BEGIN_PATH=                 4096)
      INTEGER*2 CLIP_TO_PATH
      PARAMETER (CLIP_TO_PATH=               4097)
      INTEGER*2 END_PATH
      PARAMETER (END_PATH=                   4098)
      INTEGER*2 EXT_DEVICE_CAPS
      PARAMETER (EXT_DEVICE_CAPS=            4099)
      INTEGER*2 RESTORE_CTM
      PARAMETER (RESTORE_CTM=                4100)
      INTEGER*2 SAVE_CTM
      PARAMETER (SAVE_CTM=                   4101)
      INTEGER*2 SET_ARC_DIRECTION
      PARAMETER (SET_ARC_DIRECTION=          4102)
      INTEGER*2 SET_BACKGROUND_COLOR
      PARAMETER (SET_BACKGROUND_COLOR=       4103)
      INTEGER*2 SET_POLY_MODE
      PARAMETER (SET_POLY_MODE=              4104)
      INTEGER*2 SET_SCREEN_ANGLE
      PARAMETER (SET_SCREEN_ANGLE=           4105)
      INTEGER*2 SET_SPREAD
      PARAMETER (SET_SPREAD=                 4106)
      INTEGER*2 TRANSFORM_CTM
      PARAMETER (TRANSFORM_CTM=              4107)
      INTEGER*2 SET_CLIP_BOX
      PARAMETER (SET_CLIP_BOX=               4108)
      INTEGER*2 SET_BOUNDS
      PARAMETER (SET_BOUNDS=                 4109)
      INTEGER*2 SET_MIRROR_MODE
      PARAMETER (SET_MIRROR_MODE=            4110)

C
C Spooler Error Codes
C
      INTEGER*2 SP_NOTREPORTED
      PARAMETER (SP_NOTREPORTED=             #4000)
      INTEGER*2 SP_ERROR
      PARAMETER (SP_ERROR=                   -1)
      INTEGER*2 SP_APPABORT
      PARAMETER (SP_APPABORT=                -2)
      INTEGER*2 SP_USERABORT
      PARAMETER (SP_USERABORT=               -3)
      INTEGER*2 SP_OUTOFDISK
      PARAMETER (SP_OUTOFDISK=               -4)
      INTEGER*2 SP_OUTOFMEMORY
      PARAMETER (SP_OUTOFMEMORY=             -5)

      INTEGER*2 PR_JOBSTATUS
      PARAMETER (PR_JOBSTATUS=               #0000)

C
C Object Definitions for EnumObjects()
C
      INTEGER*2 OBJ_PEN
      PARAMETER (OBJ_PEN=                    1)
      INTEGER*2 OBJ_BRUSH
      PARAMETER (OBJ_BRUSH=                  2)

C
C Bitmap Header Definition
C
      STRUCTURE /BITMAP/
	 INTEGER*2 bmType
	 INTEGER*2 bmWidth
	 INTEGER*2 bmHeight
	 INTEGER*2 bmWidthBytes
	 INTEGER*2 bmPlanes
	 INTEGER*2 bmBitsPixel
	 INTEGER*4 bmBits ! LPSTR
      END STRUCTURE
!typedef BITMAP             *PBITMAP;
!typedef BITMAP NEAR        *NPBITMAP;
!typedef BITMAP FAR         *LPBITMAP;

      STRUCTURE /RGBTRIPLE/
	 BYTE rgbtBlue
	 BYTE rgbtGreen
	 BYTE rgbtRed
      END STRUCTURE

      STRUCTURE /RGBQUAD/
	 BYTE rgbBlue
	 BYTE rgbGreen
	 BYTE rgbRed
	 BYTE rgbReserved
      END STRUCTURE

C
C structures for defining DIBs
C
      STRUCTURE /BITMAPCOREHEADER/
	 INTEGER*4 bcSize               ! used to get to color table
	 INTEGER*2 bcWidth
	 INTEGER*2 bcHeight
	 INTEGER*2 bcPlanes
	 INTEGER*2 bcBitCount
      END STRUCTURE
!typedef BITMAPCOREHEADER FAR *LPBITMAPCOREHEADER;
!typedef BITMAPCOREHEADER *PBITMAPCOREHEADER;


      STRUCTURE /BITMAPINFOHEADER/
	 INTEGER*4 biSize
	 INTEGER*4 biWidth
	 INTEGER*4 biHeight
	 INTEGER*2 biPlanes
	 INTEGER*2 biBitCount

	 INTEGER*4 biCompression
	 INTEGER*4 biSizeImage
	 INTEGER*4 biXPelsPerMeter
	 INTEGER*4 biYPelsPerMeter
	 INTEGER*4 biClrUsed
	 INTEGER*4 biClrImportant
      END STRUCTURE

!typedef BITMAPINFOHEADER FAR *LPBITMAPINFOHEADER;
!typedef BITMAPINFOHEADER *PBITMAPINFOHEADER;

C
C constants for the biCompression field
C
      INTEGER*4 BI_RGB
      PARAMETER (BI_RGB=      0)
      INTEGER*4 BI_RLE8
      PARAMETER (BI_RLE8=     1)
      INTEGER*4 BI_RLE4
      PARAMETER (BI_RLE4=     2)

      STRUCTURE /BITMAPINFO/
	 RECORD /BITMAPINFOHEADER/ bmiHeader
	 RECORD /RGBQUAD/          bmiColors(1)
      END STRUCTURE

!typedef BITMAPINFO FAR *LPBITMAPINFO;
!typedef BITMAPINFO *PBITMAPINFO;

      STRUCTURE /BITMAPCOREINFO/
	 RECORD /BITMAPCOREHEADER/ bmciHeader
	 RECORD /RGBTRIPLE/        bmciColors(1)
      END STRUCTURE

!typedef BITMAPCOREINFO FAR *LPBITMAPCOREINFO;
!typedef BITMAPCOREINFO *PBITMAPCOREINFO;

      STRUCTURE /BITMAPFILEHEADER/
	 INTEGER*2 bfType
	 INTEGER*4 bfSize
	 INTEGER*2 bfReserved1
	 INTEGER*2 bfReserved2
	 INTEGER*4 bfOffBits
      END STRUCTURE

!typedef BITMAPFILEHEADER FAR *LPBITMAPFILEHEADER;
!typedef BITMAPFILEHEADER *PBITMAPFILEHEADER;

!#define MAKEPOINT(l)       (*((POINT FAR *)&(l)))

$IF DEFINED(METAFILE)

C
C Clipboard Metafile Picture Structure
C
      STRUCTURE /HANDLETABLE/
	 INTEGER*2 objectHandle(1) ! HANDLE
      END STRUCTURE

!typedef HANDLETABLE        *PHANDLETABLE;
!typedef HANDLETABLE FAR     *LPHANDLETABLE;

      STRUCTURE /METARECORD/
	 INTEGER*4 rdSize
	 INTEGER*2 rdFunction
	 INTEGER*2 rdParm(1)
      END STRUCTURE

!typedef METARECORD         *PMETARECORD;
!typedef METARECORD FAR     *LPMETARECORD;

      STRUCTURE /METAFILEPICT/
	 INTEGER*2 mm
	 INTEGER*2 xExt
	 INTEGER*2 yExt
	 INTEGER*2 hMF
      END STRUCTURE

!typedef METAFILEPICT FAR    *LPMETAFILEPICT;

      STRUCTURE /METAHEADER/
	 INTEGER*2 mtType
	 INTEGER*2 mtHeaderSize
	 INTEGER*2 mtVersion
	 INTEGER*4 mtSize
	 INTEGER*2 mtNoObjects
	 INTEGER*4 mtMaxRecord
	 INTEGER*2 mtNoParameters
      END STRUCTURE

$ENDIF ! NOMETAFILE

$IF DEFINED(TEXTMETRIC)

      STRUCTURE /TEXTMETRIC/
	 INTEGER*2 tmHeight
	 INTEGER*2 tmAscent
	 INTEGER*2 tmDescent
	 INTEGER*2 tmInternalLeading
	 INTEGER*2 tmExternalLeading
	 INTEGER*2 tmAveCharWidth
	 INTEGER*2 tmMaxCharWidth
	 INTEGER*2 tmWeight
	 BYTE tmItalic
	 BYTE tmUnderlined
	 BYTE tmStruckOut
	 BYTE tmFirstChar
	 BYTE tmLastChar
	 BYTE tmDefaultChar
	 BYTE tmBreakChar
	 BYTE tmPitchAndFamily
	 BYTE tmCharSet
	 INTEGER*2 tmOverhang
	 INTEGER*2 tmDigitizedAspectX
	 INTEGER*2 tmDigitizedAspectY
      END STRUCTURE

!typedef TEXTMETRIC         *PTEXTMETRIC;
!typedef TEXTMETRIC NEAR     *NPTEXTMETRIC;
!typedef TEXTMETRIC FAR     *LPTEXTMETRIC;

$ENDIF ! NOTEXTMETRIC

C
C GDI Logical Objects:
C
C Pel Array
C
      STRUCTURE /PELARRAY/
	 INTEGER*2 paXCount
	 INTEGER*2 paYCount
	 INTEGER*2 paXExt
	 INTEGER*2 paYExt
	 BYTE paRGBs
      END STRUCTURE

!typedef PELARRAY           *PPELARRAY;
!typedef PELARRAY NEAR      *NPPELARRAY;
!typedef PELARRAY FAR       *LPPELARRAY;

C
C Logical Brush (or Pattern)
C
      STRUCTURE /LOGBRUSH/
	 INTEGER*2 lbStyle
	 INTEGER*4 lbColor
	 INTEGER*2 lbHatch
      END STRUCTURE

!typedef LOGBRUSH           *PLOGBRUSH;
!typedef LOGBRUSH NEAR      *NPLOGBRUSH;
!typedef LOGBRUSH FAR       *LPLOGBRUSH;

!typedef LOGBRUSH           PATTERN;
!typedef PATTERN            *PPATTERN;
!typedef PATTERN NEAR       *NPPATTERN;
!typedef PATTERN FAR        *LPPATTERN;

C
C Logical Pen
C
      STRUCTURE /LOGPEN/
	 INTEGER*2 lopnStyle
	 RECORD /POINT/ lopnWidth
	 INTEGER*4 lopnColor
      END STRUCTURE

!typedef LOGPEN             *PLOGPEN;
!typedef LOGPEN NEAR        *NPLOGPEN;
!typedef LOGPEN FAR         *LPLOGPEN;

      STRUCTURE /PALETTEENTRY/
	 BYTE peRed
	 BYTE peGreen
	 BYTE peBlue
	 BYTE peFlags
      END STRUCTURE

!typedef PALETTEENTRY FAR  *LPPALETTEENTRY;

C
C Logical Palette
C
      STRUCTURE /LOGPALETTE/
	 INTEGER*2 palVersion
	 INTEGER*2 palNumEntries
	 RECORD /PALETTEENTRY/ palPalEntry(1)
      END STRUCTURE

!typedef LOGPALETTE         *PLOGPALETTE;
!typedef LOGPALETTE NEAR            *NPLOGPALETTE;
!typedef LOGPALETTE FAR     *LPLOGPALETTE;


C
C Logical Font
C
      INTEGER*2 LF_FACESIZE
      PARAMETER (LF_FACESIZE=32)

      STRUCTURE /LOGFONT/
	 INTEGER*2 lfHeight
	 INTEGER*2 lfWidth
	 INTEGER*2 lfEscapement
	 INTEGER*2 lfOrientation
	 INTEGER*2 lfWeight
	 BYTE lfItalic
	 BYTE lfUnderline
	 BYTE lfStrikeOut
	 BYTE lfCharSet
	 BYTE lfOutPrecision
	 BYTE lfClipPrecision
	 BYTE lfQuality
	 BYTE lfPitchAndFamily
	 BYTE lfFaceName(LF_FACESIZE)
      END STRUCTURE

!typedef LOGFONT            *PLOGFONT;
!typedef LOGFONT NEAR       *NPLOGFONT;
!typedef LOGFONT FAR        *LPLOGFONT;

      INTEGER*2 OUT_DEFAULT_PRECIS
      PARAMETER (OUT_DEFAULT_PRECIS=0)
      INTEGER*2 OUT_STRING_PRECIS
      PARAMETER (OUT_STRING_PRECIS=1)
      INTEGER*2 OUT_CHARACTER_PRECIS
      PARAMETER (OUT_CHARACTER_PRECIS=2)
      INTEGER*2 OUT_STROKE_PRECIS
      PARAMETER (OUT_STROKE_PRECIS=3)

      INTEGER*2 CLIP_DEFAULT_PRECIS
      PARAMETER (CLIP_DEFAULT_PRECIS=0)
      INTEGER*2 CLIP_CHARACTER_PRECIS
      PARAMETER (CLIP_CHARACTER_PRECIS=1)
      INTEGER*2 CLIP_STROKE_PRECIS
      PARAMETER (CLIP_STROKE_PRECIS=2)

      INTEGER*2 DEFAULT_QUALITY
      PARAMETER (DEFAULT_QUALITY=0)
      INTEGER*2 DRAFT_QUALITY
      PARAMETER (DRAFT_QUALITY= 1)
      INTEGER*2 PROOF_QUALITY
      PARAMETER (PROOF_QUALITY= 2)

      INTEGER*2 DEFAULT_PITCH
      PARAMETER (DEFAULT_PITCH=0)
      INTEGER*2 FIXED_PITCH
      PARAMETER (FIXED_PITCH=1)
      INTEGER*2 VARIABLE_PITCH
      PARAMETER (VARIABLE_PITCH=2)

      INTEGER*2 ANSI_CHARSET
      PARAMETER (ANSI_CHARSET=0)
      INTEGER*2 SYMBOL_CHARSET
      PARAMETER (SYMBOL_CHARSET=2)
      INTEGER*2 SHIFTJIS_CHARSET
      PARAMETER (SHIFTJIS_CHARSET=128)
      INTEGER*2 OEM_CHARSET
      PARAMETER (OEM_CHARSET=255)

C
C Font Families
C
      INTEGER*2 FF_DONTCARE      ! (0<<4) Don't care or don't know
      PARAMETER (FF_DONTCARE=0)
      INTEGER*2 FF_ROMAN         ! (1<<4) Variable stroke width, serifed
      PARAMETER (FF_ROMAN=16)    !        Times Roman, Century Schoolbook, etc.
      INTEGER*2 FF_SWISS         ! (2<<4) Variable stroke width, sans-serifed
      PARAMETER (FF_SWISS=32)    !        Helvetica, Swiss, etc.
      INTEGER*2 FF_MODERN        ! (3<<4) Constant stroke width, serifed or sans-serifed
      PARAMETER (FF_MODERN=48)   !        Pica, Elite, Courier, etc.
      INTEGER*2 FF_SCRIPT        ! (4<<4) Cursive, etc.
      PARAMETER (FF_SCRIPT=64)
      INTEGER*2 FF_DECORATIVE    ! (5<<4) Old English, etc.
      PARAMETER (FF_DECORATIVE=80)
C
C Font Weights
C
      INTEGER*2 FW_DONTCARE
      PARAMETER (FW_DONTCARE=0)
      INTEGER*2 FW_THIN
      PARAMETER (FW_THIN=100)
      INTEGER*2 FW_EXTRALIGHT
      PARAMETER (FW_EXTRALIGHT=200)
      INTEGER*2 FW_LIGHT
      PARAMETER (FW_LIGHT=300)
      INTEGER*2 FW_NORMAL
      PARAMETER (FW_NORMAL=400)
      INTEGER*2 FW_MEDIUM
      PARAMETER (FW_MEDIUM=500)
      INTEGER*2 FW_SEMIBOLD
      PARAMETER (FW_SEMIBOLD=600)
      INTEGER*2 FW_BOLD
      PARAMETER (FW_BOLD=700)
      INTEGER*2 FW_EXTRABOLD
      PARAMETER (FW_EXTRABOLD=800)
      INTEGER*2 FW_HEAVY
      PARAMETER (FW_HEAVY=900)

      INTEGER*2 FW_ULTRALIGHT
      PARAMETER (FW_ULTRALIGHT=FW_EXTRALIGHT)
      INTEGER*2 FW_REGULAR
      PARAMETER (FW_REGULAR=FW_NORMAL)
      INTEGER*2 FW_DEMIBOLD
      PARAMETER (FW_DEMIBOLD=FW_SEMIBOLD)
      INTEGER*2 FW_ULTRABOLD
      PARAMETER (FW_ULTRABOLD=FW_EXTRABOLD)
      INTEGER*2 FW_BLACK
      PARAMETER (FW_BLACK=FW_HEAVY)

C
C EnumFonts Masks
C
      INTEGER*2 RASTER_FONTTYPE
      PARAMETER (RASTER_FONTTYPE=#0001)
      INTEGER*2 DEVICE_FONTTYPE
      PARAMETER (DEVICE_FONTTYPE=#0002)

!#define RGB(r,g,b)          ((DWORD)(((BYTE)(r)|((WORD)(g)<<8))|(((DWORD)(BYTE)(b))<<16)))
!#define PALETTERGB(r,g,b)   (0x02000000 | RGB(r,g,b))
!#define PALETTEINDEX(i)     ((DWORD)(0x01000000 | (WORD)(i)))

!#define GetRValue(rgb)     ((BYTE)(rgb))
!#define GetGValue(rgb)     ((BYTE)(((WORD)(rgb)) >> 8))
!#define GetBValue(rgb)     ((BYTE)((rgb)>>16))

C
C Background Modes
C
      INTEGER*2 TRANSPARENT
      PARAMETER (TRANSPARENT=1)
      INTEGER*2 OPAQUE
      PARAMETER (OPAQUE=2)

C
C Mapping Modes
C
      INTEGER*2 MM_TEXT
      PARAMETER (MM_TEXT=1)
      INTEGER*2 MM_LOMETRIC
      PARAMETER (MM_LOMETRIC=2)
      INTEGER*2 MM_HIMETRIC
      PARAMETER (MM_HIMETRIC=3)
      INTEGER*2 MM_LOENGLISH
      PARAMETER (MM_LOENGLISH=4)
      INTEGER*2 MM_HIENGLISH
      PARAMETER (MM_HIENGLISH=5)
      INTEGER*2 MM_TWIPS
      PARAMETER (MM_TWIPS=6)
      INTEGER*2 MM_ISOTROPIC
      PARAMETER (MM_ISOTROPIC=7)
      INTEGER*2 MM_ANISOTROPIC
      PARAMETER (MM_ANISOTROPIC=8)

C
C Coordinate Modes
C
      INTEGER*2 ABSOLUTE
      PARAMETER (ABSOLUTE=1)
      INTEGER*2 RELATIVE
      PARAMETER (RELATIVE=2)

C
C Stock Logical Objects
C
      INTEGER*2 WHITE_BRUSH
      PARAMETER (WHITE_BRUSH=0)
      INTEGER*2 LTGRAY_BRUSH
      PARAMETER (LTGRAY_BRUSH=1)
      INTEGER*2 GRAY_BRUSH
      PARAMETER (GRAY_BRUSH=2)
      INTEGER*2 DKGRAY_BRUSH
      PARAMETER (DKGRAY_BRUSH=3)
      INTEGER*2 BLACK_BRUSH
      PARAMETER (BLACK_BRUSH=4)
      INTEGER*2 NULL_BRUSH
      PARAMETER (NULL_BRUSH=5)
      INTEGER*2 HOLLOW_BRUSH
      PARAMETER (HOLLOW_BRUSH=NULL_BRUSH)
      INTEGER*2 WHITE_PEN
      PARAMETER (WHITE_PEN=6)
      INTEGER*2 BLACK_PEN
      PARAMETER (BLACK_PEN=7)
      INTEGER*2 NULL_PEN
      PARAMETER (NULL_PEN=8)
      INTEGER*2 OEM_FIXED_FONT
      PARAMETER (OEM_FIXED_FONT=10)
      INTEGER*2 ANSI_FIXED_FONT
      PARAMETER (ANSI_FIXED_FONT=11)
      INTEGER*2 ANSI_VAR_FONT
      PARAMETER (ANSI_VAR_FONT=12)
      INTEGER*2 SYSTEM_FONT
      PARAMETER (SYSTEM_FONT=13)
      INTEGER*2 DEVICE_DEFAULT_FONT
      PARAMETER (DEVICE_DEFAULT_FONT=14)
      INTEGER*2 DEFAULT_PALETTE
      PARAMETER (DEFAULT_PALETTE=15)
      INTEGER*2 SYSTEM_FIXED_FONT
      PARAMETER (SYSTEM_FIXED_FONT=16)

C
C Brush Styles
C
      INTEGER*2 BS_SOLID
      PARAMETER (BS_SOLID=0)
      INTEGER*2 BS_NULL
      PARAMETER (BS_NULL=1)
      INTEGER*2 BS_HOLLOW
      PARAMETER (BS_HOLLOW=BS_NULL)
      INTEGER*2 BS_HATCHED
      PARAMETER (BS_HATCHED=2)
      INTEGER*2 BS_PATTERN
      PARAMETER (BS_PATTERN=3)
      INTEGER*2 BS_INDEXED
      PARAMETER (BS_INDEXED=4)
      INTEGER*2 BS_DIBPATTERN
      PARAMETER (BS_DIBPATTERN=5)

C
C Hatch Styles
C
      INTEGER*2 HS_HORIZONTAL
      PARAMETER (HS_HORIZONTAL=0)   ! -----
      INTEGER*2 HS_VERTICAL
      PARAMETER (HS_VERTICAL=1)     ! |||||
      INTEGER*2 HS_FDIAGONAL
      PARAMETER (HS_FDIAGONAL=2)    ! \\\\\
      INTEGER*2 HS_BDIAGONAL
      PARAMETER (HS_BDIAGONAL=3)    ! /////
      INTEGER*2 HS_CROSS
      PARAMETER (HS_CROSS=4)        ! +++++
      INTEGER*2 HS_DIAGCROSS
      PARAMETER (HS_DIAGCROSS=5)    ! xxxxx

C
C Pen Styles
C
      INTEGER*2 PS_SOLID
      PARAMETER (PS_SOLID=0)
      INTEGER*2 PS_DASH
      PARAMETER (PS_DASH=1)         ! -------
      INTEGER*2 PS_DOT
      PARAMETER (PS_DOT=2)          ! .......
      INTEGER*2 PS_DASHDOT
      PARAMETER (PS_DASHDOT=3)      ! _._._._
      INTEGER*2 PS_DASHDOTDOT
      PARAMETER (PS_DASHDOTDOT=4)   ! _.._.._
      INTEGER*2 PS_NULL
      PARAMETER (PS_NULL=5)
      INTEGER*2 PS_INSIDEFRAME
      PARAMETER (PS_INSIDEFRAME=6)

C
C Device Parameters for GetDeviceCaps()
C
      INTEGER*2 DRIVERVERSION
      PARAMETER (DRIVERVERSION=0)    ! Device driver version
      INTEGER*2 TECHNOLOGY
      PARAMETER (TECHNOLOGY=2)       ! Device classification
      INTEGER*2 HORZSIZE
      PARAMETER (HORZSIZE=4)         ! Horizontal size in millimeters
      INTEGER*2 VERTSIZE
      PARAMETER (VERTSIZE=6)         ! Vertical size in millimeters
      INTEGER*2 HORZRES
      PARAMETER (HORZRES=8)          ! Horizontal width in pixels
      INTEGER*2 VERTRES
      PARAMETER (VERTRES=10)         ! Vertical width in pixels
      INTEGER*2 BITSPIXEL
      PARAMETER (BITSPIXEL=12)       ! Number of bits per pixel
      INTEGER*2 PLANES
      PARAMETER (PLANES=14)          ! Number of planes
      INTEGER*2 NUMBRUSHES
      PARAMETER (NUMBRUSHES=16)      ! Number of brushes the device has
      INTEGER*2 NUMPENS
      PARAMETER (NUMPENS=18)         ! Number of pens the device has
      INTEGER*2 NUMMARKERS
      PARAMETER (NUMMARKERS=20)      ! Number of markers the device has
      INTEGER*2 NUMFONTS
      PARAMETER (NUMFONTS=22)        ! Number of fonts the device has
      INTEGER*2 NUMCOLORS
      PARAMETER (NUMCOLORS=24)       ! Number of colors the device supports
      INTEGER*2 PDEVICESIZE
      PARAMETER (PDEVICESIZE=26)     ! Size required for device descriptor
      INTEGER*2 CURVECAPS
      PARAMETER (CURVECAPS=28)       ! Curve capabilities
      INTEGER*2 LINECAPS
      PARAMETER (LINECAPS=30)        ! Line capabilities
      INTEGER*2 POLYGONALCAPS
      PARAMETER (POLYGONALCAPS=32)   ! Polygonal capabilities
      INTEGER*2 TEXTCAPS
      PARAMETER (TEXTCAPS=34)        ! Text capabilities
      INTEGER*2 CLIPCAPS
      PARAMETER (CLIPCAPS=36)        ! Clipping capabilities
      INTEGER*2 RASTERCAPS
      PARAMETER (RASTERCAPS=38)      ! Bitblt capabilities
      INTEGER*2 ASPECTX
      PARAMETER (ASPECTX=40)         ! Length of the X leg
      INTEGER*2 ASPECTY
      PARAMETER (ASPECTY=42)         ! Length of the Y leg
      INTEGER*2 ASPECTXY
      PARAMETER (ASPECTXY=44)        ! Length of the hypotenuse

      INTEGER*2 LOGPIXELSX
      PARAMETER (LOGPIXELSX=88)      ! Logical pixels/inch in X
      INTEGER*2 LOGPIXELSY
      PARAMETER (LOGPIXELSY=90)      ! Logical pixels/inch in Y

      INTEGER*2 SIZEPALETTE
      PARAMETER (SIZEPALETTE=104)    ! Number of entries in physical palette
      INTEGER*2 NUMRESERVED
      PARAMETER (NUMRESERVED=106)    ! Number of reserved entries in palette
      INTEGER*2 COLORRES
      PARAMETER (COLORRES=108)       ! Actual color resolution

$IF DEFINED(GDICAPMASKS)

C
C Device Capability Masks:
C
C Device Technologies
C
      INTEGER*2 DT_PLOTTER
      PARAMETER (DT_PLOTTER=        0)  ! Vector plotter
      INTEGER*2 DT_RASDISPLAY
      PARAMETER (DT_RASDISPLAY=     1)  ! Raster display
      INTEGER*2 DT_RASPRINTER
      PARAMETER (DT_RASPRINTER=     2)  ! Raster printer
      INTEGER*2 DT_RASCAMERA
      PARAMETER (DT_RASCAMERA=      3)  ! Raster camera
      INTEGER*2 DT_CHARSTREAM
      PARAMETER (DT_CHARSTREAM=     4)  ! Character-stream, PLP
      INTEGER*2 DT_METAFILE
      PARAMETER (DT_METAFILE=       5)  ! Metafile, VDM
      INTEGER*2 DT_DISPFILE
      PARAMETER (DT_DISPFILE=       6)  ! Display-file

C
C Curve Capabilities
C
      INTEGER*2 CC_NONE
      PARAMETER (CC_NONE=           0)   ! Curves not supported
      INTEGER*2 CC_CIRCLES
      PARAMETER (CC_CIRCLES=        1)   ! Can do circles
      INTEGER*2 CC_PIE
      PARAMETER (CC_PIE=            2)   ! Can do pie wedges
      INTEGER*2 CC_CHORD
      PARAMETER (CC_CHORD=          4)   ! Can do chord arcs
      INTEGER*2 CC_ELLIPSES
      PARAMETER (CC_ELLIPSES=       8)   ! Can do ellipese
      INTEGER*2 CC_WIDE
      PARAMETER (CC_WIDE=           16)  ! Can do wide lines
      INTEGER*2 CC_STYLED
      PARAMETER (CC_STYLED=         32)  ! Can do styled lines
      INTEGER*2 CC_WIDESTYLED
      PARAMETER (CC_WIDESTYLED=     64)  ! Can do wide styled lines
      INTEGER*2 CC_INTERIORS
      PARAMETER (CC_INTERIORS=      128) ! Can do interiors

C
C Line Capabilities
C
      INTEGER*2 LC_NONE
      PARAMETER (LC_NONE=           0)   ! Lines not supported
      INTEGER*2 LC_POLYLINE
      PARAMETER (LC_POLYLINE=       2)   ! Can do polylines
      INTEGER*2 LC_MARKER
      PARAMETER (LC_MARKER=         4)   ! Can do markers
      INTEGER*2 LC_POLYMARKER
      PARAMETER (LC_POLYMARKER=     8)   ! Can do polymarkers
      INTEGER*2 LC_WIDE
      PARAMETER (LC_WIDE=           16)  ! Can do wide lines
      INTEGER*2 LC_STYLED
      PARAMETER (LC_STYLED=         32)  ! Can do styled lines
      INTEGER*2 LC_WIDESTYLED
      PARAMETER (LC_WIDESTYLED=     64)  ! Can do wide styled lines
      INTEGER*2 LC_INTERIORS
      PARAMETER (LC_INTERIORS=      128) ! Can do interiors

C
C Polygonal Capabilities
C
      INTEGER*2 PC_NONE
      PARAMETER (PC_NONE=           0)   ! Polygonals not supported
      INTEGER*2 PC_POLYGON
      PARAMETER (PC_POLYGON=        1)   ! Can do polygons
      INTEGER*2 PC_RECTANGLE
      PARAMETER (PC_RECTANGLE=      2)   ! Can do rectangles
      INTEGER*2 PC_WINDPOLYGON
      PARAMETER (PC_WINDPOLYGON=    4)   ! Can do winding polygons
      INTEGER*2 PC_TRAPEZOID
      PARAMETER (PC_TRAPEZOID=      4)   ! Can do trapezoids
      INTEGER*2 PC_SCANLINE
      PARAMETER (PC_SCANLINE=       8)   ! Can do scanlines
      INTEGER*2 PC_WIDE
      PARAMETER (PC_WIDE=           16)  ! Can do wide borders
      INTEGER*2 PC_STYLED
      PARAMETER (PC_STYLED=         32)  ! Can do styled borders
      INTEGER*2 PC_WIDESTYLED
      PARAMETER (PC_WIDESTYLED=     64)  ! Can do wide styled borders
      INTEGER*2 PC_INTERIORS
      PARAMETER (PC_INTERIORS=      128) ! Can do interiors

C
C Polygonal Capabilities
C
      INTEGER*2 CP_NONE
      PARAMETER (CP_NONE=           0)   ! No clipping of output
      INTEGER*2 CP_RECTANGLE
      PARAMETER (CP_RECTANGLE=      1)   ! Output clipped to rects

C
C Text Capabilities
C
      INTEGER*2 TC_OP_CHARACTER
      PARAMETER (TC_OP_CHARACTER=   #0001)  ! Can do OutputPrecision    CHARACTER
      INTEGER*2 TC_OP_STROKE
      PARAMETER (TC_OP_STROKE=      #0002)  ! Can do OutputPrecision    STROKE
      INTEGER*2 TC_CP_STROKE
      PARAMETER (TC_CP_STROKE=      #0004)  ! Can do ClipPrecision      STROKE
      INTEGER*2 TC_CR_90
      PARAMETER (TC_CR_90=          #0008)  ! Can do CharRotAbility     90
      INTEGER*2 TC_CR_ANY
      PARAMETER (TC_CR_ANY=         #0010)  ! Can do CharRotAbility     ANY
      INTEGER*2 TC_SF_X_YINDEP
      PARAMETER (TC_SF_X_YINDEP=    #0020)  ! Can do ScaleFreedom       X_YINDEPENDENT
      INTEGER*2 TC_SA_DOUBLE
      PARAMETER (TC_SA_DOUBLE=      #0040)  ! Can do ScaleAbility       DOUBLE
      INTEGER*2 TC_SA_INTEGER
      PARAMETER (TC_SA_INTEGER=     #0080)  ! Can do ScaleAbility       INTEGER
      INTEGER*2 TC_SA_CONTIN
      PARAMETER (TC_SA_CONTIN=      #0100)  ! Can do ScaleAbility       CONTINUOUS
      INTEGER*2 TC_EA_DOUBLE
      PARAMETER (TC_EA_DOUBLE=      #0200)  ! Can do EmboldenAbility    DOUBLE
      INTEGER*2 TC_IA_ABLE
      PARAMETER (TC_IA_ABLE=        #0400)  ! Can do ItalisizeAbility   ABLE
      INTEGER*2 TC_UA_ABLE
      PARAMETER (TC_UA_ABLE=        #0800)  ! Can do UnderlineAbility   ABLE
      INTEGER*2 TC_SO_ABLE
      PARAMETER (TC_SO_ABLE=        #1000)  ! Can do StrikeOutAbility   ABLE
      INTEGER*2 TC_RA_ABLE
      PARAMETER (TC_RA_ABLE=        #2000)  ! Can do RasterFontAble     ABLE
      INTEGER*2 TC_VA_ABLE
      PARAMETER (TC_VA_ABLE=        #4000)  ! Can do VectorFontAble     ABLE
      INTEGER*2 TC_RESERVED
      PARAMETER (TC_RESERVED=       #8000)

$ENDIF ! NOGDICAPMASKS

C
C Raster Capabilities
C
      INTEGER*2 RC_BITBLT
      PARAMETER (RC_BITBLT=         1)      ! Can do standard BLT.
      INTEGER*2 RC_BANDING
      PARAMETER (RC_BANDING=        2)      ! Device requires banding support
      INTEGER*2 RC_SCALING
      PARAMETER (RC_SCALING=        4)      ! Device requires scaling support
      INTEGER*2 RC_BITMAP64
      PARAMETER (RC_BITMAP64=       8)      ! Device can support >64K bitmap
      INTEGER*2 RC_GDI20_OUTPUT
      PARAMETER (RC_GDI20_OUTPUT=   #0010)      ! has 2.0 output calls
      INTEGER*2 RC_DI_BITMAP
      PARAMETER (RC_DI_BITMAP=      #0080)      ! supports DIB to memory
      INTEGER*2 RC_PALETTE
      PARAMETER (RC_PALETTE=        #0100)      ! supports a palette
      INTEGER*2 RC_DIBTODEV
      PARAMETER (RC_DIBTODEV=       #0200)      ! supports DIBitsToDevice
      INTEGER*2 RC_BIGFONT
      PARAMETER (RC_BIGFONT=        #0400)      ! supports >64K fonts
      INTEGER*2 RC_STRETCHBLT
      PARAMETER (RC_STRETCHBLT=     #0800)      ! supports StretchBlt
      INTEGER*2 RC_FLOODFILL
      PARAMETER (RC_FLOODFILL=      #1000)      ! supports FloodFill
      INTEGER*2 RC_STRETCHDIB
      PARAMETER (RC_STRETCHDIB=     #2000)      ! supports StretchDIBits

C
C palette entry flags
C

      INTEGER*2 PC_RESERVED
      PARAMETER (PC_RESERVED=   #01)    ! palette index used for animation
      INTEGER*2 PC_EXPLICIT
      PARAMETER (PC_EXPLICIT=   #02)    ! palette index is explicit to device
      INTEGER*2 PC_NOCOLLAPSE
      PARAMETER (PC_NOCOLLAPSE= #04)    ! do not match color to system palette

C
C DIB color table identifiers
C

      INTEGER*2 DIB_RGB_COLORS
      PARAMETER (DIB_RGB_COLORS=0)      ! color table in RGBTriples
      INTEGER*2 DIB_PAL_COLORS
      PARAMETER (DIB_PAL_COLORS=1)      ! color table in palette indices

C
C constants for Get/SetSystemPaletteUse()
C

      INTEGER*2 SYSPAL_STATIC
      PARAMETER (SYSPAL_STATIC=1)
      INTEGER*2 SYSPAL_NOSTATIC
      PARAMETER (SYSPAL_NOSTATIC=2)

C
C Constants for CreateDIBitmap
C
      INTEGER*4 CBM_INIT
      PARAMETER (CBM_INIT=#04)  ! initialize bitmap

$IF DEFINED(DRAWTEXT)

C
C DrawText() Format Flags
C
      INTEGER*2 DT_TOP
      PARAMETER (DT_TOP=            #0000)
      INTEGER*2 DT_LEFT
      PARAMETER (DT_LEFT=           #0000)
      INTEGER*2 DT_CENTER
      PARAMETER (DT_CENTER=         #0001)
      INTEGER*2 DT_RIGHT
      PARAMETER (DT_RIGHT=          #0002)
      INTEGER*2 DT_VCENTER
      PARAMETER (DT_VCENTER=        #0004)
      INTEGER*2 DT_BOTTOM
      PARAMETER (DT_BOTTOM=         #0008)
      INTEGER*2 DT_WORDBREAK
      PARAMETER (DT_WORDBREAK=      #0010)
      INTEGER*2 DT_SINGLELINE
      PARAMETER (DT_SINGLELINE=     #0020)
      INTEGER*2 DT_EXPANDTABS
      PARAMETER (DT_EXPANDTABS=     #0040)
      INTEGER*2 DT_TABSTOP
      PARAMETER (DT_TABSTOP=        #0080)
      INTEGER*2 DT_NOCLIP
      PARAMETER (DT_NOCLIP=         #0100)
      INTEGER*2 DT_EXTERNALLEADING
      PARAMETER (DT_EXTERNALLEADING=#0200)
      INTEGER*2 DT_CALCRECT
      PARAMETER (DT_CALCRECT=       #0400)
      INTEGER*2 DT_NOPREFIX
      PARAMETER (DT_NOPREFIX=       #0800)
      INTEGER*2 DT_INTERNAL
      PARAMETER (DT_INTERNAL=       #1000)

      INTEGER*2 DrawText [EXTERN]
      INTEGER*2 DrawIcon [EXTERN]

$ENDIF ! NODRAWTEXT

C
C ExtFloodFill style flags
C
      INTEGER*2 FLOODFILLBORDER
      PARAMETER (FLOODFILLBORDER=0)
      INTEGER*2 FLOODFILLSURFACE
      PARAMETER (FLOODFILLSURFACE=1)

      INTEGER*2 GetWindowDC [EXTERN]
      INTEGER*2 GetDC [EXTERN]
      INTEGER*2 ReleaseDC [EXTERN]
      INTEGER*2 CreateDC [EXTERN]
      INTEGER*2 CreateIC [EXTERN]
      INTEGER*2 CreateCompatibleDC [EXTERN]
      INTEGER*2 DeleteDC [EXTERN]
      INTEGER*2 SaveDC [EXTERN]
      INTEGER*2 RestoreDC [EXTERN]
      INTEGER*4 MoveTo [EXTERN]
      INTEGER*4 GetCurrentPosition [EXTERN]
      INTEGER*2 LineTo [EXTERN]
      INTEGER*4 GetDCOrg [EXTERN]

      INTEGER*2 ExtTextOut [EXTERN]
      INTEGER*2 Polyline [EXTERN]
      INTEGER*2 Polygon [EXTERN]
      INTEGER*2 PolyPolygon [EXTERN]

      INTEGER*2 Rectangle [EXTERN]
      INTEGER*2 RoundRect [EXTERN]
      INTEGER*2 Ellipse [EXTERN]
      INTEGER*2 Arc [EXTERN]
      INTEGER*2 Chord [EXTERN]
      INTEGER*2 Pie [EXTERN]
      INTEGER*2 PatBlt [EXTERN]
      INTEGER*2 BitBlt [EXTERN]
      INTEGER*2 StretchBlt [EXTERN]
      INTEGER*2 TextOut [EXTERN]
      INTEGER*4 TabbedTextOut [EXTERN]
      INTEGER*2 GetCharWidth [EXTERN]
      INTEGER*4 SetPixel [EXTERN]
      INTEGER*4 GetPixel [EXTERN]
      INTEGER*2 FloodFill [EXTERN]
      INTEGER*2 ExtFloodFill [EXTERN]

      INTEGER*2 GetStockObject [EXTERN]

      INTEGER*2 CreatePen [EXTERN]
      INTEGER*2 CreatePenIndirect [EXTERN]

      INTEGER*2 CreateSolidBrush [EXTERN]
      INTEGER*2 CreateHatchBrush [EXTERN]
      INTEGER*4 SetBrushOrg [EXTERN]
      INTEGER*4 GetBrushOrg [EXTERN]
      INTEGER*2 CreatePatternBrush [EXTERN]
      INTEGER*2 CreateBrushIndirect [EXTERN]

      INTEGER*2 CreateBitmap [EXTERN]
      INTEGER*2 CreateBitmapIndirect [EXTERN]
      INTEGER*2 CreateCompatibleBitmap [EXTERN]
      INTEGER*2 CreateDiscardableBitmap [EXTERN]

      INTEGER*4 SetBitmapBits [EXTERN]
      INTEGER*4 GetBitmapBits [EXTERN]
      INTEGER*4 SetBitmapDimension [EXTERN]
      INTEGER*4 GetBitmapDimension [EXTERN]

      INTEGER*2 CreateFont [EXTERN]
      INTEGER*2 CreateFontIndirect [EXTERN]

      INTEGER*2 SelectClipRgn [EXTERN]
      INTEGER*2 CreateRectRgn [EXTERN]
      INTEGER*2 CreateRectRgnIndirect [EXTERN]
      INTEGER*2 CreateEllipticRgnIndirect [EXTERN]
      INTEGER*2 CreateEllipticRgn [EXTERN]
      INTEGER*2 CreatePolygonRgn [EXTERN]
      INTEGER*2 CreatePolyPolygonRgn [EXTERN]
      INTEGER*2 CreateRoundRectRgn [EXTERN]

      INTEGER*2 GetObject [EXTERN]
      INTEGER*2 DeleteObject [EXTERN]
      INTEGER*2 SelectObject [EXTERN]
      INTEGER*2 UnrealizeObject [EXTERN]

      INTEGER*2 SetBkColor [EXTERN]
      INTEGER*4 GetBkColor [EXTERN]
      INTEGER*2 SetBkMode [EXTERN]
      INTEGER*2 GetBkMode [EXTERN]
      INTEGER*4 SetTextColor [EXTERN]
      INTEGER*4 GetTextColor [EXTERN]
      INTEGER*2 SetTextAlign [EXTERN]
      INTEGER*2 GetTextAlign [EXTERN]
      INTEGER*4 SetMapperFlags [EXTERN]
      INTEGER*4 GetAspectRatioFilter [EXTERN]
      INTEGER*4 GetNearestColor [EXTERN]
      INTEGER*2 SetROP2 [EXTERN]
      INTEGER*2 GetROP2 [EXTERN]
      INTEGER*2 SetStretchBltMode [EXTERN]
      INTEGER*2 GetStretchBltMode [EXTERN]
      INTEGER*2 SetPolyFillMode [EXTERN]
      INTEGER*2 GetPolyFillMode [EXTERN]
      INTEGER*2 SetMapMode [EXTERN]
      INTEGER*2 GetMapMode [EXTERN]
      INTEGER*4 SetWindowOrg [EXTERN]
      INTEGER*4 GetWindowOrg [EXTERN]
      INTEGER*4 SetWindowExt [EXTERN]
      INTEGER*4 GetWindowExt [EXTERN]
      INTEGER*4 SetViewportOrg [EXTERN]
      INTEGER*4 GetViewportOrg [EXTERN]
      INTEGER*4 SetViewportExt [EXTERN]
      INTEGER*4 GetViewportExt [EXTERN]
      INTEGER*4 OffsetViewportOrg [EXTERN]
      INTEGER*4 ScaleViewportExt [EXTERN]
      INTEGER*4 OffsetWindowOrg [EXTERN]
      INTEGER*4 ScaleWindowExt [EXTERN]

      INTEGER*2 GetClipBox [EXTERN]
      INTEGER*2 IntersectClipRect [EXTERN]
      INTEGER*2 OffsetClipRgn [EXTERN]
      INTEGER*2 ExcludeClipRect [EXTERN]
      INTEGER*2 PtVisible [EXTERN]
      INTEGER*2 CombineRgn [EXTERN]
      INTEGER*2 EqualRgn [EXTERN]
      INTEGER*2 OffsetRgn [EXTERN]
      INTEGER*2 GetRgnBox [EXTERN]

      INTEGER*2 SetTextJustification [EXTERN]
      INTEGER*4 GetTextExtent [EXTERN]
      INTEGER*4 GetTabbedTextExtent [EXTERN]
      INTEGER*2 SetTextCharacterExtra [EXTERN]
      INTEGER*2 GetTextCharacterExtra [EXTERN]

      INTEGER*2 GetMetaFile [EXTERN]
      INTEGER*2 DeleteMetaFile [EXTERN]
      INTEGER*2 CopyMetaFile [EXTERN]

$IF DEFINED(METAFILE)
      INTEGER*2 EnumMetaFile [EXTERN]
$ENDIF

      INTEGER*2 PlayMetaFile [EXTERN]
      INTEGER*2 Escape [EXTERN]
      INTEGER*2 EnumFonts [EXTERN]
      INTEGER*2 EnumObjects [EXTERN]
      INTEGER*2 GetTextFace [EXTERN]

$IF DEFINED(TEXTMETRIC)
      INTEGER*2 GetTextMetrics [EXTERN]
$ENDIF

      INTEGER*2 GetDeviceCaps [EXTERN]

      INTEGER*2 SetEnvironment [EXTERN]
      INTEGER*2 GetEnvironment [EXTERN]

      INTEGER*2 DPtoLP [EXTERN]
      INTEGER*2 LPtoDP [EXTERN]

      INTEGER*2 CreateMetaFile [EXTERN]
      INTEGER*2 CloseMetaFile [EXTERN]
      INTEGER*2 GetMetaFileBits [EXTERN]
      INTEGER*2 SetMetaFileBits [EXTERN]

      INTEGER*2 SetDIBits [EXTERN], SetDIBits_A [EXTERN]
      INTEGER*2 GetDIBits [EXTERN], GetDIBits_A [EXTERN]

      INTEGER*2 SetDIBitsToDevice [EXTERN]
      INTEGER*2 CreateDIBitmap [EXTERN]
      INTEGER*2 CreateDIBPatternBrush [EXTERN]
      INTEGER*2 StretchDIBits [EXTERN]

      INTEGER*2 CreatePalette  [EXTERN]
      INTEGER*2 SelectPalette  [EXTERN]
      INTEGER*2 RealizePalette  [EXTERN]
      INTEGER*2 UpdateColors  [EXTERN]
      INTEGER*2 SetPaletteEntries [EXTERN]
      INTEGER*2 GetPaletteEntries [EXTERN]
      INTEGER*2 GetNearestPaletteIndex [EXTERN]
      INTEGER*2 ResizePalette [EXTERN]

      INTEGER*2 GetSystemPaletteEntries [EXTERN]
      INTEGER*2 GetSystemPaletteUse [EXTERN]
      INTEGER*2 SetSystemPaletteUse [EXTERN]

$ENDIF ! NOGDI

C
C USER Section
C

$IF DEFINED(USER)

!!int FAR PASCAL wvsprintf(LPSTR,LPSTR,LPSTR);
!!int FAR cdecl wsprintf(LPSTR,LPSTR,...);

$IF DEFINED(SCROLL)

C
C Scroll Bar Constants
C
      INTEGER*2 SB_HORZ
      PARAMETER (SB_HORZ=    0)
      INTEGER*2 SB_VERT
      PARAMETER (SB_VERT=    1)
      INTEGER*2 SB_CTL
      PARAMETER (SB_CTL=     2)
      INTEGER*2 SB_BOTH
      PARAMETER (SB_BOTH=    3)

C
C Scroll Bar Commands
C
      INTEGER*2 SB_LINEUP
      PARAMETER (SB_LINEUP=         0)
      INTEGER*2 SB_LINEDOWN
      PARAMETER (SB_LINEDOWN=       1)
      INTEGER*2 SB_PAGEUP
      PARAMETER (SB_PAGEUP=         2)
      INTEGER*2 SB_PAGEDOWN
      PARAMETER (SB_PAGEDOWN=       3)
      INTEGER*2 SB_THUMBPOSITION
      PARAMETER (SB_THUMBPOSITION=  4)
      INTEGER*2 SB_THUMBTRACK
      PARAMETER (SB_THUMBTRACK=     5)
      INTEGER*2 SB_TOP
      PARAMETER (SB_TOP=            6)
      INTEGER*2 SB_BOTTOM
      PARAMETER (SB_BOTTOM=         7)
      INTEGER*2 SB_ENDSCROLL
      PARAMETER (SB_ENDSCROLL=      8)

$ENDIF ! NOSCROLL

$IF DEFINED(SHOWWINDOW)

C
C ShowWindow() Commands
C
      INTEGER*2 SW_HIDE
      PARAMETER (SW_HIDE=           0)
      INTEGER*2 SW_SHOWNORMAL
      PARAMETER (SW_SHOWNORMAL=     1)
      INTEGER*2 SW_NORMAL
      PARAMETER (SW_NORMAL=         1)
      INTEGER*2 SW_SHOWMINIMIZED
      PARAMETER (SW_SHOWMINIMIZED=  2)
      INTEGER*2 SW_SHOWMAXIMIZED
      PARAMETER (SW_SHOWMAXIMIZED=  3)
      INTEGER*2 SW_MAXIMIZE
      PARAMETER (SW_MAXIMIZE=       3)
      INTEGER*2 SW_SHOWNOACTIVATE
      PARAMETER (SW_SHOWNOACTIVATE= 4)
      INTEGER*2 SW_SHOW
      PARAMETER (SW_SHOW=           5)
      INTEGER*2 SW_MINIMIZE
      PARAMETER (SW_MINIMIZE=       6)
      INTEGER*2 SW_SHOWMINNOACTIVE
      PARAMETER (SW_SHOWMINNOACTIVE=7)
      INTEGER*2 SW_SHOWNA
      PARAMETER (SW_SHOWNA=         8)
      INTEGER*2 SW_RESTORE
      PARAMETER (SW_RESTORE=        9)

C
C Old ShowWindow() Commands
C
      INTEGER*2 HIDE_WINDOW
      PARAMETER (HIDE_WINDOW=        0)
      INTEGER*2 SHOW_OPENWINDOW
      PARAMETER (SHOW_OPENWINDOW=    1)
      INTEGER*2 SHOW_ICONWINDOW
      PARAMETER (SHOW_ICONWINDOW=    2)
      INTEGER*2 SHOW_FULLSCREEN
      PARAMETER (SHOW_FULLSCREEN=    3)
      INTEGER*2 SHOW_OPENNOACTIVATE
      PARAMETER (SHOW_OPENNOACTIVATE=4)

C
C Identifiers for the WM_SHOWWINDOW message
C
      INTEGER*2 SW_PARENTCLOSING
      PARAMETER (SW_PARENTCLOSING=   1)
      INTEGER*2 SW_OTHERZOOM
      PARAMETER (SW_OTHERZOOM=       2)
      INTEGER*2 SW_PARENTOPENING
      PARAMETER (SW_PARENTOPENING=   3)
      INTEGER*2 SW_OTHERUNZOOM
      PARAMETER (SW_OTHERUNZOOM=     4)

$ENDIF ! NOSHOWWINDOW

C
C Region Flags
C
      INTEGER*2 ERROR
      PARAMETER (ERROR=             0)
      INTEGER*2 NULLREGION
      PARAMETER (NULLREGION=        1)
      INTEGER*2 SIMPLEREGION
      PARAMETER (SIMPLEREGION=      2)
      INTEGER*2 COMPLEXREGION
      PARAMETER (COMPLEXREGION=     3)

C
C CombineRgn() Styles
C
      INTEGER*2 RGN_AND
      PARAMETER (RGN_AND=           1)
      INTEGER*2 RGN_OR
      PARAMETER (RGN_OR=            2)
      INTEGER*2 RGN_XOR
      PARAMETER (RGN_XOR=           3)
      INTEGER*2 RGN_DIFF
      PARAMETER (RGN_DIFF=          4)
      INTEGER*2 RGN_COPY
      PARAMETER (RGN_COPY=          5)

$IF DEFINED(VIRTUALKEYCODES)

C
C Virtual Keys, Standard Set
C
      BYTE VK_LBUTTON
      PARAMETER (VK_LBUTTON=        #01)
      BYTE VK_RBUTTON
      PARAMETER (VK_RBUTTON=        #02)
      BYTE VK_CANCEL
      PARAMETER (VK_CANCEL=         #03)
      BYTE VK_MBUTTON
      PARAMETER (VK_MBUTTON=        #04)   ! NOT contiguous with L & RBUTTON
      BYTE VK_BACK
      PARAMETER (VK_BACK=           #08)
      BYTE VK_TAB
      PARAMETER (VK_TAB=            #09)
      BYTE VK_CLEAR
      PARAMETER (VK_CLEAR=          #0C)
      BYTE VK_RETURN
      PARAMETER (VK_RETURN=         #0D)
      BYTE VK_SHIFT
      PARAMETER (VK_SHIFT=          #10)
      BYTE VK_CONTROL
      PARAMETER (VK_CONTROL=        #11)
      BYTE VK_MENU
      PARAMETER (VK_MENU=           #12)
      BYTE VK_PAUSE
      PARAMETER (VK_PAUSE=          #13)
      BYTE VK_CAPITAL
      PARAMETER (VK_CAPITAL=        #14)
      BYTE VK_ESCAPE
      PARAMETER (VK_ESCAPE=         #1B)
      BYTE VK_SPACE
      PARAMETER (VK_SPACE=          #20)
      BYTE VK_PRIOR
      PARAMETER (VK_PRIOR=          #21)
      BYTE VK_NEXT
      PARAMETER (VK_NEXT=           #22)
      BYTE VK_END
      PARAMETER (VK_END=            #23)
      BYTE VK_HOME
      PARAMETER (VK_HOME=           #24)
      BYTE VK_LEFT
      PARAMETER (VK_LEFT=           #25)
      BYTE VK_UP
      PARAMETER (VK_UP=             #26)
      BYTE VK_RIGHT
      PARAMETER (VK_RIGHT=          #27)
      BYTE VK_DOWN
      PARAMETER (VK_DOWN=           #28)
      BYTE VK_SELECT
      PARAMETER (VK_SELECT=         #29)
      BYTE VK_PRINT
      PARAMETER (VK_PRINT=          #2A)
      BYTE VK_EXECUTE
      PARAMETER (VK_EXECUTE=        #2B)
      BYTE VK_SNAPSHOT
      PARAMETER (VK_SNAPSHOT=       #2C)
C      BYTE VK_COPY
C      PARAMETER (VK_COPY=          #2C)  not used by keyboards
      BYTE VK_INSERT
      PARAMETER (VK_INSERT=         #2D)
      BYTE VK_DELETE
      PARAMETER (VK_DELETE=         #2E)
      BYTE VK_HELP
      PARAMETER (VK_HELP=           #2F)

C
C VK_A thru VK_Z are the same as their ASCII equivalents: 'A' thru 'Z'
C VK_0 thru VK_9 are the same as their ASCII equivalents: '0' thru '0'
C
      BYTE VK_NUMPAD0
      PARAMETER (VK_NUMPAD0=        #60)
      BYTE VK_NUMPAD1
      PARAMETER (VK_NUMPAD1=        #61)
      BYTE VK_NUMPAD2
      PARAMETER (VK_NUMPAD2=        #62)
      BYTE VK_NUMPAD3
      PARAMETER (VK_NUMPAD3=        #63)
      BYTE VK_NUMPAD4
      PARAMETER (VK_NUMPAD4=        #64)
      BYTE VK_NUMPAD5
      PARAMETER (VK_NUMPAD5=        #65)
      BYTE VK_NUMPAD6
      PARAMETER (VK_NUMPAD6=        #66)
      BYTE VK_NUMPAD7
      PARAMETER (VK_NUMPAD7=        #67)
      BYTE VK_NUMPAD8
      PARAMETER (VK_NUMPAD8=        #68)
      BYTE VK_NUMPAD9
      PARAMETER (VK_NUMPAD9=        #69)
      BYTE VK_MULTIPLY
      PARAMETER (VK_MULTIPLY=       #6A)
      BYTE VK_ADD
      PARAMETER (VK_ADD=            #6B)
      BYTE VK_SEPARATOR
      PARAMETER (VK_SEPARATOR=      #6C)
      BYTE VK_SUBTRACT
      PARAMETER (VK_SUBTRACT=       #6D)
      BYTE VK_DECIMAL
      PARAMETER (VK_DECIMAL=        #6E)
      BYTE VK_DIVIDE
      PARAMETER (VK_DIVIDE=         #6F)
      BYTE VK_F1
      PARAMETER (VK_F1=             #70)
      BYTE VK_F2
      PARAMETER (VK_F2=             #71)
      BYTE VK_F3
      PARAMETER (VK_F3=             #72)
      BYTE VK_F4
      PARAMETER (VK_F4=             #73)
      BYTE VK_F5
      PARAMETER (VK_F5=             #74)
      BYTE VK_F6
      PARAMETER (VK_F6=             #75)
      BYTE VK_F7
      PARAMETER (VK_F7=             #76)
      BYTE VK_F8
      PARAMETER (VK_F8=             #77)
      BYTE VK_F9
      PARAMETER (VK_F9=             #78)
      BYTE VK_F10
      PARAMETER (VK_F10=            #79)
      BYTE VK_F11
      PARAMETER (VK_F11=            #7A)
      BYTE VK_F12
      PARAMETER (VK_F12=            #7B)
      BYTE VK_F13
      PARAMETER (VK_F13=            #7C)
      BYTE VK_F14
      PARAMETER (VK_F14=            #7D)
      BYTE VK_F15
      PARAMETER (VK_F15=            #7E)
      BYTE VK_F16
      PARAMETER (VK_F16=            #7F)

      BYTE VK_NUMLOCK
      PARAMETER (VK_NUMLOCK=        #90)

$ENDIF ! NOVIRTUALKEYCODES

$IF DEFINED(WH)

C
C SetWindowsHook() codes
C
      INTEGER*2 WH_MSGFILTER
      PARAMETER (WH_MSGFILTER=     -1)
      INTEGER*2 WH_JOURNALRECORD
      PARAMETER (WH_JOURNALRECORD=  0)
      INTEGER*2 WH_JOURNALPLAYBACK
      PARAMETER (WH_JOURNALPLAYBACK=1)
      INTEGER*2 WH_KEYBOARD
      PARAMETER (WH_KEYBOARD=       2)
      INTEGER*2 WH_GETMESSAGE
      PARAMETER (WH_GETMESSAGE=     3)
      INTEGER*2 WH_CALLWNDPROC
      PARAMETER (WH_CALLWNDPROC=    4)
      INTEGER*2 WH_CBT
      PARAMETER (WH_CBT=            5)
      INTEGER*2 WH_SYSMSGFILTER
      PARAMETER (WH_SYSMSGFILTER=   6)
      INTEGER*2 WH_WINDOWMGR
      PARAMETER (WH_WINDOWMGR=      7)

C
C Hook Codes
C
      INTEGER*2 HC_LPLPFNNEXT
      PARAMETER (HC_LPLPFNNEXT=    -2)
      INTEGER*2 HC_LPFNNEXT
      PARAMETER (HC_LPFNNEXT=      -1)
      INTEGER*2 HC_ACTION
      PARAMETER (HC_ACTION=         0)
      INTEGER*2 HC_GETNEXT
      PARAMETER (HC_GETNEXT=        1)
      INTEGER*2 HC_SKIP
      PARAMETER (HC_SKIP=           2)
      INTEGER*2 HC_NOREM
      PARAMETER (HC_NOREM=          3)
      INTEGER*2 HC_NOREMOVE
      PARAMETER (HC_NOREMOVE=       3)
      INTEGER*2 HC_SYSMODALON
      PARAMETER (HC_SYSMODALON=     4)
      INTEGER*2 HC_SYSMODALOFF
      PARAMETER (HC_SYSMODALOFF=    5)

C
C CBT Hook Codes
C
      INTEGER*2 HCBT_MOVESIZE
      PARAMETER (HCBT_MOVESIZE=     0)
      INTEGER*2 HCBT_MINMAX
      PARAMETER (HCBT_MINMAX=       1)
      INTEGER*2 HCBT_QS
      PARAMETER (HCBT_QS=           2)

C
C WH_MSGFILTER Filter Proc Codes
C
      INTEGER*2 MSGF_DIALOGBOX
      PARAMETER (MSGF_DIALOGBOX=    0)
      INTEGER*2 MSGF_MESSAGEBOX
      PARAMETER (MSGF_MESSAGEBOX=   1)
      INTEGER*2 MSGF_MENU
      PARAMETER (MSGF_MENU=         2)
      INTEGER*2 MSGF_MOVE
      PARAMETER (MSGF_MOVE=         3)
      INTEGER*2 MSGF_SIZE
      PARAMETER (MSGF_SIZE=         4)
      INTEGER*2 MSGF_SCROLLBAR
      PARAMETER (MSGF_SCROLLBAR=    5)
      INTEGER*2 MSGF_NEXTWINDOW
      PARAMETER (MSGF_NEXTWINDOW=   6)

C
C Window Manager Hook Codes
C
      INTEGER*2 WC_INIT
      PARAMETER (WC_INIT=           1)
      INTEGER*2 WC_SWP
      PARAMETER (WC_SWP=            2)
      INTEGER*2 WC_DEFWINDOWPROC
      PARAMETER (WC_DEFWINDOWPROC=  3)
      INTEGER*2 WC_MINMAX
      PARAMETER (WC_MINMAX=         4)
      INTEGER*2 WC_MOVE
      PARAMETER (WC_MOVE=           5)
      INTEGER*2 WC_SIZE
      PARAMETER (WC_SIZE=           6)
      INTEGER*2 WC_DRAWCAPTION
      PARAMETER (WC_DRAWCAPTION=    7)

C
C Message Structure used in Journaling
C
      STRUCTURE /EVENTMSG/
	 INTEGER*2 message
	 INTEGER*2 paramL
	 INTEGER*2 paramH
	 INTEGER*4 time
      END STRUCTURE

!typedef EVENTMSG           *PEVENTMSGMSG;
!typedef EVENTMSG NEAR      *NPEVENTMSGMSG;
!typedef EVENTMSG FAR       *LPEVENTMSGMSG;

$ENDIF ! NOWH

      STRUCTURE /WNDCLASS/
	 INTEGER*2 style
	 INTEGER*4 lpfnWndProc
	 INTEGER*2 cbClsExtra
	 INTEGER*2 cbWndExtra
	 INTEGER*2 hInstance
	 INTEGER*2 hIcon
	 INTEGER*2 hCursor
	 INTEGER*2 hbrBackground
	 INTEGER*4 lpszMenuName ! LPSTR
	 INTEGER*4 lpszClassName ! LPSTR
      END STRUCTURE

!typedef WNDCLASS           *PWNDCLASS;
!typedef WNDCLASS NEAR      *NPWNDCLASS;
!typedef WNDCLASS FAR       *LPWNDCLASS;

$IF DEFINED(MSG)
C
C Message structure
C
      STRUCTURE /MSG/
	 INTEGER*2 hwnd
	 INTEGER*2 message
	 INTEGER*2 wParam
	 INTEGER*4 lParam
	 INTEGER*4 time
	 RECORD /POINT/ pt
      END STRUCTURE

!typedef MSG                *PMSG;
!typedef MSG NEAR           *NPMSG;
!typedef MSG FAR            *LPMSG;

$ENDIF ! NOMSG

$IF DEFINED(WINOFFSETS)

C
C Window field offsets for GetWindowLong() and GetWindowWord()
C
      INTEGER*2 GWL_WNDPROC
      PARAMETER (GWL_WNDPROC=       -4)
      INTEGER*2 GWW_HINSTANCE
      PARAMETER (GWW_HINSTANCE=     -6)
      INTEGER*2 GWW_HWNDPARENT
      PARAMETER (GWW_HWNDPARENT=    -8)
      INTEGER*2 GWW_ID
      PARAMETER (GWW_ID=            -12)
      INTEGER*2 GWL_STYLE
      PARAMETER (GWL_STYLE=         -16)
      INTEGER*2 GWL_EXSTYLE
      PARAMETER (GWL_EXSTYLE=       -20)

C
C Class field offsets for GetClassLong() and GetClassWord()
C
      INTEGER*2 GCL_MENUNAME
      PARAMETER (GCL_MENUNAME=      -8)
      INTEGER*2 GCW_HBRBACKGROUND
      PARAMETER (GCW_HBRBACKGROUND= -10)
      INTEGER*2 GCW_HCURSOR
      PARAMETER (GCW_HCURSOR=       -12)
      INTEGER*2 GCW_HICON
      PARAMETER (GCW_HICON=         -14)
      INTEGER*2 GCW_HMODULE
      PARAMETER (GCW_HMODULE=       -16)
      INTEGER*2 GCW_CBWNDEXTRA
      PARAMETER (GCW_CBWNDEXTRA=    -18)
      INTEGER*2 GCW_CBCLSEXTRA
      PARAMETER (GCW_CBCLSEXTRA=    -20)
      INTEGER*2 GCL_WNDPROC
      PARAMETER (GCL_WNDPROC=       -24)
      INTEGER*2 GCW_STYLE
      PARAMETER (GCW_STYLE=         -26)

$ENDIF ! NOWINOFFSETS

$IF DEFINED(WINMESSAGES)

C
C Window Messages
C
      INTEGER*2 WM_NULL
      PARAMETER (WM_NULL=           #0000)
      INTEGER*2 WM_CREATE
      PARAMETER (WM_CREATE=         #0001)
      INTEGER*2 WM_DESTROY
      PARAMETER (WM_DESTROY=        #0002)
      INTEGER*2 WM_MOVE
      PARAMETER (WM_MOVE=           #0003)
      INTEGER*2 WM_SIZE
      PARAMETER (WM_SIZE=           #0005)
      INTEGER*2 WM_ACTIVATE
      PARAMETER (WM_ACTIVATE=       #0006)
      INTEGER*2 WM_SETFOCUS
      PARAMETER (WM_SETFOCUS=       #0007)
      INTEGER*2 WM_KILLFOCUS
      PARAMETER (WM_KILLFOCUS=      #0008)
      INTEGER*2 WM_ENABLE
      PARAMETER (WM_ENABLE=         #000A)
      INTEGER*2 WM_SETREDRAW
      PARAMETER (WM_SETREDRAW=      #000B)
      INTEGER*2 WM_SETTEXT
      PARAMETER (WM_SETTEXT=        #000C)
      INTEGER*2 WM_GETTEXT
      PARAMETER (WM_GETTEXT=        #000D)
      INTEGER*2 WM_GETTEXTLENGTH
      PARAMETER (WM_GETTEXTLENGTH=  #000E)
      INTEGER*2 WM_PAINT
      PARAMETER (WM_PAINT=          #000F)
      INTEGER*2 WM_CLOSE
      PARAMETER (WM_CLOSE=          #0010)
      INTEGER*2 WM_QUERYENDSESSION
      PARAMETER (WM_QUERYENDSESSION=#0011)
      INTEGER*2 WM_QUIT
      PARAMETER (WM_QUIT=           #0012)
      INTEGER*2 WM_QUERYOPEN
      PARAMETER (WM_QUERYOPEN=      #0013)
      INTEGER*2 WM_ERASEBKGND
      PARAMETER (WM_ERASEBKGND=     #0014)
      INTEGER*2 WM_SYSCOLORCHANGE
      PARAMETER (WM_SYSCOLORCHANGE= #0015)
      INTEGER*2 WM_ENDSESSION
      PARAMETER (WM_ENDSESSION=     #0016)
      INTEGER*2 WM_SHOWWINDOW
      PARAMETER (WM_SHOWWINDOW=     #0018)
      INTEGER*2 WM_CTLCOLOR
      PARAMETER (WM_CTLCOLOR=       #0019)
      INTEGER*2 WM_WININICHANGE
      PARAMETER (WM_WININICHANGE=   #001A)
      INTEGER*2 WM_DEVMODECHANGE
      PARAMETER (WM_DEVMODECHANGE=  #001B)
      INTEGER*2 WM_ACTIVATEAPP
      PARAMETER (WM_ACTIVATEAPP=    #001C)
      INTEGER*2 WM_FONTCHANGE
      PARAMETER (WM_FONTCHANGE=     #001D)
      INTEGER*2 WM_TIMECHANGE
      PARAMETER (WM_TIMECHANGE=     #001E)
      INTEGER*2 WM_CANCELMODE
      PARAMETER (WM_CANCELMODE=     #001F)
      INTEGER*2 WM_SETCURSOR
      PARAMETER (WM_SETCURSOR=      #0020)
      INTEGER*2 WM_MOUSEACTIVATE
      PARAMETER (WM_MOUSEACTIVATE=  #0021)
      INTEGER*2 WM_CHILDACTIVATE
      PARAMETER (WM_CHILDACTIVATE=  #0022)
      INTEGER*2 WM_QUEUESYNC
      PARAMETER (WM_QUEUESYNC=      #0023)
      INTEGER*2 WM_GETMINMAXINFO
      PARAMETER (WM_GETMINMAXINFO=  #0024)
      INTEGER*2 WM_PAINTICON
      PARAMETER (WM_PAINTICON=      #0026)
      INTEGER*2 WM_ICONERASEBKGND
      PARAMETER (WM_ICONERASEBKGND= #0027)
      INTEGER*2 WM_NEXTDLGCTL
      PARAMETER (WM_NEXTDLGCTL=     #0028)
      INTEGER*2 WM_SPOOLERSTATUS
      PARAMETER (WM_SPOOLERSTATUS=  #002A)
      INTEGER*2 WM_DRAWITEM
      PARAMETER (WM_DRAWITEM=       #002B)
      INTEGER*2 WM_MEASUREITEM
      PARAMETER (WM_MEASUREITEM=    #002C)
      INTEGER*2 WM_DELETEITEM
      PARAMETER (WM_DELETEITEM=     #002D)
      INTEGER*2 WM_VKEYTOITEM
      PARAMETER (WM_VKEYTOITEM=     #002E)
      INTEGER*2 WM_CHARTOITEM
      PARAMETER (WM_CHARTOITEM=     #002F)
      INTEGER*2 WM_SETFONT
      PARAMETER (WM_SETFONT=        #0030)
      INTEGER*2 WM_GETFONT
      PARAMETER (WM_GETFONT=        #0031)

      INTEGER*2 WM_QUERYDRAGICON
      PARAMETER (WM_QUERYDRAGICON=  #0037)

      INTEGER*2 WM_COMPAREITEM
      PARAMETER (WM_COMPAREITEM=    #0039)
      INTEGER*2 WM_COMPACTING
      PARAMETER (WM_COMPACTING=     #0041)

      INTEGER*2 WM_NCCREATE
      PARAMETER (WM_NCCREATE=       #0081)
      INTEGER*2 WM_NCDESTROY
      PARAMETER (WM_NCDESTROY=      #0082)
      INTEGER*2 WM_NCCALCSIZE
      PARAMETER (WM_NCCALCSIZE=     #0083)
      INTEGER*2 WM_NCHITTEST
      PARAMETER (WM_NCHITTEST=      #0084)
      INTEGER*2 WM_NCPAINT
      PARAMETER (WM_NCPAINT=        #0085)
      INTEGER*2 WM_NCACTIVATE
      PARAMETER (WM_NCACTIVATE=     #0086)
      INTEGER*2 WM_GETDLGCODE
      PARAMETER (WM_GETDLGCODE=     #0087)
      INTEGER*2 WM_NCMOUSEMOVE
      PARAMETER (WM_NCMOUSEMOVE=    #00A0)
      INTEGER*2 WM_NCLBUTTONDOWN
      PARAMETER (WM_NCLBUTTONDOWN=  #00A1)
      INTEGER*2 WM_NCLBUTTONUP
      PARAMETER (WM_NCLBUTTONUP=    #00A2)
      INTEGER*2 WM_NCLBUTTONDBLCLK
      PARAMETER (WM_NCLBUTTONDBLCLK=#00A3)
      INTEGER*2 WM_NCRBUTTONDOWN
      PARAMETER (WM_NCRBUTTONDOWN=  #00A4)
      INTEGER*2 WM_NCRBUTTONUP
      PARAMETER (WM_NCRBUTTONUP=    #00A5)
      INTEGER*2 WM_NCRBUTTONDBLCLK
      PARAMETER (WM_NCRBUTTONDBLCLK=#00A6)
      INTEGER*2 WM_NCMBUTTONDOWN
      PARAMETER (WM_NCMBUTTONDOWN=  #00A7)
      INTEGER*2 WM_NCMBUTTONUP
      PARAMETER (WM_NCMBUTTONUP=    #00A8)
      INTEGER*2 WM_NCMBUTTONDBLCLK
      PARAMETER (WM_NCMBUTTONDBLCLK=#00A9)

      INTEGER*2 WM_KEYFIRST
      PARAMETER (WM_KEYFIRST=       #0100)
      INTEGER*2 WM_KEYDOWN
      PARAMETER (WM_KEYDOWN=        #0100)
      INTEGER*2 WM_KEYUP
      PARAMETER (WM_KEYUP=          #0101)
      INTEGER*2 WM_CHAR
      PARAMETER (WM_CHAR=           #0102)
      INTEGER*2 WM_DEADCHAR
      PARAMETER (WM_DEADCHAR=       #0103)
      INTEGER*2 WM_SYSKEYDOWN
      PARAMETER (WM_SYSKEYDOWN=     #0104)
      INTEGER*2 WM_SYSKEYUP
      PARAMETER (WM_SYSKEYUP=       #0105)
      INTEGER*2 WM_SYSCHAR
      PARAMETER (WM_SYSCHAR=        #0106)
      INTEGER*2 WM_SYSDEADCHAR
      PARAMETER (WM_SYSDEADCHAR=    #0107)
      INTEGER*2 WM_KEYLAST
      PARAMETER (WM_KEYLAST=        #0108)

      INTEGER*2 WM_INITDIALOG
      PARAMETER (WM_INITDIALOG=     #0110)
      INTEGER*2 WM_COMMAND
      PARAMETER (WM_COMMAND=        #0111)
      INTEGER*2 WM_SYSCOMMAND
      PARAMETER (WM_SYSCOMMAND=     #0112)
      INTEGER*2 WM_TIMER
      PARAMETER (WM_TIMER=          #0113)
      INTEGER*2 WM_HSCROLL
      PARAMETER (WM_HSCROLL=        #0114)
      INTEGER*2 WM_VSCROLL
      PARAMETER (WM_VSCROLL=        #0115)
      INTEGER*2 WM_INITMENU
      PARAMETER (WM_INITMENU=       #0116)
      INTEGER*2 WM_INITMENUPOPUP
      PARAMETER (WM_INITMENUPOPUP=  #0117)
      INTEGER*2 WM_MENUSELECT
      PARAMETER (WM_MENUSELECT=     #011F)
      INTEGER*2 WM_MENUCHAR
      PARAMETER (WM_MENUCHAR=       #0120)
      INTEGER*2 WM_ENTERIDLE
      PARAMETER (WM_ENTERIDLE=      #0121)

      INTEGER*2 WM_MOUSEFIRST
      PARAMETER (WM_MOUSEFIRST=     #0200)
      INTEGER*2 WM_MOUSEMOVE
      PARAMETER (WM_MOUSEMOVE=      #0200)
      INTEGER*2 WM_LBUTTONDOWN
      PARAMETER (WM_LBUTTONDOWN=    #0201)
      INTEGER*2 WM_LBUTTONUP
      PARAMETER (WM_LBUTTONUP=      #0202)
      INTEGER*2 WM_LBUTTONDBLCLK
      PARAMETER (WM_LBUTTONDBLCLK=  #0203)
      INTEGER*2 WM_RBUTTONDOWN
      PARAMETER (WM_RBUTTONDOWN=    #0204)
      INTEGER*2 WM_RBUTTONUP
      PARAMETER (WM_RBUTTONUP=      #0205)
      INTEGER*2 WM_RBUTTONDBLCLK
      PARAMETER (WM_RBUTTONDBLCLK=  #0206)
      INTEGER*2 WM_MBUTTONDOWN
      PARAMETER (WM_MBUTTONDOWN=    #0207)
      INTEGER*2 WM_MBUTTONUP
      PARAMETER (WM_MBUTTONUP=      #0208)
      INTEGER*2 WM_MBUTTONDBLCLK
      PARAMETER (WM_MBUTTONDBLCLK=  #0209)
      INTEGER*2 WM_MOUSELAST
      PARAMETER (WM_MOUSELAST=      #0209)

      INTEGER*2 WM_PARENTNOTIFY
      PARAMETER (WM_PARENTNOTIFY=   #0210)
      INTEGER*2 WM_MDICREATE
      PARAMETER (WM_MDICREATE=      #0220)
      INTEGER*2 WM_MDIDESTROY
      PARAMETER (WM_MDIDESTROY=     #0221)
      INTEGER*2 WM_MDIACTIVATE
      PARAMETER (WM_MDIACTIVATE=    #0222)
      INTEGER*2 WM_MDIRESTORE
      PARAMETER (WM_MDIRESTORE=     #0223)
      INTEGER*2 WM_MDINEXT
      PARAMETER (WM_MDINEXT=        #0224)
      INTEGER*2 WM_MDIMAXIMIZE
      PARAMETER (WM_MDIMAXIMIZE=    #0225)
      INTEGER*2 WM_MDITILE
      PARAMETER (WM_MDITILE=        #0226)
      INTEGER*2 WM_MDICASCADE
      PARAMETER (WM_MDICASCADE=     #0227)
      INTEGER*2 WM_MDIICONARRANGE
      PARAMETER (WM_MDIICONARRANGE= #0228)
      INTEGER*2 WM_MDIGETACTIVE
      PARAMETER (WM_MDIGETACTIVE=   #0229)
      INTEGER*2 WM_MDISETMENU
      PARAMETER (WM_MDISETMENU=     #0230)

      INTEGER*2 WM_CUT
      PARAMETER (WM_CUT=            #0300)
      INTEGER*2 WM_COPY
      PARAMETER (WM_COPY=           #0301)
      INTEGER*2 WM_PASTE
      PARAMETER (WM_PASTE=          #0302)
      INTEGER*2 WM_CLEAR
      PARAMETER (WM_CLEAR=          #0303)
      INTEGER*2 WM_UNDO
      PARAMETER (WM_UNDO=           #0304)
      INTEGER*2 WM_RENDERFORMAT
      PARAMETER (WM_RENDERFORMAT=   #0305)
      INTEGER*2 WM_RENDERALLFORMATS
      PARAMETER (WM_RENDERALLFORMATS=#0306)
      INTEGER*2 WM_DESTROYCLIPBOARD
      PARAMETER (WM_DESTROYCLIPBOARD=#0307)
      INTEGER*2 WM_DRAWCLIPBOARD
      PARAMETER (WM_DRAWCLIPBOARD=   #0308)
      INTEGER*2 WM_PAINTCLIPBOARD
      PARAMETER (WM_PAINTCLIPBOARD=  #0309)
      INTEGER*2 WM_VSCROLLCLIPBOARD
      PARAMETER (WM_VSCROLLCLIPBOARD=#030A)
      INTEGER*2 WM_SIZECLIPBOARD
      PARAMETER (WM_SIZECLIPBOARD=   #030B)
      INTEGER*2 WM_ASKCBFORMATNAME
      PARAMETER (WM_ASKCBFORMATNAME= #030C)
      INTEGER*2 WM_CHANGECBCHAIN
      PARAMETER (WM_CHANGECBCHAIN=   #030D)
      INTEGER*2 WM_HSCROLLCLIPBOARD
      PARAMETER (WM_HSCROLLCLIPBOARD=#030E)
      INTEGER*2 WM_QUERYNEWPALETTE
      PARAMETER (WM_QUERYNEWPALETTE= #030F)
      INTEGER*2 WM_PALETTEISCHANGING
      PARAMETER (WM_PALETTEISCHANGING=#0310)
      INTEGER*2 WM_PALETTECHANGED
      PARAMETER (WM_PALETTECHANGED=  #0311)

C
C NOTE: All Message Numbers below #0400 are RESERVED.
C
C Private Window Messages Start Here:
C
      INTEGER*2 WM_USER
      PARAMETER (WM_USER=           #0400)

$IF DEFINED(NCMESSAGES)

C
C WM_SYNCTASK Commands
C
      INTEGER*2 ST_BEGINSWP
      PARAMETER (ST_BEGINSWP=       0)
      INTEGER*2 ST_ENDSWP
      PARAMETER (ST_ENDSWP=         1)

C
C WinWhere() Area Codes
C
      INTEGER*2 HTERROR
      PARAMETER (HTERROR=          -2)
      INTEGER*2 HTTRANSPARENT
      PARAMETER (HTTRANSPARENT=    -1)
      INTEGER*2 HTNOWHERE
      PARAMETER (HTNOWHERE=         0)
      INTEGER*2 HTCLIENT
      PARAMETER (HTCLIENT=          1)
      INTEGER*2 HTCAPTION
      PARAMETER (HTCAPTION=         2)
      INTEGER*2 HTSYSMENU
      PARAMETER (HTSYSMENU=         3)
      INTEGER*2 HTGROWBOX
      PARAMETER (HTGROWBOX=         4)
      INTEGER*2 HTSIZE
      PARAMETER (HTSIZE=            HTGROWBOX)
      INTEGER*2 HTMENU
      PARAMETER (HTMENU=            5)
      INTEGER*2 HTHSCROLL
      PARAMETER (HTHSCROLL=         6)
      INTEGER*2 HTVSCROLL
      PARAMETER (HTVSCROLL=         7)
      INTEGER*2 HTREDUCE
      PARAMETER (HTREDUCE=          8)
      INTEGER*2 HTZOOM
      PARAMETER (HTZOOM=            9)
      INTEGER*2 HTLEFT
      PARAMETER (HTLEFT=            10)
      INTEGER*2 HTRIGHT
      PARAMETER (HTRIGHT=           11)
      INTEGER*2 HTTOP
      PARAMETER (HTTOP=             12)
      INTEGER*2 HTTOPLEFT
      PARAMETER (HTTOPLEFT=         13)
      INTEGER*2 HTTOPRIGHT
      PARAMETER (HTTOPRIGHT=        14)
      INTEGER*2 HTBOTTOM
      PARAMETER (HTBOTTOM=          15)
      INTEGER*2 HTBOTTOMLEFT
      PARAMETER (HTBOTTOMLEFT=      16)
      INTEGER*2 HTBOTTOMRIGHT
      PARAMETER (HTBOTTOMRIGHT=     17)
      INTEGER*2 HTSIZEFIRST
      PARAMETER (HTSIZEFIRST=       HTLEFT)
      INTEGER*2 HTSIZELAST
      PARAMETER (HTSIZELAST=        HTBOTTOMRIGHT)

$ENDIF ! NONCMESSAGES

C
C WM_MOUSEACTIVATE Return Codes
C
      INTEGER*2 MA_ACTIVATE
      PARAMETER (MA_ACTIVATE=       1)
      INTEGER*2 MA_ACTIVATEANDEAT
      PARAMETER (MA_ACTIVATEANDEAT= 2)
      INTEGER*2 MA_NOACTIVATE
      PARAMETER (MA_NOACTIVATE=     3)

      INTEGER*2 RegisterWindowMessage [EXTERN]

C
C Size Message Commands
C
      INTEGER*2 SIZENORMAL
      PARAMETER (SIZENORMAL=        0)
      INTEGER*2 SIZEICONIC
      PARAMETER (SIZEICONIC=        1)
      INTEGER*2 SIZEFULLSCREEN
      PARAMETER (SIZEFULLSCREEN=    2)
      INTEGER*2 SIZEZOOMSHOW
      PARAMETER (SIZEZOOMSHOW=      3)
      INTEGER*2 SIZEZOOMHIDE
      PARAMETER (SIZEZOOMHIDE=      4)

$IF DEFINED(KEYSTATES)

C
C Key State Masks for Mouse Messages
C
      INTEGER*2 MK_LBUTTON
      PARAMETER (MK_LBUTTON=        #0001)
      INTEGER*2 MK_RBUTTON
      PARAMETER (MK_RBUTTON=        #0002)
      INTEGER*2 MK_SHIFT
      PARAMETER (MK_SHIFT=          #0004)
      INTEGER*2 MK_CONTROL
      PARAMETER (MK_CONTROL=        #0008)
      INTEGER*2 MK_MBUTTON
      PARAMETER (MK_MBUTTON=        #0010)

$ENDIF ! NOKEYSTATES

$ENDIF ! NOWINMESSAGES

$IF DEFINED(WINSTYLES)

C
C Window Styles
C
      INTEGER*4 WS_OVERLAPPED
      PARAMETER (WS_OVERLAPPED=     #00000000)
      INTEGER*4 WS_POPUP
      PARAMETER (WS_POPUP=          #80000000)
      INTEGER*4 WS_CHILD
      PARAMETER (WS_CHILD=          #40000000)
      INTEGER*4 WS_MINIMIZE
      PARAMETER (WS_MINIMIZE=       #20000000)
      INTEGER*4 WS_VISIBLE
      PARAMETER (WS_VISIBLE=        #10000000)
      INTEGER*4 WS_DISABLED
      PARAMETER (WS_DISABLED=       #08000000)
      INTEGER*4 WS_CLIPSIBLINGS
      PARAMETER (WS_CLIPSIBLINGS=   #04000000)
      INTEGER*4 WS_CLIPCHILDREN
      PARAMETER (WS_CLIPCHILDREN=   #02000000)
      INTEGER*4 WS_MAXIMIZE
      PARAMETER (WS_MAXIMIZE=       #01000000)
      INTEGER*4 WS_CAPTION
      PARAMETER (WS_CAPTION=        #00C00000) ! WS_BORDER .OR. WS_DLGFRAME
      INTEGER*4 WS_BORDER
      PARAMETER (WS_BORDER=         #00800000)
      INTEGER*4 WS_DLGFRAME
      PARAMETER (WS_DLGFRAME=       #00400000)
      INTEGER*4 WS_VSCROLL
      PARAMETER (WS_VSCROLL=        #00200000)
      INTEGER*4 WS_HSCROLL
      PARAMETER (WS_HSCROLL=        #00100000)
      INTEGER*4 WS_SYSMENU
      PARAMETER (WS_SYSMENU=        #00080000)
      INTEGER*4 WS_THICKFRAME
      PARAMETER (WS_THICKFRAME=     #00040000)
      INTEGER*4 WS_GROUP
      PARAMETER (WS_GROUP=          #00020000)
      INTEGER*4 WS_TABSTOP
      PARAMETER (WS_TABSTOP=        #00010000)

      INTEGER*4 WS_MINIMIZEBOX
      PARAMETER (WS_MINIMIZEBOX=    #00020000)
      INTEGER*4 WS_MAXIMIZEBOX
      PARAMETER (WS_MAXIMIZEBOX=    #00010000)

      INTEGER*4 WS_TILED
      PARAMETER (WS_TILED=          WS_OVERLAPPED)
      INTEGER*4 WS_ICONIC
      PARAMETER (WS_ICONIC=         WS_MINIMIZE)
      INTEGER*4 WS_SIZEBOX
      PARAMETER (WS_SIZEBOX=        WS_THICKFRAME)

C
C Common Window Styles
C
      INTEGER*4 WS_OVERLAPPEDWINDOW
      PARAMETER (WS_OVERLAPPEDWINDOW=WS_OVERLAPPED.OR.WS_CAPTION.OR.
     *  WS_SYSMENU.OR.WS_THICKFRAME.OR.WS_MINIMIZEBOX.OR.WS_MAXIMIZEBOX)
      INTEGER*4 WS_POPUPWINDOW
      PARAMETER (WS_POPUPWINDOW=WS_POPUP.OR.WS_BORDER.OR.WS_SYSMENU)
      INTEGER*4 WS_CHILDWINDOW
      PARAMETER (WS_CHILDWINDOW=WS_CHILD)

      INTEGER*4 WS_TILEDWINDOW
      PARAMETER (WS_TILEDWINDOW=WS_OVERLAPPEDWINDOW)

C
C Extended Window Styles
C
      INTEGER*2 WS_EX_DLGMODALFRAME
      PARAMETER (WS_EX_DLGMODALFRAME=#00000001)
      INTEGER*2 WS_EX_NOPARENTNOTIFY
      PARAMETER (WS_EX_NOPARENTNOTIFY=#00000004)

C
C Class styles
C
      INTEGER*2 CS_VREDRAW
      PARAMETER (CS_VREDRAW=        #0001)
      INTEGER*2 CS_HREDRAW
      PARAMETER (CS_HREDRAW=        #0002)
      INTEGER*2 CS_KEYCVTWINDOW
      PARAMETER (CS_KEYCVTWINDOW=   #0004)
      INTEGER*2 CS_DBLCLKS
      PARAMETER (CS_DBLCLKS=        #0008)
C                                   #0010 -- no longer used
      INTEGER*2 CS_OWNDC
      PARAMETER (CS_OWNDC=          #0020)
      INTEGER*2 CS_CLASSDC
      PARAMETER (CS_CLASSDC=        #0040)
      INTEGER*2 CS_PARENTDC
      PARAMETER (CS_PARENTDC=       #0080)
      INTEGER*2 CS_NOKEYCVT
      PARAMETER (CS_NOKEYCVT=       #0100)
      INTEGER*2 CS_NOCLOSE
      PARAMETER (CS_NOCLOSE=        #0200)
      INTEGER*2 CS_SAVEBITS
      PARAMETER (CS_SAVEBITS=       #0800)
      INTEGER*2 CS_BYTEALIGNCLIENT
      PARAMETER (CS_BYTEALIGNCLIENT=#1000)
      INTEGER*2 CS_BYTEALIGNWINDOW
      PARAMETER (CS_BYTEALIGNWINDOW=#2000)
      INTEGER*2 CS_GLOBALCLASS
      PARAMETER (CS_GLOBALCLASS=    #4000)   ! Global window class

$ENDIF ! NOWINSTYLES

$IF DEFINED(CLIPBOARD)

C
C Predefined Clipboard Formats
C
      INTEGER*2 CF_TEXT
      PARAMETER (CF_TEXT=           1)
      INTEGER*2 CF_BITMAP
      PARAMETER (CF_BITMAP=         2)
      INTEGER*2 CF_METAFILEPICT
      PARAMETER (CF_METAFILEPICT=   3)
      INTEGER*2 CF_SYLK
      PARAMETER (CF_SYLK=           4)
      INTEGER*2 CF_DIF
      PARAMETER (CF_DIF=            5)
      INTEGER*2 CF_TIFF
      PARAMETER (CF_TIFF=           6)
      INTEGER*2 CF_OEMTEXT
      PARAMETER (CF_OEMTEXT=        7)
      INTEGER*2 CF_DIB
      PARAMETER (CF_DIB=            8)
      INTEGER*2 CF_PALETTE
      PARAMETER (CF_PALETTE=        9)

      INTEGER*2 CF_OWNERDISPLAY
      PARAMETER (CF_OWNERDISPLAY=   #0080)
      INTEGER*2 CF_DSPTEXT
      PARAMETER (CF_DSPTEXT=        #0081)
      INTEGER*2 CF_DSPBITMAP
      PARAMETER (CF_DSPBITMAP=      #0082)
      INTEGER*2 CF_DSPMETAFILEPICT
      PARAMETER (CF_DSPMETAFILEPICT=#0083)

C
C "Private" formats don't get GlobalFree()'d
C
      INTEGER*2 CF_PRIVATEFIRST
      PARAMETER (CF_PRIVATEFIRST=   #0200)
      INTEGER*2 CF_PRIVATELAST
      PARAMETER (CF_PRIVATELAST=    #02FF)

C
C "GDIOBJ" formats do get DeleteObject()'d
C
      INTEGER*2 CF_GDIOBJFIRST
      PARAMETER (CF_GDIOBJFIRST=    #0300)
      INTEGER*2 CF_GDIOBJLAST
      PARAMETER (CF_GDIOBJLAST=     #03FF)

$ENDIF ! NOCLIPBOARD

      STRUCTURE /PAINTSTRUCT/
	 INTEGER*2 hdc
	 INTEGER*2 fErase ! BOOL
	 RECORD /RECT/ rcPaint
	 INTEGER*2 fRestore ! BOOL
	 INTEGER*2 fIncUpdate ! BOOL
	 BYTE rgbReserved(16)
      END STRUCTURE

!typedef PAINTSTRUCT        *PPAINTSTRUCT;
!typedef PAINTSTRUCT NEAR    *NPPAINTSTRUCT;
!typedef PAINTSTRUCT FAR     *LPPAINTSTRUCT;

      STRUCTURE /CREATESTRUCT/
	 INTEGER*4 lpCreateParams ! LPSTR
	 INTEGER*2 hInstance
	 INTEGER*2 hMenu
	 INTEGER*2 hwndParent ! HWND
	 INTEGER*2 cy
	 INTEGER*2 cx
	 INTEGER*2 y
	 INTEGER*2 x
	 INTEGER*4 style
	 INTEGER*4 lpszName ! LPSTR
	 INTEGER*4 lpszClass ! LPSTR
	 INTEGER*2 dwExStyle
      END STRUCTURE

!typedef CREATESTRUCT FAR    *LPCREATESTRUCT;

C
C Owner draw control types
C
      INTEGER*2 ODT_MENU
      PARAMETER (ODT_MENU=      1)
      INTEGER*2 ODT_LISTBOX
      PARAMETER (ODT_LISTBOX=   2)
      INTEGER*2 ODT_COMBOBOX
      PARAMETER (ODT_COMBOBOX=  3)
      INTEGER*2 ODT_BUTTON
      PARAMETER (ODT_BUTTON=    4)

C
C Owner draw actions
C
      INTEGER*2 ODA_DRAWENTIRE
      PARAMETER (ODA_DRAWENTIRE=#0001)
      INTEGER*2 ODA_SELECT
      PARAMETER (ODA_SELECT=    #0002)
      INTEGER*2 ODA_FOCUS
      PARAMETER (ODA_FOCUS=     #0004)

C
C Owner draw state
C
      INTEGER*2 ODS_SELECTED
      PARAMETER (ODS_SELECTED=  #0001)
      INTEGER*2 ODS_GRAYED
      PARAMETER (ODS_GRAYED=    #0002)
      INTEGER*2 ODS_DISABLED
      PARAMETER (ODS_DISABLED=  #0004)
      INTEGER*2 ODS_CHECKED
      PARAMETER (ODS_CHECKED=   #0008)
      INTEGER*2 ODS_FOCUS
      PARAMETER (ODS_FOCUS=     #0010)

C
C MEASUREITEMSTRUCT for ownerdraw
C
      STRUCTURE /MEASUREITEMSTRUCT/
	 INTEGER*2 CtlType
	 INTEGER*2 CtlID
	 INTEGER*2 itemID
	 INTEGER*2 itemWidth
	 INTEGER*2 itemHeight
	 INTEGER*4 itemData
      END STRUCTURE

!typedef MEASUREITEMSTRUCT NEAR *PMEASUREITEMSTRUCT;
!typedef MEASUREITEMSTRUCT FAR  *LPMEASUREITEMSTRUCT;

C
C DRAWITEMSTRUCT for ownerdraw
C
      STRUCTURE /DRAWITEMSTRUCT/
	 INTEGER*2 CtlType
	 INTEGER*2 CtlID
	 INTEGER*2 itemID
	 INTEGER*2 itemAction
	 INTEGER*2 itemState
	 INTEGER*2 hwndItem
	 INTEGER*2 hDC
	 RECORD /RECT/ rcItem
	 INTEGER*4 itemData
      END STRUCTURE

!typedef DRAWITEMSTRUCT NEAR *PDRAWITEMSTRUCT;
!typedef DRAWITEMSTRUCT FAR  *LPDRAWITEMSTRUCT;

C
C DELETEITEMSTRUCT for ownerdraw
C
      STRUCTURE /DELETEITEMSTRUCT/
	 INTEGER*2 CtlType
	 INTEGER*2 CtlID
	 INTEGER*2 itemID
	 INTEGER*2 hwndItem
	 INTEGER*4 itemData
      END STRUCTURE

!typedef DELETEITEMSTRUCT NEAR *PDELETEITEMSTRUCT;
!typedef DELETEITEMSTRUCT FAR  *LPDELETEITEMSTRUCT;

C
C COMPAREITEMSTUCT for ownerdraw sorting
C
      STRUCTURE /COMPAREITEMSTRUCT/
	 INTEGER*2 CtlType
	 INTEGER*2 CtlID
	 INTEGER*2 hwndItem
	 INTEGER*2 itemID1
	 INTEGER*4 itemData1
	 INTEGER*2 itemID2
	 INTEGER*4 itemData2
      END STRUCTURE

!typedef COMPAREITEMSTRUCT NEAR *PCOMPAREITEMSTRUCT;
!typedef COMPAREITEMSTRUCT FAR  *LPCOMPAREITEMSTRUCT;

$IF DEFINED(MSG)

C
C Message Function Templates
C
      INTEGER*2 GetMessage [EXTERN]
      INTEGER*2 TranslateMessage [EXTERN]
      INTEGER*4 DispatchMessage [EXTERN]
      INTEGER*2 PeekMessage [EXTERN]

C
C PeekMessage() Options
C
      INTEGER*2 PM_NOREMOVE
      PARAMETER (PM_NOREMOVE=       #0000)
      INTEGER*2 PM_REMOVE
      PARAMETER (PM_REMOVE=         #0001)
      INTEGER*2 PM_NOYIELD
      PARAMETER (PM_NOYIELD=        #0002)

$ENDIF ! NOMSG

$IF DEFINED(WIN_INTERNAL)
$IF .NOT.DEFINED(LSTRING)
$DEFINE NOLSTRING
$ENDIF
$IF .NOT.DEFINED(LFILEIO)
$DEFINE NOLFILEIO
$ENDIF
$ENDIF

$IF DEFINED(LSTRING)
!%int         FAR PASCAL lstrcmp( LPSTR, LPSTR );
!%int         FAR PASCAL lstrcmpi( LPSTR, LPSTR );
!%LPSTR       FAR PASCAL lstrcpy( LPSTR, LPSTR );
!%LPSTR       FAR PASCAL lstrcat( LPSTR, LPSTR );
!%int         FAR PASCAL lstrlen( LPSTR );
$ENDIF ! NOLSTRING

$IF DEFINED(LFILEIO)
!%int         FAR PASCAL _lopen( LPSTR, int );
!%int         FAR PASCAL _lclose( int );
!%int       FAR PASCAL _lcreat( LPSTR, int );
!%LONG        FAR PASCAL _llseek( int, long, int );
!%WORD        FAR PASCAL _lread( int, LPSTR, int );
!%WORD        FAR PASCAL _lwrite( int, LPSTR, int );

      INTEGER*2 READ
      PARAMETER (READ=        0)   ! Flags for _lopen
      INTEGER*2 WRITE
      PARAMETER (WRITE=       1)
      INTEGER*2 READ_WRITE
      PARAMETER (READ_WRITE=   2)

$ENDIF ! NOLFILEIO

      INTEGER*2 ExitWindows [EXTERN]

      INTEGER*2 SwapMouseButton [EXTERN]
      INTEGER*2 GetMessagePos [EXTERN]
      INTEGER*2 GetMessageTime [EXTERN]

      INTEGER*2 GetSysModalWindow [EXTERN]
      INTEGER*2 SetSysModalWindow [EXTERN]

      INTEGER*4 SendMessage [EXTERN]
      INTEGER*2 PostMessage [EXTERN]
      INTEGER*2 PostAppMessage [EXTERN]
      INTEGER*4 DefWindowProc [EXTERN]
      INTEGER*4 CallWindowProc [EXTERN]
      INTEGER*2 InSendMessage [EXTERN]

      INTEGER*2 GetDoubleClickTime [EXTERN]

      INTEGER*2  RegisterClass [EXTERN]
      INTEGER*2 UnregisterClass [EXTERN]
      INTEGER*2 GetClassInfo [EXTERN]

      INTEGER*2 SetMessageQueue [EXTERN]

      INTEGER*2 CW_USEDEFAULT
      PARAMETER (CW_USEDEFAULT=     #8000)

      INTEGER*2 CreateWindow [EXTERN]
      INTEGER*2 CreateWindowEx [EXTERN]

      INTEGER*2 IsWindow [EXTERN]
      INTEGER*2 IsChild [EXTERN]
      INTEGER*2 DestroyWindow [EXTERN]

      INTEGER*2 ShowWindow [EXTERN]
      INTEGER*2 FlashWindow [EXTERN]

      INTEGER*2 OpenIcon [EXTERN]

$IF DEFINED(DEFERWINDOWPOS)

      INTEGER*2 BeginDeferWindowPos [EXTERN]
      INTEGER*2 DeferWindowPos [EXTERN]

$ENDIF ! NODEFERWINDOWPOS

      INTEGER*2 IsWindowVisible [EXTERN]
      INTEGER*2 IsIconic [EXTERN]
      INTEGER*2 AnyPopup [EXTERN]
      INTEGER*2 IsZoomed [EXTERN]

C
C SetWindowPos Flags
C
      INTEGER*2 SWP_NOSIZE
      PARAMETER (SWP_NOSIZE=        #0001)
      INTEGER*2 SWP_NOMOVE
      PARAMETER (SWP_NOMOVE=        #0002)
      INTEGER*2 SWP_NOZORDER
      PARAMETER (SWP_NOZORDER=      #0004)
      INTEGER*2 SWP_NOREDRAW
      PARAMETER (SWP_NOREDRAW=      #0008)
      INTEGER*2 SWP_NOACTIVATE
      PARAMETER (SWP_NOACTIVATE=    #0010)
      INTEGER*2 SWP_DRAWFRAME
      PARAMETER (SWP_DRAWFRAME=     #0020)
      INTEGER*2 SWP_SHOWWINDOW
      PARAMETER (SWP_SHOWWINDOW=    #0040)
      INTEGER*2 SWP_HIDEWINDOW
      PARAMETER (SWP_HIDEWINDOW=    #0080)
      INTEGER*2 SWP_NOCOPYBITS
      PARAMETER (SWP_NOCOPYBITS=    #0100)
      INTEGER*2 SWP_NOREPOSITION
      PARAMETER (SWP_NOREPOSITION=  #0200)

$IF DEFINED(CTLMGR)

      INTEGER*2 CreateDialog [EXTERN]
      INTEGER*2 CreateDialogIndirect [EXTERN]
      INTEGER*2 CreateDialogParam [EXTERN]
      INTEGER*2 CreateDialogIndirectParam [EXTERN]
      INTEGER*2 DialogBox [EXTERN]
      INTEGER*2 DialogBoxIndirect [EXTERN]
      INTEGER*2 DialogBoxParam [EXTERN]
      INTEGER*2 DialogBoxIndirectParam [EXTERN]
      INTEGER*2 GetDlgItem [EXTERN]
      INTEGER*2 GetDlgItemInt [EXTERN]
      INTEGER*2 GetDlgItemText [EXTERN]
      INTEGER*2 IsDlgButtonChecked [EXTERN]
      INTEGER*4 SendDlgItemMessage [EXTERN]
      INTEGER*2 GetNextDlgGroupItem [EXTERN]
      INTEGER*2 GetNextDlgTabItem [EXTERN]
      INTEGER*2 GetDlgCtrlID [EXTERN]
      INTEGER*4 GetDialogBaseUnits [EXTERN]
      INTEGER*4 DefDlgProc [EXTERN]

      INTEGER*2 DLGWINDOWEXTRA   ! Window extra byted needed for private dialog classes
      PARAMETER (DLGWINDOWEXTRA=30)

$ENDIF ! NOCTLMGR

C
C Windows Functions
C

$IF DEFINED(MSG)
      INTEGER*2 CallMsgFilter [EXTERN]
$ENDIF

$IF DEFINED(CLIPBOARD)

C
C Clipboard Manager Functions
C
      INTEGER*2 OpenClipboard [EXTERN]
      INTEGER*2 CloseClipboard [EXTERN]
      INTEGER*2 GetClipboardOwner [EXTERN]
      INTEGER*2 SetClipboardViewer [EXTERN]
      INTEGER*2 GetClipboardViewer [EXTERN]
      INTEGER*2 ChangeClipboardChain [EXTERN]
      INTEGER*2 SetClipboardData [EXTERN]
      INTEGER*2 GetClipboardData [EXTERN]
      INTEGER*2 RegisterClipboardFormat [EXTERN]
      INTEGER*2 CountClipboardFormats [EXTERN]
      INTEGER*2 EnumClipboardFormats [EXTERN]
      INTEGER*2 GetClipboardFormatName [EXTERN]
      INTEGER*2 EmptyClipboard [EXTERN]
      INTEGER*2 IsClipboardFormatAvailable [EXTERN]
      INTEGER*2 GetPriorityClipboardFormat [EXTERN]

$ENDIF ! NOCLIPBOARD

      INTEGER*2 SetFocus [EXTERN]
      INTEGER*2 GetFocus [EXTERN]
      INTEGER*2 GetActiveWindow [EXTERN]
      INTEGER*2 GetKeyState [EXTERN]
      INTEGER*2 GetAsyncKeyState [EXTERN]
      INTEGER*2 EnableHardwareInput [EXTERN]
      INTEGER*2 GetInputState [EXTERN]
      INTEGER*2 GetCapture [EXTERN]
      INTEGER*2 SetCapture [EXTERN]

C
C Windows Functions
C
      INTEGER*2 SetTimer [EXTERN]
      INTEGER*2 KillTimer [EXTERN]
      INTEGER*2 EnableWindow [EXTERN]
      INTEGER*2 IsWindowEnabled [EXTERN]
      INTEGER*2 LoadAccelerators [EXTERN]

$IF DEFINED(MSG)
      INTEGER*2 TranslateAccelerator [EXTERN]
$ENDIF

$IF DEFINED(SYSMETRICS)

C
C GetSystemMetrics() codes
C
      INTEGER*2 SM_CXSCREEN
      PARAMETER (SM_CXSCREEN=       0)
      INTEGER*2 SM_CYSCREEN
      PARAMETER (SM_CYSCREEN=       1)
      INTEGER*2 SM_CXVSCROLL
      PARAMETER (SM_CXVSCROLL=      2)
      INTEGER*2 SM_CYHSCROLL
      PARAMETER (SM_CYHSCROLL=      3)
      INTEGER*2 SM_CYCAPTION
      PARAMETER (SM_CYCAPTION=      4)
      INTEGER*2 SM_CXBORDER
      PARAMETER (SM_CXBORDER=       5)
      INTEGER*2 SM_CYBORDER
      PARAMETER (SM_CYBORDER=       6)
      INTEGER*2 SM_CXDLGFRAME
      PARAMETER (SM_CXDLGFRAME=     7)
      INTEGER*2 SM_CYDLGFRAME
      PARAMETER (SM_CYDLGFRAME=     8)
      INTEGER*2 SM_CYVTHUMB
      PARAMETER (SM_CYVTHUMB=       9)
      INTEGER*2 SM_CXHTHUMB
      PARAMETER (SM_CXHTHUMB=       10)
      INTEGER*2 SM_CXICON
      PARAMETER (SM_CXICON=         11)
      INTEGER*2 SM_CYICON
      PARAMETER (SM_CYICON=         12)
      INTEGER*2 SM_CXCURSOR
      PARAMETER (SM_CXCURSOR=       13)
      INTEGER*2 SM_CYCURSOR
      PARAMETER (SM_CYCURSOR=       14)
      INTEGER*2 SM_CYMENU
      PARAMETER (SM_CYMENU=         15)
      INTEGER*2 SM_CXFULLSCREEN
      PARAMETER (SM_CXFULLSCREEN=   16)
      INTEGER*2 SM_CYFULLSCREEN
      PARAMETER (SM_CYFULLSCREEN=   17)
      INTEGER*2 SM_CYKANJIWINDOW
      PARAMETER (SM_CYKANJIWINDOW=  18)
      INTEGER*2 SM_MOUSEPRESENT
      PARAMETER (SM_MOUSEPRESENT=   19)
      INTEGER*2 SM_CYVSCROLL
      PARAMETER (SM_CYVSCROLL=      20)
      INTEGER*2 SM_CXHSCROLL
      PARAMETER (SM_CXHSCROLL=      21)
      INTEGER*2 SM_DEBUG
      PARAMETER (SM_DEBUG=          22)
      INTEGER*2 SM_SWAPBUTTON
      PARAMETER (SM_SWAPBUTTON=     23)
      INTEGER*2 SM_RESERVED1
      PARAMETER (SM_RESERVED1=      24)
      INTEGER*2 SM_RESERVED2
      PARAMETER (SM_RESERVED2=      25)
      INTEGER*2 SM_RESERVED3
      PARAMETER (SM_RESERVED3=      26)
      INTEGER*2 SM_RESERVED4
      PARAMETER (SM_RESERVED4=      27)
      INTEGER*2 SM_CXMIN
      PARAMETER (SM_CXMIN=          28)
      INTEGER*2 SM_CYMIN
      PARAMETER (SM_CYMIN=          29)
      INTEGER*2 SM_CXSIZE
      PARAMETER (SM_CXSIZE=         30)
      INTEGER*2 SM_CYSIZE
      PARAMETER (SM_CYSIZE=         31)
      INTEGER*2 SM_CXFRAME
      PARAMETER (SM_CXFRAME=        32)
      INTEGER*2 SM_CYFRAME
      PARAMETER (SM_CYFRAME=        33)
      INTEGER*2 SM_CXMINTRACK
      PARAMETER (SM_CXMINTRACK=     34)
      INTEGER*2 SM_CYMINTRACK
      PARAMETER (SM_CYMINTRACK=     35)
      INTEGER*2 SM_CMETRICS
      PARAMETER (SM_CMETRICS=       36)

      INTEGER*2 GetSystemMetrics [EXTERN]

$ENDIF ! NOSYSMETRICS

$IF DEFINED(MENUS)

      INTEGER*2 LoadMenu [EXTERN]
      INTEGER*2 LoadMenuIndirect [EXTERN]
      INTEGER*2 GetMenu [EXTERN]
      INTEGER*2 SetMenu [EXTERN]
      INTEGER*2 ChangeMenu [EXTERN]
      INTEGER*2 HiliteMenuItem [EXTERN]
      INTEGER*2 GetMenuString [EXTERN]
      INTEGER*2 GetMenuState [EXTERN]
      INTEGER*2 GetSystemMenu [EXTERN]
      INTEGER*2 CreateMenu [EXTERN]
      INTEGER*2 CreatePopupMenu [EXTERN]
      INTEGER*2 DestroyMenu [EXTERN]
      INTEGER*2 CheckMenuItem [EXTERN]
      INTEGER*2 EnableMenuItem [EXTERN]
      INTEGER*2 GetSubMenu [EXTERN]
      INTEGER*2 GetMenuItemID [EXTERN]
      INTEGER*2 GetMenuItemCount [EXTERN]

      INTEGER*2 InsertMenu [EXTERN]
      INTEGER*2 AppendMenu [EXTERN]
      INTEGER*2 ModifyMenu [EXTERN]
      INTEGER*2 RemoveMenu [EXTERN]
      INTEGER*2 DeleteMenu [EXTERN]
      INTEGER*2 SetMenuItemBitmaps [EXTERN]
      INTEGER*4 GetMenuCheckMarkDimensions [EXTERN]
      INTEGER*2 TrackPopupMenu [EXTERN]

$ENDIF ! NOMENUS

      INTEGER*2 GrayString [EXTERN]
      INTEGER*2 SetActiveWindow [EXTERN]

      INTEGER*2 BeginPaint [EXTERN]
      INTEGER*2 GetUpdateRect [EXTERN]
      INTEGER*2 GetUpdateRgn [EXTERN]

      INTEGER*2 ExcludeUpdateRgn [EXTERN]

      INTEGER*2 ScrollDC [EXTERN], ScrollDC_A [EXTERN]

$IF DEFINED(SCROLL)
      INTEGER*2 SetScrollPos [EXTERN]
      INTEGER*2 GetScrollPos [EXTERN]
$ENDIF

      INTEGER*2 SetProp [EXTERN], SetProp_A [EXTERN]
      INTEGER*2 GetProp [EXTERN], GetProp_A [EXTERN]
      INTEGER*2 RemoveProp [EXTERN]
      INTEGER*2 EnumProps [EXTERN]
      INTEGER*2 GetWindowText [EXTERN]
      INTEGER*2 GetWindowTextLength [EXTERN]

$IF DEFINED(MB)

C
C MessageBox() Flags
C
      INTEGER*2 MB_OK
      PARAMETER (MB_OK=              #0000)
      INTEGER*2 MB_OKCANCEL
      PARAMETER (MB_OKCANCEL=        #0001)
      INTEGER*2 MB_ABORTRETRYIGNORE
      PARAMETER (MB_ABORTRETRYIGNORE=#0002)
      INTEGER*2 MB_YESNOCANCEL
      PARAMETER (MB_YESNOCANCEL=     #0003)
      INTEGER*2 MB_YESNO
      PARAMETER (MB_YESNO=           #0004)
      INTEGER*2 MB_RETRYCANCEL
      PARAMETER (MB_RETRYCANCEL=     #0005)

      INTEGER*2 MB_ICONHAND
      PARAMETER (MB_ICONHAND=        #0010)
      INTEGER*2 MB_ICONQUESTION
      PARAMETER (MB_ICONQUESTION=    #0020)
      INTEGER*2 MB_ICONEXCLAMATION
      PARAMETER (MB_ICONEXCLAMATION= #0030)
      INTEGER*2 MB_ICONASTERISK
      PARAMETER (MB_ICONASTERISK=    #0040)

      INTEGER*2 MB_ICONINFORMATION
      PARAMETER (MB_ICONINFORMATION=MB_ICONASTERISK)
      INTEGER*2 MB_ICONSTOP
      PARAMETER (MB_ICONSTOP=       MB_ICONHAND)

      INTEGER*2 MB_DEFBUTTON1
      PARAMETER (MB_DEFBUTTON1=     #0000)
      INTEGER*2 MB_DEFBUTTON2
      PARAMETER (MB_DEFBUTTON2=     #0100)
      INTEGER*2 MB_DEFBUTTON3
      PARAMETER (MB_DEFBUTTON3=     #0200)

      INTEGER*2 MB_APPLMODAL
      PARAMETER (MB_APPLMODAL=      #0000)
      INTEGER*2 MB_SYSTEMMODAL
      PARAMETER (MB_SYSTEMMODAL=    #1000)
      INTEGER*2 MB_TASKMODAL
      PARAMETER (MB_TASKMODAL=      #2000)

      INTEGER*2 MB_NOFOCUS
      PARAMETER (MB_NOFOCUS=        #8000)

      INTEGER*2 MB_TYPEMASK
      PARAMETER (MB_TYPEMASK=       #000F)
      INTEGER*2 MB_ICONMASK
      PARAMETER (MB_ICONMASK=       #00F0)
      INTEGER*2 MB_DEFMASK
      PARAMETER (MB_DEFMASK=        #0F00)
      INTEGER*2 MB_MODEMASK
      PARAMETER (MB_MODEMASK=       #3000)
      INTEGER*2 MB_MISCMASK
      PARAMETER (MB_MISCMASK=       #C000)

      INTEGER*2 MessageBox [EXTERN]

$ENDIF ! NOMB

      INTEGER*2 ShowCursor [EXTERN]
      INTEGER*2 SetCursor [EXTERN]

      INTEGER*2 GetCaretBlinkTime [EXTERN]

      INTEGER*2 WindowFromPoint [EXTERN]
      INTEGER*2 ChildWindowFromPoint [EXTERN]

$IF DEFINED(COLOR)

C
C Color Types
C
      INTEGER*2 CTLCOLOR_MSGBOX
      PARAMETER (CTLCOLOR_MSGBOX=       0)
      INTEGER*2 CTLCOLOR_EDIT
      PARAMETER (CTLCOLOR_EDIT=         1)
      INTEGER*2 CTLCOLOR_LISTBOX
      PARAMETER (CTLCOLOR_LISTBOX=      2)
      INTEGER*2 CTLCOLOR_BTN
      PARAMETER (CTLCOLOR_BTN=          3)
      INTEGER*2 CTLCOLOR_DLG
      PARAMETER (CTLCOLOR_DLG=          4)
      INTEGER*2 CTLCOLOR_SCROLLBAR
      PARAMETER (CTLCOLOR_SCROLLBAR=    5)
      INTEGER*2 CTLCOLOR_STATIC
      PARAMETER (CTLCOLOR_STATIC=       6)
      INTEGER*2 CTLCOLOR_MAX
      PARAMETER (CTLCOLOR_MAX=          8)    ! three bits max

      INTEGER*2 COLOR_SCROLLBAR
      PARAMETER (COLOR_SCROLLBAR=       0)
      INTEGER*2 COLOR_BACKGROUND
      PARAMETER (COLOR_BACKGROUND=      1)
      INTEGER*2 COLOR_ACTIVECAPTION
      PARAMETER (COLOR_ACTIVECAPTION=   2)
      INTEGER*2 COLOR_INACTIVECAPTION
      PARAMETER (COLOR_INACTIVECAPTION= 3)
      INTEGER*2 COLOR_MENU
      PARAMETER (COLOR_MENU=            4)
      INTEGER*2 COLOR_WINDOW
      PARAMETER (COLOR_WINDOW=          5)
      INTEGER*2 COLOR_WINDOWFRAME
      PARAMETER (COLOR_WINDOWFRAME=     6)
      INTEGER*2 COLOR_MENUTEXT
      PARAMETER (COLOR_MENUTEXT=        7)
      INTEGER*2 COLOR_WINDOWTEXT
      PARAMETER (COLOR_WINDOWTEXT=      8)
      INTEGER*2 COLOR_CAPTIONTEXT
      PARAMETER (COLOR_CAPTIONTEXT=     9)
      INTEGER*2 COLOR_ACTIVEBORDER
      PARAMETER (COLOR_ACTIVEBORDER=    10)
      INTEGER*2 COLOR_INACTIVEBORDER
      PARAMETER (COLOR_INACTIVEBORDER=  11)
      INTEGER*2 COLOR_APPWORKSPACE
      PARAMETER (COLOR_APPWORKSPACE=    12)
      INTEGER*2 COLOR_HIGHLIGHT
      PARAMETER (COLOR_HIGHLIGHT=       13)
      INTEGER*2 COLOR_HIGHLIGHTTEXT
      PARAMETER (COLOR_HIGHLIGHTTEXT=   14)
      INTEGER*2 COLOR_BTNFACE
      PARAMETER (COLOR_BTNFACE=         15)
      INTEGER*2 COLOR_BTNSHADOW
      PARAMETER (COLOR_BTNSHADOW=       16)
      INTEGER*2 COLOR_GRAYTEXT
      PARAMETER (COLOR_GRAYTEXT=        17)
      INTEGER*2 COLOR_BTNTEXT
      PARAMETER (COLOR_BTNTEXT=         18)
      INTEGER*2 COLOR_ENDCOLORS
      PARAMETER (COLOR_ENDCOLORS=COLOR_BTNTEXT)

      INTEGER*4 GetSysColor [EXTERN]

$ENDIF ! NOCOLOR

      INTEGER*2 FillRgn [EXTERN]
      INTEGER*2 FrameRgn [EXTERN]
      INTEGER*2 InvertRgn [EXTERN]
      INTEGER*2 PaintRgn [EXTERN]
      INTEGER*2 PtInRegion [EXTERN]

      INTEGER*2 FillRect [EXTERN]
      INTEGER*2 FrameRect [EXTERN]
      INTEGER*2 CopyRect [EXTERN]
      INTEGER*2 IntersectRect [EXTERN]
      INTEGER*2 UnionRect [EXTERN]
      INTEGER*2 IsRectEmpty [EXTERN]
      INTEGER*2 EqualRect [EXTERN]
      INTEGER*2 PtInRect [EXTERN]
      INTEGER*2 RectVisible [EXTERN]
      INTEGER*2 RectInRegion [EXTERN]

      INTEGER*4 GetCurrentTime [EXTERN]
      INTEGER*4 GetTickCount [EXTERN]

$IF DEFINED(WINOFFSETS)

      INTEGER*2 GetWindowWord [EXTERN]
      INTEGER*2 SetWindowWord [EXTERN]
      INTEGER*4 GetWindowLong [EXTERN]
      INTEGER*4 SetWindowLong [EXTERN]
      INTEGER*2 GetClassWord [EXTERN]
      INTEGER*2 SetClassWord [EXTERN]
      INTEGER*4 GetClassLong [EXTERN]
      INTEGER*4 SetClassLong [EXTERN]
      INTEGER*2 GetDesktopHwnd [EXTERN]
      INTEGER*2 GetDesktopWindow [EXTERN]

$ENDIF ! NOWINOFFSETS

      INTEGER*2 GetParent [EXTERN]
      INTEGER*2 SetParent [EXTERN]
      INTEGER*2 EnumChildWindows [EXTERN]
      INTEGER*2 FindWindow [EXTERN]
      INTEGER*2 EnumWindows [EXTERN]
      INTEGER*2 EnumTaskWindows [EXTERN]
      INTEGER*2 GetClassName [EXTERN]
      INTEGER*2 GetTopWindow [EXTERN]
      INTEGER*2 GetNextWindow [EXTERN]
      INTEGER*2 GetWindowTask [EXTERN]
      INTEGER*2 GetLastActivePopup [EXTERN]

C
C GetWindow() Constants
C
      INTEGER*2 GW_HWNDFIRST
      PARAMETER (GW_HWNDFIRST=      0)
      INTEGER*2 GW_HWNDLAST
      PARAMETER (GW_HWNDLAST=       1)
      INTEGER*2 GW_HWNDNEXT
      PARAMETER (GW_HWNDNEXT=       2)
      INTEGER*2 GW_HWNDPREV
      PARAMETER (GW_HWNDPREV=       3)
      INTEGER*2 GW_OWNER
      PARAMETER (GW_OWNER=          4)
      INTEGER*2 GW_CHILD
      PARAMETER (GW_CHILD=          5)

      INTEGER*2 GetWindow [EXTERN]

$IF DEFINED(WH)
      INTEGER*4 SetWindowsHook [EXTERN]
      INTEGER*2 UnhookWindowsHook [EXTERN]
      INTEGER*4 DefHookProc [EXTERN]
$ENDIF ! NOWH

$IF DEFINED(MENUS)

C
C Menu flags for Add/Check/EnableMenuItem()
C
      INTEGER*2 MF_INSERT
      PARAMETER (MF_INSERT=        #0000)
      INTEGER*2 MF_CHANGE
      PARAMETER (MF_CHANGE=        #0080)
      INTEGER*2 MF_APPEND
      PARAMETER (MF_APPEND=        #0100)
      INTEGER*2 MF_DELETE
      PARAMETER (MF_DELETE=        #0200)
      INTEGER*2 MF_REMOVE
      PARAMETER (MF_REMOVE=        #1000)

      INTEGER*2 MF_BYCOMMAND
      PARAMETER (MF_BYCOMMAND=     #0000)
      INTEGER*2 MF_BYPOSITION
      PARAMETER (MF_BYPOSITION=    #0400)

      INTEGER*2 MF_SEPARATOR
      PARAMETER (MF_SEPARATOR=     #0800)

      INTEGER*2 MF_ENABLED
      PARAMETER (MF_ENABLED=       #0000)
      INTEGER*2 MF_GRAYED
      PARAMETER (MF_GRAYED=        #0001)
      INTEGER*2 MF_DISABLED
      PARAMETER (MF_DISABLED=      #0002)

      INTEGER*2 MF_UNCHECKED
      PARAMETER (MF_UNCHECKED=     #0000)
      INTEGER*2 MF_CHECKED
      PARAMETER (MF_CHECKED=       #0008)
      INTEGER*2 MF_USECHECKBITMAPS
      PARAMETER (MF_USECHECKBITMAPS=#0200)

      INTEGER*2 MF_STRING
      PARAMETER (MF_STRING=        #0000)
      INTEGER*2 MF_BITMAP
      PARAMETER (MF_BITMAP=        #0004)
      INTEGER*2 MF_OWNERDRAW
      PARAMETER (MF_OWNERDRAW=     #0100)

      INTEGER*2 MF_POPUP
      PARAMETER (MF_POPUP=         #0010)
      INTEGER*2 MF_MENUBARBREAK
      PARAMETER (MF_MENUBARBREAK=  #0020)
      INTEGER*2 MF_MENUBREAK
      PARAMETER (MF_MENUBREAK=     #0040)

      INTEGER*2 MF_UNHILITE
      PARAMETER (MF_UNHILITE=      #0000)
      INTEGER*2 MF_HILITE
      PARAMETER (MF_HILITE=        #0080)

      INTEGER*2 MF_SYSMENU
      PARAMETER (MF_SYSMENU=       #2000)
      INTEGER*2 MF_HELP
      PARAMETER (MF_HELP=          #4000)
      INTEGER*2 MF_MOUSESELECT
      PARAMETER (MF_MOUSESELECT=   #8000)

C
C Menu item resource format
C
      STRUCTURE /MENUITEMTEMPLATEHEADER/
	 INTEGER*2 versionNumber
	 INTEGER*2 offset
      END STRUCTURE

      STRUCTURE /MENUITEMTEMPLATE/
	 INTEGER*2 mtOption
	 INTEGER*2 mtID
	 CHARACTER mtString(1)
      END STRUCTURE

      INTEGER*2 MF_END
      PARAMETER (MF_END=#0080)

$ENDIF ! NOMENUS

$IF DEFINED(SYSCOMMANDS)

C
C System Menu Command Values
C
      INTEGER*2 SC_SIZE
      PARAMETER (SC_SIZE=       #F000)
      INTEGER*2 SC_MOVE
      PARAMETER (SC_MOVE=       #F010)
      INTEGER*2 SC_MINIMIZE
      PARAMETER (SC_MINIMIZE=   #F020)
      INTEGER*2 SC_MAXIMIZE
      PARAMETER (SC_MAXIMIZE=   #F030)
      INTEGER*2 SC_NEXTWINDOW
      PARAMETER (SC_NEXTWINDOW= #F040)
      INTEGER*2 SC_PREVWINDOW
      PARAMETER (SC_PREVWINDOW= #F050)
      INTEGER*2 SC_CLOSE
      PARAMETER (SC_CLOSE=      #F060)
      INTEGER*2 SC_VSCROLL
      PARAMETER (SC_VSCROLL=    #F070)
      INTEGER*2 SC_HSCROLL
      PARAMETER (SC_HSCROLL=    #F080)
      INTEGER*2 SC_MOUSEMENU
      PARAMETER (SC_MOUSEMENU=  #F090)
      INTEGER*2 SC_KEYMENU
      PARAMETER (SC_KEYMENU=    #F100)
      INTEGER*2 SC_ARRANGE
      PARAMETER (SC_ARRANGE=    #F110)
      INTEGER*2 SC_RESTORE
      PARAMETER (SC_RESTORE=    #F120)
      INTEGER*2 SC_TASKLIST
      PARAMETER (SC_TASKLIST=   #F130)

      INTEGER*2 SC_ICON
      PARAMETER (SC_ICON=SC_MINIMIZE)
      INTEGER*2 SC_ZOOM
      PARAMETER (SC_ZOOM=SC_MAXIMIZE)

$ENDIF ! NOSYSCOMMANDS

C
C Resource Loading Routines
C
      INTEGER*2 LoadBitmap [EXTERN]
      INTEGER*2 LoadCursor [EXTERN], LoadCursor_A [EXTERN]
      INTEGER*2 CreateCursor [EXTERN]
      INTEGER*2 DestroyCursor [EXTERN]

C
C Standard Cursor IDs
C
C The following were defined as follows :
C
C #define IDC_ARROW         MAKEINTRESOURCE(32512)
C
      INTEGER*4 IDC_ARROW
      PARAMETER (IDC_ARROW=32512)
      INTEGER*4 IDC_IBEAM
      PARAMETER (IDC_IBEAM=32513)
      INTEGER*4 IDC_WAIT
      PARAMETER (IDC_WAIT=32514)
      INTEGER*4 IDC_CROSS
      PARAMETER (IDC_CROSS=32515)
      INTEGER*4 IDC_UPARROW
      PARAMETER (IDC_UPARROW=32516)
      INTEGER*4 IDC_SIZE
      PARAMETER (IDC_SIZE=32640)
      INTEGER*4 IDC_ICON
      PARAMETER (IDC_ICON=32641)
      INTEGER*4 IDC_SIZENWSE
      PARAMETER (IDC_SIZENWSE=32642)
      INTEGER*4 IDC_SIZENESW
      PARAMETER (IDC_SIZENESW=32643)
      INTEGER*4 IDC_SIZEWE
      PARAMETER (IDC_SIZEWE=32644)
      INTEGER*4 IDC_SIZENS
      PARAMETER (IDC_SIZENS=32645)

      INTEGER*2 LoadIcon [EXTERN]
      INTEGER*2 CreateIcon [EXTERN]
      INTEGER*2 DestroyIcon [EXTERN]

      INTEGER*2 ORD_LANGDRIVER
      PARAMETER (ORD_LANGDRIVER=1) ! The ordinal number for the entry point of
				   ! language drivers.

$IF DEFINED(ICONS)
C
C Standard Icon IDs
C
C The following were defined as follows :
C
C #define IDI_APPLICATION     MAKEINTRESOURCE(32512)
C
      INTEGER*4 IDI_APPLICATION
      PARAMETER (IDI_APPLICATION=32512)
      INTEGER*4 IDI_HAND
      PARAMETER (IDI_HAND=32513)
      INTEGER*4 IDI_QUESTION
      PARAMETER (IDI_QUESTION=32514)
      INTEGER*4 IDI_EXCLAMATION
      PARAMETER (IDI_EXCLAMATION=32515)
      INTEGER*4 IDI_ASTERISK
      PARAMETER (IDI_ASTERISK=32516)

$ENDIF ! NOICONS

      INTEGER*2 LoadString [EXTERN]
      INTEGER*2 AddFontResource [EXTERN]
      INTEGER*2 RemoveFontResource [EXTERN]

$IF DEFINED(KANJI)

      INTEGER*2 CP_HWND
      PARAMETER (CP_HWND=           0)
      INTEGER*2 CP_OPEN
      PARAMETER (CP_OPEN=           1)
      INTEGER*2 CP_DIRECT
      PARAMETER (CP_DIRECT=         2)

C
C VK from the keyboard driver
C
      BYTE VK_KANA
      PARAMETER (VK_KANA=           #15)
      BYTE VK_ROMAJI
      PARAMETER (VK_ROMAJI=         #16)
      BYTE VK_ZENKAKU
      PARAMETER (VK_ZENKAKU=        #17)
      BYTE VK_HIRAGANA
      PARAMETER (VK_HIRAGANA=       #18)
      BYTE VK_KANJI
      PARAMETER (VK_KANJI=          #19)

C
C VK to send to Applications
C
      BYTE VK_CONVERT
      PARAMETER (VK_CONVERT=        #1C)
      BYTE VK_NONCONVERT
      PARAMETER (VK_NONCONVERT=     #1D)
      BYTE VK_ACCEPT
      PARAMETER (VK_ACCEPT=         #1E)
      BYTE VK_MODECHANGE
      PARAMETER (VK_MODECHANGE=     #1F)

C
C Conversion function numbers
C
      BYTE KNJ_START
      PARAMETER (KNJ_START=         #01)
      BYTE KNJ_END
      PARAMETER (KNJ_END=           #02)
      BYTE KNJ_QUERY
      PARAMETER (KNJ_QUERY=         #03)

      BYTE KNJ_LEARN_MODE
      PARAMETER (KNJ_LEARN_MODE=    #10)
      BYTE KNJ_GETMODE
      PARAMETER (KNJ_GETMODE=       #11)
      BYTE KNJ_SETMODE
      PARAMETER (KNJ_SETMODE=       #12)

      BYTE KNJ_CODECONVERT
      PARAMETER (KNJ_CODECONVERT=   #20)
      BYTE KNJ_CONVERT
      PARAMETER (KNJ_CONVERT=       #21)
      BYTE KNJ_NEXT
      PARAMETER (KNJ_NEXT=          #22)
      BYTE KNJ_PREVIOUS
      PARAMETER (KNJ_PREVIOUS=      #23)
      BYTE KNJ_ACCEPT
      PARAMETER (KNJ_ACCEPT=        #24)

      BYTE KNJ_LEARN
      PARAMETER (KNJ_LEARN=         #30)
      BYTE KNJ_REGISTER
      PARAMETER (KNJ_REGISTER=      #31)
      BYTE KNJ_REMOVE
      PARAMETER (KNJ_REMOVE=        #32)
      BYTE KNJ_CHANGE_UDIC
      PARAMETER (KNJ_CHANGE_UDIC=   #33)

C
C NOTE:  DEFAULT        = 0
C        JIS1           = 1
C        JIS2           = 2
C        SJIS2          = 3
C        JIS1KATAKANA   = 4
C        SJIS2HIRAGANA  = 5
C        SJIS2KATAKANA  = 6
C        OEM            = F
C

      BYTE KNJ_JIS1toJIS1KATAKANA
      PARAMETER (KNJ_JIS1toJIS1KATAKANA=#14)
      BYTE KNJ_JIS1toSJIS2
      PARAMETER (KNJ_JIS1toSJIS2=       #13)
      BYTE KNJ_JIS1toSJIS2HIRAGANA
      PARAMETER (KNJ_JIS1toSJIS2HIRAGANA=#15)
      BYTE KNJ_JIS1toSJIS2KATAKANA
      PARAMETER (KNJ_JIS1toSJIS2KATAKANA=#16)
      BYTE KNJ_JIS1toDEFAULT
      PARAMETER (KNJ_JIS1toDEFAULT=     #10)
      BYTE KNJ_JIS1toSJIS2OEM
      PARAMETER (KNJ_JIS1toSJIS2OEM=    #1F)
      BYTE KNJ_JIS2toSJIS2
      PARAMETER (KNJ_JIS2toSJIS2=       #23)
      BYTE KNJ_SJIS2toJIS2
      PARAMETER (KNJ_SJIS2toJIS2=       #32)

      BYTE KNJ_MD_ALPHA
      PARAMETER (KNJ_MD_ALPHA=          #01)
      BYTE KNJ_MD_HIRAGANA
      PARAMETER (KNJ_MD_HIRAGANA=       #02)
      BYTE KNJ_MD_HALF
      PARAMETER (KNJ_MD_HALF=           #04)
      BYTE KNJ_MD_JIS
      PARAMETER (KNJ_MD_JIS=            #08)
      BYTE KNJ_MD_SPECIAL
      PARAMETER (KNJ_MD_SPECIAL=        #10)

      BYTE KNJ_CVT_NEXT
      PARAMETER (KNJ_CVT_NEXT=          #01)
      BYTE KNJ_CVT_PREV
      PARAMETER (KNJ_CVT_PREV=          #02)
      BYTE KNJ_CVT_KATAKANA
      PARAMETER (KNJ_CVT_KATAKANA=      #03)
      BYTE KNJ_CVT_HIRAGANA
      PARAMETER (KNJ_CVT_HIRAGANA=      #04)
      BYTE KNJ_CVT_JIS1
      PARAMETER (KNJ_CVT_JIS1=          #05)
      BYTE KNJ_CVT_SJIS2
      PARAMETER (KNJ_CVT_SJIS2=         #06)
      BYTE KNJ_CVT_DEFAULT
      PARAMETER (KNJ_CVT_DEFAULT=       #07)
      BYTE KNJ_CVT_TYPED
      PARAMETER (KNJ_CVT_TYPED=         #08)

      STRUCTURE /KANJISTRUCT/
	 INTEGER*2 fnc
	 INTEGER*2 wParam
	 INTEGER*4 lpSource ! LPSTR
	 INTEGER*4 lpDest ! LPSTR
	 INTEGER*2 wCount
	 INTEGER*4 lpReserved1 ! LPSTR
	 INTEGER*4 lpReserved2 ! LPSTR
      END STRUCTURE ! KANJISTRUCT, FAR *LPKANJISTRUCT;

      INTEGER*2 ConvertRequest [EXTERN]
      INTEGER*2 SetConvertParams [EXTERN]

$ENDIF

C
C Key Conversion Window
C
      INTEGER*2 IsTwoByteCharPrefix [EXTERN]

C
C Dialog Box Command IDs
C
      INTEGER*2 IDOK
      PARAMETER (IDOK=              1)
      INTEGER*2 IDCANCEL
      PARAMETER (IDCANCEL=          2)
      INTEGER*2 IDABORT
      PARAMETER (IDABORT=           3)
      INTEGER*2 IDRETRY
      PARAMETER (IDRETRY=           4)
      INTEGER*2 IDIGNORE
      PARAMETER (IDIGNORE=          5)
      INTEGER*2 IDYES
      PARAMETER (IDYES=             6)
      INTEGER*2 IDNO
      PARAMETER (IDNO=              7)

$IF DEFINED(CTLMGR)

C
C Control Manager Structures and Definitions
C

$IF DEFINED(WINSTYLES)

C
C Edit Control Styles
C
      INTEGER*4 ES_LEFT
      PARAMETER (ES_LEFT=             #0000)
      INTEGER*4 ES_CENTER
      PARAMETER (ES_CENTER=           #0001)
      INTEGER*4 ES_RIGHT
      PARAMETER (ES_RIGHT=            #0002)
      INTEGER*4 ES_MULTILINE
      PARAMETER (ES_MULTILINE=        #0004)
      INTEGER*4 ES_UPPERCASE
      PARAMETER (ES_UPPERCASE=        #0008)
      INTEGER*4 ES_LOWERCASE
      PARAMETER (ES_LOWERCASE=        #0010)
      INTEGER*4 ES_PASSWORD
      PARAMETER (ES_PASSWORD=         #0020)
      INTEGER*4 ES_AUTOVSCROLL
      PARAMETER (ES_AUTOVSCROLL=      #0040)
      INTEGER*4 ES_AUTOHSCROLL
      PARAMETER (ES_AUTOHSCROLL=      #0080)
      INTEGER*4 ES_NOHIDESEL
      PARAMETER (ES_NOHIDESEL=        #0100)
      INTEGER*4 ES_OEMCONVERT
      PARAMETER (ES_OEMCONVERT=       #0400)

$ENDIF ! NOWINSTYLES

C
C Edit Control Notification Codes
C
      INTEGER*2 EN_SETFOCUS
      PARAMETER (EN_SETFOCUS=       #0100)
      INTEGER*2 EN_KILLFOCUS
      PARAMETER (EN_KILLFOCUS=      #0200)
      INTEGER*2 EN_CHANGE
      PARAMETER (EN_CHANGE=         #0300)
      INTEGER*2 EN_UPDATE
      PARAMETER (EN_UPDATE=         #0400)
      INTEGER*2 EN_ERRSPACE
      PARAMETER (EN_ERRSPACE=       #0500)
      INTEGER*2 EN_MAXTEXT
      PARAMETER (EN_MAXTEXT=        #0501)
      INTEGER*2 EN_HSCROLL
      PARAMETER (EN_HSCROLL=        #0601)
      INTEGER*2 EN_VSCROLL
      PARAMETER (EN_VSCROLL=        #0602)

$IF DEFINED(WINMESSAGES)

C
C Edit Control Messages
C
      INTEGER*2 EM_GETSEL
      PARAMETER (EM_GETSEL=         WM_USER+0)
      INTEGER*2 EM_SETSEL
      PARAMETER (EM_SETSEL=         WM_USER+1)
      INTEGER*2 EM_GETRECT
      PARAMETER (EM_GETRECT=        WM_USER+2)
      INTEGER*2 EM_SETRECT
      PARAMETER (EM_SETRECT=        WM_USER+3)
      INTEGER*2 EM_SETRECTNP
      PARAMETER (EM_SETRECTNP=      WM_USER+4)
      INTEGER*2 EM_SCROLL
      PARAMETER (EM_SCROLL=         WM_USER+5)
      INTEGER*2 EM_LINESCROLL
      PARAMETER (EM_LINESCROLL=     WM_USER+6)
      INTEGER*2 EM_GETMODIFY
      PARAMETER (EM_GETMODIFY=      WM_USER+8)
      INTEGER*2 EM_SETMODIFY
      PARAMETER (EM_SETMODIFY=      WM_USER+9)
      INTEGER*2 EM_GETLINECOUNT
      PARAMETER (EM_GETLINECOUNT=   WM_USER+10)
      INTEGER*2 EM_LINEINDEX
      PARAMETER (EM_LINEINDEX=      WM_USER+11)
      INTEGER*2 EM_SETHANDLE
      PARAMETER (EM_SETHANDLE=      WM_USER+12)
      INTEGER*2 EM_GETHANDLE
      PARAMETER (EM_GETHANDLE=      WM_USER+13)
      INTEGER*2 EM_GETTHUMB
      PARAMETER (EM_GETTHUMB=       WM_USER+14)
      INTEGER*2 EM_LINELENGTH
      PARAMETER (EM_LINELENGTH=     WM_USER+17)
      INTEGER*2 EM_REPLACESEL
      PARAMETER (EM_REPLACESEL=     WM_USER+18)
      INTEGER*2 EM_SETFONT
      PARAMETER (EM_SETFONT=        WM_USER+19)
      INTEGER*2 EM_GETLINE
      PARAMETER (EM_GETLINE=        WM_USER+20)
      INTEGER*2 EM_LIMITTEXT
      PARAMETER (EM_LIMITTEXT=      WM_USER+21)
      INTEGER*2 EM_CANUNDO
      PARAMETER (EM_CANUNDO=        WM_USER+22)
      INTEGER*2 EM_UNDO
      PARAMETER (EM_UNDO=           WM_USER+23)
      INTEGER*2 EM_FMTLINES
      PARAMETER (EM_FMTLINES=       WM_USER+24)
      INTEGER*2 EM_LINEFROMCHAR
      PARAMETER (EM_LINEFROMCHAR=   WM_USER+25)
      INTEGER*2 EM_SETWORDBREAK
      PARAMETER (EM_SETWORDBREAK=   WM_USER+26)
      INTEGER*2 EM_SETTABSTOPS
      PARAMETER (EM_SETTABSTOPS=    WM_USER+27)
      INTEGER*2 EM_SETPASSWORDCHAR
      PARAMETER (EM_SETPASSWORDCHAR=WM_USER+28)
      INTEGER*2 EM_EMPTYUNDOBUFFER
      PARAMETER (EM_EMPTYUNDOBUFFER=WM_USER+29)
      INTEGER*2 EM_MSGMAX
      PARAMETER (EM_MSGMAX=         WM_USER+30)

$ENDIF ! NOWINMESSAGES

C
C Button Control Styles
C
      INTEGER*4 BS_PUSHBUTTON
      PARAMETER (BS_PUSHBUTTON=    #00)
      INTEGER*4 BS_DEFPUSHBUTTON
      PARAMETER (BS_DEFPUSHBUTTON= #01)
      INTEGER*4 BS_CHECKBOX
      PARAMETER (BS_CHECKBOX=      #02)
      INTEGER*4 BS_AUTOCHECKBOX
      PARAMETER (BS_AUTOCHECKBOX=  #03)
      INTEGER*4 BS_RADIOBUTTON
      PARAMETER (BS_RADIOBUTTON=   #04)
      INTEGER*4 BS_3STATE
      PARAMETER (BS_3STATE=        #05)
      INTEGER*4 BS_AUTO3STATE
      PARAMETER (BS_AUTO3STATE=    #06)
      INTEGER*4 BS_GROUPBOX
      PARAMETER (BS_GROUPBOX=      #07)
      INTEGER*4 BS_USERBUTTON
      PARAMETER (BS_USERBUTTON=    #08)
      INTEGER*4 BS_AUTORADIOBUTTON
      PARAMETER (BS_AUTORADIOBUTTON=#09)
      INTEGER*4 BS_PUSHBOX
      PARAMETER (BS_PUSHBOX=       #0A)
      INTEGER*4 BS_OWNERDRAW
      PARAMETER (BS_OWNERDRAW=     #0B)
      INTEGER*4 BS_LEFTTEXT
      PARAMETER (BS_LEFTTEXT=      #20)

C
C User Button Notification Codes
C
      INTEGER*2 BN_CLICKED
      PARAMETER (BN_CLICKED=       0)
      INTEGER*2 BN_PAINT
      PARAMETER (BN_PAINT=         1)
      INTEGER*2 BN_HILITE
      PARAMETER (BN_HILITE=        2)
      INTEGER*2 BN_UNHILITE
      PARAMETER (BN_UNHILITE=      3)
      INTEGER*2 BN_DISABLE
      PARAMETER (BN_DISABLE=       4)
      INTEGER*2 BN_DOUBLECLICKED
      PARAMETER (BN_DOUBLECLICKED=  5)

C
C Button Control Messages
C
      INTEGER*2 BM_GETCHECK
      PARAMETER (BM_GETCHECK=      WM_USER+0)
      INTEGER*2 BM_SETCHECK
      PARAMETER (BM_SETCHECK=      WM_USER+1)
      INTEGER*2 BM_GETSTATE
      PARAMETER (BM_GETSTATE=      WM_USER+2)
      INTEGER*2 BM_SETSTATE
      PARAMETER (BM_SETSTATE=      WM_USER+3)
      INTEGER*2 BM_SETSTYLE
      PARAMETER (BM_SETSTYLE=      WM_USER+4)

C
C Static Control Constants
C
      INTEGER*4 SS_LEFT
      PARAMETER (SS_LEFT=          #00)
      INTEGER*4 SS_CENTER
      PARAMETER (SS_CENTER=        #01)
      INTEGER*4 SS_RIGHT
      PARAMETER (SS_RIGHT=         #02)
      INTEGER*4 SS_ICON
      PARAMETER (SS_ICON=          #03)
      INTEGER*4 SS_BLACKRECT
      PARAMETER (SS_BLACKRECT=     #04)
      INTEGER*4 SS_GRAYRECT
      PARAMETER (SS_GRAYRECT=      #05)
      INTEGER*4 SS_WHITERECT
      PARAMETER (SS_WHITERECT=     #06)
      INTEGER*4 SS_BLACKFRAME
      PARAMETER (SS_BLACKFRAME=    #07)
      INTEGER*4 SS_GRAYFRAME
      PARAMETER (SS_GRAYFRAME=     #08)
      INTEGER*4 SS_WHITEFRAME
      PARAMETER (SS_WHITEFRAME=    #09)
      INTEGER*4 SS_USERITEM
      PARAMETER (SS_USERITEM=      #0A)
      INTEGER*4 SS_SIMPLE
      PARAMETER (SS_SIMPLE=        #0B)
      INTEGER*4 SS_LEFTNOWORDWRAP
      PARAMETER (SS_LEFTNOWORDWRAP=#0C)
      INTEGER*4 SS_NOPREFIX
      PARAMETER (SS_NOPREFIX=      #80)  ! Don't do "&" character translation

$IF DEFINED(MSG)
      INTEGER*2 IsDialogMessage [EXTERN]
$ENDIF

      INTEGER*2 DlgDirList [EXTERN]
      INTEGER*2 DlgDirSelect [EXTERN]
      INTEGER*2 DlgDirListComboBox [EXTERN]
      INTEGER*2 DlgDirSelectComboBox [EXTERN]
C
C Dialog Styles
C
      INTEGER*4 DS_ABSALIGN
      PARAMETER (DS_ABSALIGN=       #01)
      INTEGER*4 DS_SYSMODAL
      PARAMETER (DS_SYSMODAL=       #02)
      INTEGER*4 DS_LOCALEDIT
      PARAMETER (DS_LOCALEDIT=      #20)  ! Edit items get Local storage.
      INTEGER*4 DS_SETFONT
      PARAMETER (DS_SETFONT=        #40)  ! User specified font for Dlg controls
      INTEGER*4 DS_MODALFRAME
      PARAMETER (DS_MODALFRAME=     #80)   ! Can be combined with WS_CAPTION
      INTEGER*4 DS_NOIDLEMSG
      PARAMETER (DS_NOIDLEMSG=      #100) ! WM_ENTERIDLE message will not be sent

      INTEGER*2 DM_GETDEFID
      PARAMETER (DM_GETDEFID=       WM_USER+0)
      INTEGER*2 DM_SETDEFID
      PARAMETER (DM_SETDEFID=       WM_USER+1)
      INTEGER*2 DC_HASDEFID
      PARAMETER (DC_HASDEFID=       #534B)

C
C Dialog Codes
C
      INTEGER*2 DLGC_WANTARROWS
      PARAMETER (DLGC_WANTARROWS=   #0001)      ! Control wants arrow keys
      INTEGER*2 DLGC_WANTTAB
      PARAMETER (DLGC_WANTTAB=      #0002)      ! Control wants tab keys
      INTEGER*2 DLGC_WANTALLKEYS
      PARAMETER (DLGC_WANTALLKEYS=  #0004)      ! Control wants all keys
      INTEGER*2 DLGC_WANTMESSAGE
      PARAMETER (DLGC_WANTMESSAGE=  #0004)      ! Pass message to control
      INTEGER*2 DLGC_HASSETSEL
      PARAMETER (DLGC_HASSETSEL=    #0008)      ! Understands EM_SETSEL message
      INTEGER*2 DLGC_DEFPUSHBUTTON
      PARAMETER (DLGC_DEFPUSHBUTTON=#0010)      ! Default pushbutton
      INTEGER*2 DLGC_UNDEFPUSHBUTTON
      PARAMETER (DLGC_UNDEFPUSHBUTTON=#0020)    ! Non-default pushbutton
      INTEGER*2 DLGC_RADIOBUTTON
      PARAMETER (DLGC_RADIOBUTTON=  #0040)      ! Radio button
      INTEGER*2 DLGC_WANTCHARS
      PARAMETER (DLGC_WANTCHARS=    #0080)      ! Want WM_CHAR messages
      INTEGER*2 DLGC_STATIC
      PARAMETER (DLGC_STATIC=       #0100)      ! Static item: don't include
      INTEGER*2 DLGC_BUTTON
      PARAMETER (DLGC_BUTTON=       #2000)      ! Button item: can be checked

      INTEGER*4 LB_CTLCODE
      PARAMETER (LB_CTLCODE=        0)

C
C Listbox Return Values
C
      INTEGER*2 LB_OKAY
      PARAMETER (LB_OKAY=           0)
      INTEGER*2 LB_ERR
      PARAMETER (LB_ERR=           -1)
      INTEGER*2 LB_ERRSPACE
      PARAMETER (LB_ERRSPACE=      -2)

C
C  The idStaticPath parameter to DlgDirList can have the following values
C  ORed if the list box should show other details of the files along with
C  the name of the files;
C
C                                 all other details also will be returned
C

C
C Listbox Notification Codes
C
      INTEGER*2 LBN_ERRSPACE
      PARAMETER (LBN_ERRSPACE=     -2)
      INTEGER*2 LBN_SELCHANGE
      PARAMETER (LBN_SELCHANGE=     1)
      INTEGER*2 LBN_DBLCLK
      PARAMETER (LBN_DBLCLK=        2)
      INTEGER*2 LBN_SELCANCEL
      PARAMETER (LBN_SELCANCEL=     3)
      INTEGER*2 LBN_SETFOCUS
      PARAMETER (LBN_SETFOCUS=      4)
      INTEGER*2 LBN_KILLFOCUS
      PARAMETER (LBN_KILLFOCUS=     5)

$IF DEFINED(WINMESSAGES)

C
C Listbox messages
C
      INTEGER*2 LB_ADDSTRING
      PARAMETER (LB_ADDSTRING=         WM_USER+1)
      INTEGER*2 LB_INSERTSTRING
      PARAMETER (LB_INSERTSTRING=      WM_USER+2)
      INTEGER*2 LB_DELETESTRING
      PARAMETER (LB_DELETESTRING=      WM_USER+3)
      INTEGER*2 LB_RESETCONTENT
      PARAMETER (LB_RESETCONTENT=      WM_USER+5)
      INTEGER*2 LB_SETSEL
      PARAMETER (LB_SETSEL=            WM_USER+6)
      INTEGER*2 LB_SETCURSEL
      PARAMETER (LB_SETCURSEL=         WM_USER+7)
      INTEGER*2 LB_GETSEL
      PARAMETER (LB_GETSEL=            WM_USER+8)
      INTEGER*2 LB_GETCURSEL
      PARAMETER (LB_GETCURSEL=         WM_USER+9)
      INTEGER*2 LB_GETTEXT
      PARAMETER (LB_GETTEXT=           WM_USER+10)
      INTEGER*2 LB_GETTEXTLEN
      PARAMETER (LB_GETTEXTLEN=        WM_USER+11)
      INTEGER*2 LB_GETCOUNT
      PARAMETER (LB_GETCOUNT=          WM_USER+12)
      INTEGER*2 LB_SELECTSTRING
      PARAMETER (LB_SELECTSTRING=      WM_USER+13)
      INTEGER*2 LB_DIR
      PARAMETER (LB_DIR=               WM_USER+14)
      INTEGER*2 LB_GETTOPINDEX
      PARAMETER (LB_GETTOPINDEX=       WM_USER+15)
      INTEGER*2 LB_FINDSTRING
      PARAMETER (LB_FINDSTRING=        WM_USER+16)
      INTEGER*2 LB_GETSELCOUNT
      PARAMETER (LB_GETSELCOUNT=       WM_USER+17)
      INTEGER*2 LB_GETSELITEMS
      PARAMETER (LB_GETSELITEMS=       WM_USER+18)
      INTEGER*2 LB_SETTABSTOPS
      PARAMETER (LB_SETTABSTOPS=       WM_USER+19)
      INTEGER*2 LB_GETHORIZONTALEXTENT
      PARAMETER (LB_GETHORIZONTALEXTENT=WM_USER+20)
      INTEGER*2 LB_SETHORIZONTALEXTENT
      PARAMETER (LB_SETHORIZONTALEXTENT=WM_USER+21)
      INTEGER*2 LB_SETCOLUMNWIDTH
      PARAMETER (LB_SETCOLUMNWIDTH=    WM_USER+22)
      INTEGER*2 LB_SETTOPINDEX
      PARAMETER (LB_SETTOPINDEX=       WM_USER+24)
      INTEGER*2 LB_GETITEMRECT
      PARAMETER (LB_GETITEMRECT=       WM_USER+25)
      INTEGER*2 LB_GETITEMDATA
      PARAMETER (LB_GETITEMDATA=       WM_USER+26)
      INTEGER*2 LB_SETITEMDATA
      PARAMETER (LB_SETITEMDATA=       WM_USER+27)
      INTEGER*2 LB_SELITEMRANGE
      PARAMETER (LB_SELITEMRANGE=      WM_USER+28)
      INTEGER*2 LB_MSGMAX
      PARAMETER (LB_MSGMAX=            WM_USER+33)

$ENDIF ! NOWINMESSAGES

$IF DEFINED(WINSTYLES)

C
C Listbox Styles
C
      INTEGER*4 LBS_NOTIFY
      PARAMETER (LBS_NOTIFY=           #0001)
      INTEGER*4 LBS_SORT
      PARAMETER (LBS_SORT=             #0002)
      INTEGER*4 LBS_NOREDRAW
      PARAMETER (LBS_NOREDRAW=         #0004)
      INTEGER*4 LBS_MULTIPLESEL
      PARAMETER (LBS_MULTIPLESEL=      #0008)
      INTEGER*4 LBS_OWNERDRAWFIXED
      PARAMETER (LBS_OWNERDRAWFIXED=   #0010)
      INTEGER*4 LBS_OWNERDRAWVARIABLE
      PARAMETER (LBS_OWNERDRAWVARIABLE=#0020)
      INTEGER*4 LBS_HASSTRINGS
      PARAMETER (LBS_HASSTRINGS=       #0040)
      INTEGER*4 LBS_USETABSTOPS
      PARAMETER (LBS_USETABSTOPS=      #0080)
      INTEGER*4 LBS_NOINTEGRALHEIGHT
      PARAMETER (LBS_NOINTEGRALHEIGHT= #0100)
      INTEGER*4 LBS_MULTICOLUMN
      PARAMETER (LBS_MULTICOLUMN=      #0200)
      INTEGER*4 LBS_WANTKEYBOARDINPUT
      PARAMETER (LBS_WANTKEYBOARDINPUT=#0400)
      INTEGER*4 LBS_EXTENDEDSEL
      PARAMETER (LBS_EXTENDEDSEL=      #0800)
      INTEGER*4 LBS_STANDARD
      PARAMETER (LBS_STANDARD=LBS_NOTIFY.OR.LBS_SORT.OR.WS_VSCROLL.OR.
     *                                                        WS_BORDER)

$ENDIF ! NOWINSTYLES

C
C Combo Box return Values
C
      INTEGER*2 CB_OKAY
      PARAMETER (CB_OKAY=         0)
      INTEGER*2 CB_ERR
      PARAMETER (CB_ERR=         -1)
      INTEGER*2 CB_ERRSPACE
      PARAMETER (CB_ERRSPACE=    -2)

C
C Combo Box Notification Codes
C
      INTEGER*2 CBN_ERRSPACE
      PARAMETER (CBN_ERRSPACE=     -1)
      INTEGER*2 CBN_SELCHANGE
      PARAMETER (CBN_SELCHANGE=     1)
      INTEGER*2 CBN_DBLCLK
      PARAMETER (CBN_DBLCLK=        2)
      INTEGER*2 CBN_SETFOCUS
      PARAMETER (CBN_SETFOCUS=      3)
      INTEGER*2 CBN_KILLFOCUS
      PARAMETER (CBN_KILLFOCUS=     4)
      INTEGER*2 CBN_EDITCHANGE
      PARAMETER (CBN_EDITCHANGE=    5)
      INTEGER*2 CBN_EDITUPDATE
      PARAMETER (CBN_EDITUPDATE=    6)
      INTEGER*2 CBN_DROPDOWN
      PARAMETER (CBN_DROPDOWN=      7)

C
C Combo Box styles
C
$IF DEFINED(WINSTYLES)

      INTEGER*4 CBS_SIMPLE
      PARAMETER (CBS_SIMPLE=          #0001)
      INTEGER*4 CBS_DROPDOWN
      PARAMETER (CBS_DROPDOWN=        #0002)
      INTEGER*4 CBS_DROPDOWNLIST
      PARAMETER (CBS_DROPDOWNLIST=    #0003)
      INTEGER*4 CBS_OWNERDRAWFIXED
      PARAMETER (CBS_OWNERDRAWFIXED=  #0010)
      INTEGER*4 CBS_OWNERDRAWVARIABLE
      PARAMETER (CBS_OWNERDRAWVARIABLE=#0020)
      INTEGER*4 CBS_AUTOHSCROLL
      PARAMETER (CBS_AUTOHSCROLL=     #0040)
      INTEGER*4 CBS_OEMCONVERT
      PARAMETER (CBS_OEMCONVERT=      #0080)
      INTEGER*4 CBS_SORT
      PARAMETER (CBS_SORT=            #0100)
      INTEGER*4 CBS_HASSTRINGS
      PARAMETER (CBS_HASSTRINGS=      #0200)
      INTEGER*4 CBS_NOINTEGRALHEIGHT
      PARAMETER (CBS_NOINTEGRALHEIGHT=#0400)

$ENDIF ! NOWINSTYLES

C
C Combo Box messages
C
$IF DEFINED(WINMESSAGES)

      INTEGER*2 CB_GETEDITSEL
      PARAMETER (CB_GETEDITSEL=           WM_USER+0)
      INTEGER*2 CB_LIMITTEXT
      PARAMETER (CB_LIMITTEXT=            WM_USER+1)
      INTEGER*2 CB_SETEDITSEL
      PARAMETER (CB_SETEDITSEL=           WM_USER+2)
      INTEGER*2 CB_ADDSTRING
      PARAMETER (CB_ADDSTRING=            WM_USER+3)
      INTEGER*2 CB_DELETESTRING
      PARAMETER (CB_DELETESTRING=         WM_USER+4)
      INTEGER*2 CB_DIR
      PARAMETER (CB_DIR=                  WM_USER+5)
      INTEGER*2 CB_GETCOUNT
      PARAMETER (CB_GETCOUNT=             WM_USER+6)
      INTEGER*2 CB_GETCURSEL
      PARAMETER (CB_GETCURSEL=            WM_USER+7)
      INTEGER*2 CB_GETLBTEXT
      PARAMETER (CB_GETLBTEXT=            WM_USER+8)
      INTEGER*2 CB_GETLBTEXTLEN
      PARAMETER (CB_GETLBTEXTLEN=         WM_USER+9)
      INTEGER*2 CB_INSERTSTRING
      PARAMETER (CB_INSERTSTRING=         WM_USER+10)
      INTEGER*2 CB_RESETCONTENT
      PARAMETER (CB_RESETCONTENT=         WM_USER+11)
      INTEGER*2 CB_FINDSTRING
      PARAMETER (CB_FINDSTRING=           WM_USER+12)
      INTEGER*2 CB_SELECTSTRING
      PARAMETER (CB_SELECTSTRING=         WM_USER+13)
      INTEGER*2 CB_SETCURSEL
      PARAMETER (CB_SETCURSEL=            WM_USER+14)
      INTEGER*2 CB_SHOWDROPDOWN
      PARAMETER (CB_SHOWDROPDOWN=         WM_USER+15)
      INTEGER*2 CB_GETITEMDATA
      PARAMETER (CB_GETITEMDATA=          WM_USER+16)
      INTEGER*2 CB_SETITEMDATA
      PARAMETER (CB_SETITEMDATA=          WM_USER+17)
      INTEGER*2 CB_GETDROPPEDCONTROLRECT
      PARAMETER (CB_GETDROPPEDCONTROLRECT=WM_USER+18)
      INTEGER*2 CB_MSGMAX
      PARAMETER (CB_MSGMAX=               WM_USER+19)

$ENDIF ! NOWINMESSAGES

$IF DEFINED(WINSTYLES)

C
C Scroll Bar Styles
C
      INTEGER*4 SBS_HORZ
      PARAMETER (SBS_HORZ=                  #0000)
      INTEGER*4 SBS_VERT
      PARAMETER (SBS_VERT=                  #0001)
      INTEGER*4 SBS_TOPALIGN
      PARAMETER (SBS_TOPALIGN=              #0002)
      INTEGER*4 SBS_LEFTALIGN
      PARAMETER (SBS_LEFTALIGN=             #0002)
      INTEGER*4 SBS_BOTTOMALIGN
      PARAMETER (SBS_BOTTOMALIGN=           #0004)
      INTEGER*4 SBS_RIGHTALIGN
      PARAMETER (SBS_RIGHTALIGN=            #0004)
      INTEGER*4 SBS_SIZEBOXTOPLEFTALIGN
      PARAMETER (SBS_SIZEBOXTOPLEFTALIGN=   #0002)
      INTEGER*4 SBS_SIZEBOXBOTTOMRIGHTALIGN
      PARAMETER (SBS_SIZEBOXBOTTOMRIGHTALIGN=#0004)
      INTEGER*4 SBS_SIZEBOX
      PARAMETER (SBS_SIZEBOX=               #0008)

$ENDIF ! NOWINSTYLES

$ENDIF ! NOCTLMGR

$IF DEFINED(SOUND)

      INTEGER*2 OpenSound [EXTERN]
      INTEGER*2 SetVoiceQueueSize [EXTERN]
      INTEGER*2 SetVoiceNote [EXTERN]
      INTEGER*2 SetVoiceAccent [EXTERN]
      INTEGER*2 SetVoiceEnvelope [EXTERN]
      INTEGER*2 SetSoundNoise [EXTERN]
      INTEGER*2 SetVoiceSound [EXTERN]
      INTEGER*2 StartSound [EXTERN]
      INTEGER*2 StopSound [EXTERN]
      INTEGER*2 WaitSoundState [EXTERN]
      INTEGER*2 SyncAllVoices [EXTERN]
      INTEGER*2 CountVoiceNotes [EXTERN]
      INTEGER*4 GetThresholdEvent [EXTERN]
      INTEGER*2 GetThresholdStatus [EXTERN]
      INTEGER*2 SetVoiceThreshold [EXTERN]

C
C WaitSoundState() Constants
C
      INTEGER*2 S_QUEUEEMPTY
      PARAMETER (S_QUEUEEMPTY=      0)
      INTEGER*2 S_THRESHOLD
      PARAMETER (S_THRESHOLD=       1)
      INTEGER*2 S_ALLTHRESHOLD
      PARAMETER (S_ALLTHRESHOLD=    2)

C
C Accent Modes
C
      INTEGER*2 S_NORMAL
      PARAMETER (S_NORMAL=     0)
      INTEGER*2 S_LEGATO
      PARAMETER (S_LEGATO=     1)
      INTEGER*2 S_STACCATO
      PARAMETER (S_STACCATO=   2)

C
C SetSoundNoise() Sources
C
      INTEGER*2 S_PERIOD512
      PARAMETER (S_PERIOD512=  0)     ! Freq = N/512 high pitch, less coarse hiss
      INTEGER*2 S_PERIOD1024
      PARAMETER (S_PERIOD1024= 1)     ! Freq = N/1024
      INTEGER*2 S_PERIOD2048
      PARAMETER (S_PERIOD2048= 2)     ! Freq = N/2048 low pitch, more coarse hiss
      INTEGER*2 S_PERIODVOICE
      PARAMETER (S_PERIODVOICE=3)     ! Source is frequency from voice channel (3)
      INTEGER*2 S_WHITE512
      PARAMETER (S_WHITE512=   4)     ! Freq = N/512 high pitch, less coarse hiss
      INTEGER*2 S_WHITE1024
      PARAMETER (S_WHITE1024=  5)     ! Freq = N/1024
      INTEGER*2 S_WHITE2048
      PARAMETER (S_WHITE2048=  6)     ! Freq = N/2048 low pitch, more coarse hiss
      INTEGER*2 S_WHITEVOICE
      PARAMETER (S_WHITEVOICE= 7)     ! Source is frequency from voice channel (3)

      INTEGER*2 S_SERDVNA
      PARAMETER (S_SERDVNA=   -1)  ! Device not available
      INTEGER*2 S_SEROFM
      PARAMETER (S_SEROFM=    -2)  ! Out of memory
      INTEGER*2 S_SERMACT
      PARAMETER (S_SERMACT=   -3)  ! Music active
      INTEGER*2 S_SERQFUL
      PARAMETER (S_SERQFUL=   -4)  ! Queue full
      INTEGER*2 S_SERBDNT
      PARAMETER (S_SERBDNT=   -5)  ! Invalid note
      INTEGER*2 S_SERDLN
      PARAMETER (S_SERDLN=    -6)  ! Invalid note length
      INTEGER*2 S_SERDCC
      PARAMETER (S_SERDCC=    -7)  ! Invalid note count
      INTEGER*2 S_SERDTP
      PARAMETER (S_SERDTP=    -8)  ! Invalid tempo
      INTEGER*2 S_SERDVL
      PARAMETER (S_SERDVL=    -9)  ! Invalid volume
      INTEGER*2 S_SERDMD
      PARAMETER (S_SERDMD=    -10) ! Invalid mode
      INTEGER*2 S_SERDSH
      PARAMETER (S_SERDSH=    -11) ! Invalid shape
      INTEGER*2 S_SERDPT
      PARAMETER (S_SERDPT=    -12) ! Invalid pitch
      INTEGER*2 S_SERDFQ
      PARAMETER (S_SERDFQ=    -13) ! Invalid frequency
      INTEGER*2 S_SERDDR
      PARAMETER (S_SERDDR=    -14) ! Invalid duration
      INTEGER*2 S_SERDSR
      PARAMETER (S_SERDSR=    -15) ! Invalid source
      INTEGER*2 S_SERDST
      PARAMETER (S_SERDST=    -16) ! Invalid state

$ENDIF ! NOSOUND

$IF DEFINED(COMM)

      INTEGER*2 NOPARITY
      PARAMETER (NOPARITY=          0)
      INTEGER*2 ODDPARITY
      PARAMETER (ODDPARITY=         1)
      INTEGER*2 EVENPARITY
      PARAMETER (EVENPARITY=        2)
      INTEGER*2 MARKPARITY
      PARAMETER (MARKPARITY=        3)
      INTEGER*2 SPACEPARITY
      PARAMETER (SPACEPARITY=       4)

      INTEGER*2 ONESTOPBIT
      PARAMETER (ONESTOPBIT=        0)
      INTEGER*2 ONE5STOPBITS
      PARAMETER (ONE5STOPBITS=      1)
      INTEGER*2 TWOSTOPBITS
      PARAMETER (TWOSTOPBITS=       2)

      INTEGER*2 IGNORE
      PARAMETER (IGNORE=            0)   ! Ignore signal
      INTEGER*2 INFINITE
      PARAMETER (INFINITE=      #FFFF)   ! Infinite timeout

C
C Error Flags
C
      INTEGER*2 CE_RXOVER
      PARAMETER (CE_RXOVER=         #0001)  ! Receive Queue overflow
      INTEGER*2 CE_OVERRUN
      PARAMETER (CE_OVERRUN=        #0002)  ! Receive Overrun Error
      INTEGER*2 CE_RXPARITY
      PARAMETER (CE_RXPARITY=       #0004)  ! Receive Parity Error
      INTEGER*2 CE_FRAME
      PARAMETER (CE_FRAME=          #0008)  ! Receive Framing error
      INTEGER*2 CE_BREAK
      PARAMETER (CE_BREAK=          #0010)  ! Break Detected
      INTEGER*2 CE_CTSTO
      PARAMETER (CE_CTSTO=          #0020)  ! CTS Timeout
      INTEGER*2 CE_DSRTO
      PARAMETER (CE_DSRTO=          #0040)  ! DSR Timeout
      INTEGER*2 CE_RLSDTO
      PARAMETER (CE_RLSDTO=         #0080)  ! RLSD Timeout
      INTEGER*2 CE_TXFULL
      PARAMETER (CE_TXFULL=         #0100)  ! TX Queue is full
      INTEGER*2 CE_PTO
      PARAMETER (CE_PTO=            #0200)  ! LPTx Timeout
      INTEGER*2 CE_IOE
      PARAMETER (CE_IOE=            #0400)  ! LPTx I/O Error
      INTEGER*2 CE_DNS
      PARAMETER (CE_DNS=            #0800)  ! LPTx Device not selected
      INTEGER*2 CE_OOP
      PARAMETER (CE_OOP=            #1000)  ! LPTx Out-Of-Paper
      INTEGER*2 CE_MODE
      PARAMETER (CE_MODE=           #8000)  ! Requested mode unsupported

      INTEGER*2 IE_BADID
      PARAMETER (IE_BADID=          -1)    ! Invalid or unsupported id
      INTEGER*2 IE_OPEN
      PARAMETER (IE_OPEN=           -2)    ! Device Already Open
      INTEGER*2 IE_NOPEN
      PARAMETER (IE_NOPEN=          -3)    ! Device Not Open
      INTEGER*2 IE_MEMORY
      PARAMETER (IE_MEMORY=         -4)    ! Unable to allocate queues
      INTEGER*2 IE_DEFAULT
      PARAMETER (IE_DEFAULT=        -5)    ! Error in default parameters
      INTEGER*2 IE_HARDWARE
      PARAMETER (IE_HARDWARE=       -10)   ! Hardware Not Present
      INTEGER*2 IE_BYTESIZE
      PARAMETER (IE_BYTESIZE=       -11)   ! Illegal Byte Size
      INTEGER*2 IE_BAUDRATE
      PARAMETER (IE_BAUDRATE=       -12)   ! Unsupported BaudRate

C
C Events
C
      INTEGER*2 EV_RXCHAR
      PARAMETER (EV_RXCHAR=         #0001)  ! Any Character received
      INTEGER*2 EV_RXFLAG
      PARAMETER (EV_RXFLAG=         #0002)  ! Received certain character
      INTEGER*2 EV_TXEMPTY
      PARAMETER (EV_TXEMPTY=        #0004)  ! Transmitt Queue Empty
      INTEGER*2 EV_CTS
      PARAMETER (EV_CTS=            #0008)  ! CTS changed state
      INTEGER*2 EV_DSR
      PARAMETER (EV_DSR=            #0010)  ! DSR changed state
      INTEGER*2 EV_RLSD
      PARAMETER (EV_RLSD=           #0020)  ! RLSD changed state
      INTEGER*2 EV_BREAK
      PARAMETER (EV_BREAK=          #0040)  ! BREAK received
      INTEGER*2 EV_ERR
      PARAMETER (EV_ERR=            #0080)  ! Line status error occurred
      INTEGER*2 EV_RING
      PARAMETER (EV_RING=           #0100)  ! Ring signal detected
      INTEGER*2 EV_PERR
      PARAMETER (EV_PERR=           #0200)  ! Printer error occured

C
C Escape Functions
C
      INTEGER*2 SETXOFF
      PARAMETER (SETXOFF=           1)      ! Simulate XOFF received
      INTEGER*2 SETXON
      PARAMETER (SETXON=            2)      ! Simulate XON received
      INTEGER*2 SETRTS
      PARAMETER (SETRTS=            3)      ! Set RTS high
      INTEGER*2 CLRRTS
      PARAMETER (CLRRTS=            4)      ! Set RTS low
      INTEGER*2 SETDTR
      PARAMETER (SETDTR=            5)      ! Set DTR high
      INTEGER*2 CLRDTR
      PARAMETER (CLRDTR=            6)      ! Set DTR low
      INTEGER*2 RESETDEV
      PARAMETER (RESETDEV=          7)      ! Reset device if possible

      INTEGER*2 LPTx
      PARAMETER (LPTx=              #80)    ! Set if ID is for LPT device

      STRUCTURE /DCB/
	 BYTE Id                  ! Internal Device ID
	 INTEGER*2 BaudRate       ! Baudrate at which runing
	 BYTE ByteSize            ! Number of bits/byte, 4-8
	 BYTE Parity              ! 0-4=None,Odd,Even,Mark,Space
	 BYTE StopBits            ! 0,1,2 = 1, 1.5, 2
	 INTEGER*2 RlsTimeout     ! Timeout for RLSD to be set
	 INTEGER*2 CtsTimeout     ! Timeout for CTS to be set
	 INTEGER*2 DsrTimeout     ! Timeout for DSR to be set

C
C Possibly some of these should be preinitialised, acn't be done in Fortran,
C so it becomes the users responsibility.
C
	 BYTE fBinary             ! Binary Mode (skip EOF check)
	 BYTE fRtsDisable         ! Don't assert RTS at init time
	 BYTE fParity             ! Enable parity checking
	 BYTE fOutxCtsFlow        ! CTS handshaking on output
	 BYTE fOutxDsrFlow        ! DSR handshaking on output
C :2 IS /2/ ?
	 BYTE fDummy              ! Reserved
	 BYTE fDtrDisable         ! Don't assert DTR at init time

	 BYTE fOutX               ! Enable output X-ON/X-OFF
	 BYTE fInX                ! Enable input X-ON/X-OFF
	 BYTE fPeChar             ! Enable Parity Err Replacement
	 BYTE fNull               ! Enable Null stripping
	 BYTE fChEvt              ! Enable Rx character event.
	 BYTE fDtrflow            ! DTR handshake on input
	 BYTE fRtsflow            ! RTS handshake on input
	 BYTE fDummy2             ! Reserved

	 CHARACTER XonChar        ! Tx and Rx X-ON character
	 CHARACTER XoffChar       ! Tx and Rx X-OFF character
	 INTEGER*2 XonLim         ! Transmit X-ON threshold
	 INTEGER*2 XoffLim        ! Transmit X-OFF threshold
	 CHARACTER PeChar         ! Parity error replacement char
	 CHARACTER EofChar        ! End of Input character
	 CHARACTER EvtChar        ! Recieved Event character
	 INTEGER*2 TxDelay        ! Amount of time between chars
      END STRUCTURE

      STRUCTURE /COMSTAT/
C
C Possibly some of these should be preinitialised, acn't be done in Fortran,
C so it becomes the users responsibility.
C
	 BYTE fCtsHold          ! Transmit is on CTS hold
	 BYTE fDsrHold          ! Transmit is on DSR hold
	 BYTE fRlsdHold         ! Transmit is on RLSD hold
	 BYTE fXoffHold         ! Received handshake
	 BYTE fXoffSent         ! Issued handshake
	 BYTE fEof              ! End of file character found
	 BYTE fTxim             ! Character being transmitted
	 INTEGER*2 cbInQue      ! count of characters in Rx Queue
	 INTEGER*2 cbOutQue     ! count of characters in Tx Queue
      END STRUCTURE

      INTEGER*2 OpenComm [EXTERN]
      INTEGER*2 SetCommState [EXTERN]
      INTEGER*2 GetCommState [EXTERN]
      INTEGER*2 ReadComm [EXTERN]
      INTEGER*2 UngetCommChar [EXTERN]
      INTEGER*2 WriteComm [EXTERN]
      INTEGER*2 CloseComm [EXTERN]
      INTEGER*2 GetCommError [EXTERN]
      INTEGER*2 BuildCommDCB [EXTERN]
      INTEGER*2 TransmitCommChar [EXTERN]
      INTEGER*2 FAR PASCAL SetCommEventMask [EXTERN]
      INTEGER*2 GetCommEventMask [EXTERN]
      INTEGER*2 SetCommBreak [EXTERN]
      INTEGER*2 ClearCommBreak [EXTERN]
      INTEGER*2 FlushComm [EXTERN]
      INTEGER*2 EscapeCommFunction [EXTERN]

$ENDIF ! NOCOMM

$IF DEFINED(MDI)

      STRUCTURE /MDICREATESTRUCT/
	 INTEGER*4 szClass ! LPSTR
	 INTEGER*4 szTitle ! LPSTR
	 INTEGER*2 HANDLE hOwner
	 INTEGER*2 x,y
	 INTEGER*2 cx,cy
	 INTEGER*4 style
	 INTEGER*4 lParam       ! app-defined stuff
      END STRUCTURE

!typedef MDICREATESTRUCT FAR * LPMDICREATESTRUCT;

      STRUCTURE /CLIENTCREATESTRUCT/
	 INTEGER*2 hWindowMenu
	 INTEGER*2 idFirstChild
      END STRUCTURE

!typedef CLIENTCREATESTRUCT FAR * LPCLIENTCREATESTRUCT;

      INTEGER*2 DefFrameProc [EXTERN]
      INTEGER*2 DefMDIChildProc [EXTERN]

$IF DEFINED(MSG)
      INTEGER*2 TranslateMDISysAccel [EXTERN]
$ENDIF

      INTEGER*2 ArrangeIconicWindows [EXTERN]

$ENDIF ! NOMDI

$ENDIF ! NOUSER

$IF DEFINED(HELP)

C
C Help engine section.
C
C
C Commands to pass WinHelp()
C
      INTEGER*2 HELP_CONTEXT
      PARAMETER (HELP_CONTEXT=  #0001)   ! Display topic in ulTopic
      INTEGER*2 HELP_QUIT
      PARAMETER (HELP_QUIT=     #0002)   ! Terminate help
      INTEGER*2 HELP_INDEX
      PARAMETER (HELP_INDEX=    #0003)   ! Display index
      INTEGER*2 HELP_HELPONHELP
      PARAMETER (HELP_HELPONHELP=#0004)  ! Display help on using help
      INTEGER*2 HELP_SETINDEX
      PARAMETER (HELP_SETINDEX= #0005)   ! Set the current Index for multi index help
      INTEGER*2 HELP_KEY
      PARAMETER (HELP_KEY=      #0101)   ! Display topic for keyword in offabData
      INTEGER*2 HELP_MULTIKEY
      PARAMETER (HELP_MULTIKEY= #0201)

      INTEGER*2 WinHelp [EXTERN]

      STRUCTURE /MULTIKEYHELP/
	 INTEGER*2 mkSize
	 BYTE mkKeylist
	 BYTE szKeyphrase(1)
      END STRUCTURE

$ENDIF ! NOHELP

$IF DEFINED(PROFILER)
C
C function declarations for profiler routines contained in Windows libraries
C
      INTEGER*2 ProfInsChk [EXTERN]
$ENDIF ! NOPROFILER
