// Header: $

#DEFINE BOOL            WORD
#DEFINE Pchar           POINTER
#DEFINE LongInt         DWORD
#DEFINE PStr            ASCIIZ
#DEFINE PBool           *BOOL
#DEFINE PInteger        *WORD
#DEFINE PByte           *Byte
#DEFINE PWord           *Word
#DEFINE PLongInt        *DWORD
#DEFINE _int16          WORD
#DEFINE _char           BYTE

#DEFINE TColorRef       DWORD
#DEFINE TFarProc        POINTER
#DEFINE THandle         WORD
#DEFINE PHandle         *THandle
#DEFINE LPHandle        PHandle
#DEFINE LPVoid          Pointer
#DEFINE TGlobalHandle   THandle
#DEFINE TLocalHandle    Thandle

#DEFINE HWnd        THandle
#DEFINE HStr        THandle
#DEFINE HIcon       THandle
#DEFINE HDC         THandle
#DEFINE HMenu       THandle
#DEFINE HPen        THandle
#DEFINE HFont       THandle
#DEFINE HBrush      THandle
#DEFINE HBitmap     THandle
#DEFINE HCursor     THandle
#DEFINE HRGN        THandle
#DEFINE HPalette    THandle


 // Stock Logical Objects


#DEFINE   White_Brush         0
#DEFINE   LtGray_Brush        1
#DEFINE   Gray_Brush          2
#DEFINE   DkGray_Brush        3
#DEFINE   Black_Brush         4
#DEFINE   Null_Brush          5
#DEFINE   Hollow_Brush        Null_Brush
#DEFINE   White_Pen           6
#DEFINE   Black_Pen           7
#DEFINE   Null_Pen            8
#DEFINE   OEM_Fixed_Font      10
#DEFINE   ANSI_Fixed_Font     11
#DEFINE   ANSI_Var_Font       12
#DEFINE   System_Font         13
#DEFINE   Device_Default_Font 14
#DEFINE   Default_Palette     15
#DEFINE   System_Fixed_Font   16

// Background Modes
#DEFINE   Transparent 1
#DEFINE   Opaque      2

// Scroll Bar Constants
#DEFINE   sb_HORZ 0
#DEFINE   sb_VERT 1
#DEFINE   sb_CTL  2
#DEFINE   sb_BOTH 3

// Scroll Bar Commands
#DEFINE   sb_LineUp        0
#DEFINE   sb_LineDown      1
#DEFINE   sb_PageUp        2
#DEFINE   sb_PageDown      3
#DEFINE   sb_ThumbPosition 4
#DEFINE   sb_ThumbTrack    5
#DEFINE   sb_Top           6
#DEFINE   sb_Bottom        7
#DEFINE   sb_EndScroll     8

// Edit Control Styles
#DEFINE   es_Left        0x0000
#DEFINE   es_Center      0x0001
#DEFINE   es_Right       0x0002
#DEFINE   es_MultiLine   0x0004
#DEFINE   es_UpperCase   0x0008
#DEFINE   es_LowerCase   0x0010
#DEFINE   es_Password    0x0020
#DEFINE   es_AutoVScroll 0x0040
#DEFINE   es_AutoHScroll 0x0080
#DEFINE   es_NoHideSel   0x0100
#DEFINE   es_OEMConvert  0x0400
#DEFINE   es_ReadOnly    0x0800     //Imported from WIN31.SH
#DEFINE   es_WantReturn  0x1000     //Imported from WIN31.SH

// Button Control Styles
#DEFINE   bs_PushButton      0x00
#DEFINE   bs_DefPushButton   0x01
#DEFINE   bs_CheckBox        0x02
#DEFINE   bs_AutoCheckBox    0x03
#DEFINE   bs_RadioButton     0x04
#DEFINE   bs_3State          0x05
#DEFINE   bs_Auto3State      0x06
#DEFINE   bs_GroupBox        0x07
#DEFINE   bs_UserButton      0x08
#DEFINE   bs_AutoRadioButton 0x09
#DEFINE   bs_PushBox         0x0A
#DEFINE   bs_OwnerDraw       0x0B
#DEFINE   bs_LeftText        0x20

// Static Control Constants

#DEFINE   ss_Left           0x00
#DEFINE   ss_Center         0x01
#DEFINE   ss_Right          0x02
#DEFINE   ss_Icon           0x03
#DEFINE   ss_BlackRect      0x04
#DEFINE   ss_GrayRect       0x05
#DEFINE   ss_WhiteRect      0x06
#DEFINE   ss_BlackFrame     0x07
#DEFINE   ss_GrayFrame      0x08
#DEFINE   ss_WhiteFrame     0x09
#DEFINE   ss_UserItem       0x0A
#DEFINE   ss_Simple         0x0B
#DEFINE   ss_LeftNoWordWrap 0x0C
#DEFINE   ss_NoPrefix       0x80   // Don't do "&" character translation

// ShowWindow Commands

#DEFINE   sw_Hide            0
#DEFINE   sw_ShowNormal      1
#DEFINE   sw_Normal          1
#DEFINE   sw_ShowMinimized   2
#DEFINE   sw_ShowMaximized   3
#DEFINE   sw_Maximize        3
#DEFINE   sw_ShowNoActivate  4
#DEFINE   sw_Show            5
#DEFINE   sw_Minimize        6
#DEFINE   sw_ShowMinNoActive 7
#DEFINE   sw_ShowNA          8
#DEFINE   sw_Restore         9


// Identifiers for the wm_ShowWindow message

#DEFINE   sw_ParentClosing 1
#DEFINE   sw_OtherZoom     2
#DEFINE   sw_ParentOpening 3
#DEFINE   sw_OtherUnzoom   4


#DEFINE   wm_Null             0x0000
#DEFINE   wm_Create           0x0001
#DEFINE   wm_Destroy          0x0002
#DEFINE   wm_Move             0x0003
#DEFINE   wm_Size             0x0005
#DEFINE   wm_Activate         0x0006
#DEFINE   wm_SetFocus         0x0007
#DEFINE   wm_KillFocus        0x0008
#DEFINE   wm_Enable           0x000A
#DEFINE   wm_SetRedraw        0x000B
#DEFINE   wm_SetText          0x000C
#DEFINE   wm_GetText          0x000D
#DEFINE   wm_GetTextLength    0x000E
#DEFINE   wm_Paint            0x000F
#DEFINE   wm_Close            0x0010
#DEFINE   wm_QueryEndSession  0x0011
#DEFINE   wm_Quit             0x0012
#DEFINE   wm_QueryOpen        0x0013
#DEFINE   wm_EraseBkGnd       0x0014
#DEFINE   wm_SysColorChange   0x0015
#DEFINE   wm_EndSession       0x0016
#DEFINE   wm_ShowWindow       0x0018
#DEFINE   wm_CtlColor         0x0019
#DEFINE   wm_WinIniChange     0x001A
#DEFINE   wm_DevModeChange    0x001B
#DEFINE   wm_ActivateApp      0x001C
#DEFINE   wm_FontChange       0x001D
#DEFINE   wm_TimeChange       0x001E
#DEFINE   wm_CancelMode       0x001F
#DEFINE   wm_SetCursor        0x0020
#DEFINE   wm_MouseActivate    0x0021
#DEFINE   wm_ChildActivate    0x0022
#DEFINE   wm_QueueSync        0x0023
#DEFINE   wm_GetMinMaxInfo    0x0024
#DEFINE   wm_PaintIcon        0x0026
#DEFINE   wm_IconEraseBkGnd   0x0027
#DEFINE   wm_NextDlgCtl       0x0028
#DEFINE   wm_SpoolerStatus    0x002A
#DEFINE   wm_DrawItem         0x002B
#DEFINE   wm_MeasureItem      0x002C
#DEFINE   wm_DeleteItem       0x002D
#DEFINE   wm_VKeyToItem       0x002E
#DEFINE   wm_CharToItem       0x002F
#DEFINE   wm_SetFont          0x0030
#DEFINE   wm_GetFont          0x0031
#DEFINE   wm_QueryDragIcon    0x0037
#DEFINE   wm_CompareItem      0x0039
#DEFINE   wm_Compacting       0x0041

#DEFINE   wm_NCCreate         0x0081
#DEFINE   wm_NCDestroy        0x0082
#DEFINE   wm_NCCalcSize       0x0083
#DEFINE   wm_NCHitTest        0x0084
#DEFINE   wm_NCPaint          0x0085
#DEFINE   wm_NCActivate       0x0086
#DEFINE   wm_GetDlgCode       0x0087
#DEFINE   wm_NCMouseMove      0x00A0
#DEFINE   wm_NCLButtonDown    0x00A1
#DEFINE   wm_NCLButtonUp      0x00A2
#DEFINE   wm_NCLButtonDblClk  0x00A3
#DEFINE   wm_NCRButtonDown    0x00A4
#DEFINE   wm_NCRButtonUp      0x00A5
#DEFINE   wm_NCRButtonDblClk  0x00A6
#DEFINE   wm_NCMButtonDown    0x00A7
#DEFINE   wm_NCMButtonUp      0x00A8
#DEFINE   wm_NCMButtonDblClk  0x00A9

#DEFINE   wm_KeyFirst         0x0100
#DEFINE   wm_KeyDown          0x0100
#DEFINE   wm_KeyUp            0x0101
#DEFINE   wm_Char             0x0102
#DEFINE   wm_DeadChar         0x0103
#DEFINE   wm_SysKeyDown       0x0104
#DEFINE   wm_SysKeyUp         0x0105
#DEFINE   wm_SysChar          0x0106
#DEFINE   wm_SysDeadChar      0x0107
#DEFINE   wm_KeyLast          0x0108

#DEFINE   wm_InitDialog       0x0110
#DEFINE   wm_Command          0x0111
#DEFINE   wm_SysCommand       0x0112
#DEFINE   wm_Timer            0x0113
#DEFINE   wm_HScroll          0x0114
#DEFINE   wm_VScroll          0x0115
#DEFINE   wm_InitMenu         0x0116
#DEFINE   wm_InitMenuPopup    0x0117
#DEFINE   wm_MenuSelect       0x011F
#DEFINE   wm_MenuChar         0x0120
#DEFINE   wm_EnterIdle        0x0121


#DEFINE   wm_MouseFirst       0x0200
#DEFINE   wm_MouseMove        0x0200
#DEFINE   wm_LButtonDown      0x0201
#DEFINE   wm_LButtonUp        0x0202
#DEFINE   wm_LButtonDblClk    0x0203
#DEFINE   wm_RButtonDown      0x0204
#DEFINE   wm_RButtonUp        0x0205
#DEFINE   wm_RButtonDblClk    0x0206
#DEFINE   wm_MButtonDown      0x0207
#DEFINE   wm_MButtonUp        0x0208
#DEFINE   wm_MButtonDblClk    0x0209
#DEFINE   wm_MouseLast        0x0209

#DEFINE   wm_ParentNotify     0x0210
#DEFINE   wm_MDICreate        0x0220
#DEFINE   wm_MDIDestroy       0x0221
#DEFINE   wm_MDIActivate      0x0222
#DEFINE   wm_MDIRestore       0x0223
#DEFINE   wm_MDINext          0x0224
#DEFINE   wm_MDIMaximize      0x0225
#DEFINE   wm_MDITile          0x0226
#DEFINE   wm_MDICascade       0x0227
#DEFINE   wm_MDIIconArrange   0x0228
#DEFINE   wm_MDIGetActive     0x0229
#DEFINE   wm_MDISetMenu       0x0230

#DEFINE   wm_Cut              0x0300
#DEFINE   wm_Copy             0x0301
#DEFINE   wm_Paste            0x0302
#DEFINE   wm_Clear            0x0303
#DEFINE   wm_Undo             0x0304
#DEFINE   wm_RenderFormat     0x0305
#DEFINE   wm_RenderAllFormats 0x0306
#DEFINE   wm_DestroyClipboard 0x0307
#DEFINE   wm_DrawClipboard    0x0308
#DEFINE   wm_PaintClipboard   0x0309
#DEFINE   wm_VScrollClipboard 0x030A
#DEFINE   wm_SizeClipboard    0x030B
#DEFINE   wm_AskCBFormatName  0x030C
#DEFINE   wm_ChangeCBChain    0x030D
#DEFINE   wm_HScrollClipboard 0x030E
#DEFINE   wm_QueryNewPalette  0x030F
#DEFINE   wm_PaletteIsChanging 0x0310
#DEFINE   wm_PaletteChanged   0x0311

// wParam Flags for wm_MDITILE and wm_MDICASCADE messages.
#DEFINE   mditile_Vertical      0x0000
#DEFINE   mditile_Horizontal    0x0001
#DEFINE   mditile_SkipDisabled  0x0002
// Menu flags for Add/Check/EnableMenuItem

#DEFINE   mf_Insert          0x0000
#DEFINE   mf_Change          0x0080
#DEFINE   mf_Append          0x0100
#DEFINE   mf_Delete          0x0200
#DEFINE   mf_Remove          0x1000

#DEFINE   mf_ByCommand       0x0000
#DEFINE   mf_ByPosition      0x0400

#DEFINE   mf_Separator       0x0800

#DEFINE   mf_Enabled         0x0000
#DEFINE   mf_Grayed          0x0001
#DEFINE   mf_Disabled        0x0002

#DEFINE   mf_Unchecked       0x0000
#DEFINE   mf_Checked         0x0008
#DEFINE   mf_UseCheckBitmaps 0x0200

#DEFINE   mf_String          0x0000
#DEFINE   mf_Bitmap          0x0004
#DEFINE   mf_OwnerDraw       0x0100

#DEFINE   mf_Popup           0x0010
#DEFINE   mf_MenuBarBreak    0x0020
#DEFINE   mf_MenuBreak       0x0040

#DEFINE   mf_Unhilite        0x0000
#DEFINE   mf_Hilite          0x0080

#DEFINE   mf_SysMenu         0x2000
#DEFINE   mf_Help            0x4000
#DEFINE   mf_MouseSelect     0x8000

// MessageBox Flags

#DEFINE   mb_Ok               0x0000
#DEFINE   mb_OkCancel         0x0001
#DEFINE   mb_AbortRetryIgnore 0x0002
#DEFINE   mb_YesNoCancel      0x0003
#DEFINE   mb_YesNo            0x0004
#DEFINE   mb_RetryCancel      0x0005

#DEFINE   mb_IconHand         0x0010
#DEFINE   mb_IconQuestion     0x0020
#DEFINE   mb_IconExclamation  0x0030
#DEFINE   mb_IconAsterisk     0x0040

#DEFINE   mb_IconInformation  mb_IconAsterisk
#DEFINE   mb_IconStop         mb_IconHand

#DEFINE   mb_DefButton1       0x0000
#DEFINE   mb_DefButton2       0x0100
#DEFINE   mb_DefButton3       0x0200

#DEFINE   mb_ApplModal        0x0000
#DEFINE   mb_SystemModal      0x1000
#DEFINE   mb_TaskModal        0x2000

#DEFINE   mb_NoFocus          0x8000

#DEFINE   mb_TypeMask         0x000F
#DEFINE   mb_IconMask         0x00F0
#DEFINE   mb_DefMask          0x0F00
#DEFINE   mb_ModeMask         0x3000
#DEFINE   mb_MiscMask         0xC000
// NOTE: All Message Numbers below 0x0400 are RESERVED

// Private Window Messages Start Here

#DEFINE   wm_User             0x0400
#DEFINE   ws_Overlapped   0x00000000
#DEFINE   ws_Popup        0x80000000
#DEFINE   ws_Child        0x40000000
#DEFINE   ws_Minimize     0x20000000
#DEFINE   ws_Visible      0x10000000
#DEFINE   ws_Disabled     0x08000000
#DEFINE   ws_ClipSiblings 0x04000000
#DEFINE   ws_ClipChildren 0x02000000
#DEFINE   ws_Maximize     0x01000000
#DEFINE   ws_Caption      0x00C00000    // ws_Border + ws_DlgFrame
#DEFINE   ws_Border       0x00800000
#DEFINE   ws_DlgFrame     0x00400000
#DEFINE   ws_VScroll      0x00200000
#DEFINE   ws_HScroll      0x00100000
#DEFINE   ws_SysMenu      0x00080000
#DEFINE   ws_ThickFrame   0x00040000
#DEFINE   ws_Group        0x00020000
#DEFINE   ws_TabStop      0x00010000
#DEFINE   ws_MinimizeBox  0x00020000
#DEFINE   ws_MaximizeBox  0x00010000
#DEFINE   ws_Tiled        ws_Overlapped
#DEFINE   ws_Iconic       ws_Minimize
#DEFINE   ws_SizeBox      ws_ThickFrame

// Common Window Styles
#DEFINE   ws_OverlappedWindow ws_Overlapped + ws_Caption + ws_SysMenu + ws_ThickFrame + ws_MinimizeBox + ws_MaximizeBox
#DEFINE   ws_PopupWindow      ws_Popup + ws_Border + ws_SysMenu
#DEFINE   ws_ChildWindow      ws_Child
#DEFINE   ws_TiledWindow      ws_OverlappedWindow

// Extended Window Styles
#DEFINE   ws_ex_DlgModalFrame  0x00000001
#DEFINE   ws_ex_NoParentNotify 0x00000004

// PeekMessage Options
#DEFINE   pm_NoRemove 0x0000
#DEFINE   pm_Remove   0x0001
#DEFINE   pm_NoYield  0x0002

// System Menu Command Values
#DEFINE   sc_Size       0xF000
#DEFINE   sc_Move       0xF010
#DEFINE   sc_Minimize   0xF020
#DEFINE   sc_Maximize   0xF030
#DEFINE   sc_NextWindow 0xF040
#DEFINE   sc_PrevWindow 0xF050
#DEFINE   sc_Close      0xF060
#DEFINE   sc_VScroll    0xF070
#DEFINE   sc_HScroll    0xF080
#DEFINE   sc_MouseMenu  0xF090
#DEFINE   sc_KeyMenu    0xF100
#DEFINE   sc_Arrange    0xF110
#DEFINE   sc_Restore    0xF120
#DEFINE   sc_TaskList   0xF130
#DEFINE   sc_ScreenSave 0xF140      //Imported from WIN31.SH
#DEFINE   sc_Hotkey     0xF150      //Imported from WIN31.SH

#DEFINE   sc_Icon       sc_Minimize
#DEFINE   sc_Zoom       sc_Maximize

// Dialog Box Command IDs
#DEFINE   id_Ok     1
#DEFINE   id_Cancel 2
#DEFINE   id_Abort  3
#DEFINE   id_Retry  4
#DEFINE   id_Ignore 5
#DEFINE   id_Yes    6
#DEFINE   id_No     7



// Listbox messages

#DEFINE   lb_AddString           (wm_User+1)
#DEFINE   lb_InsertString        (wm_User+2)
#DEFINE   lb_DeleteString        (wm_User+3)
#DEFINE   lb_ResetContent        (wm_User+5)
#DEFINE   lb_SetSel              (wm_User+6)
#DEFINE   lb_SetCurSel           (wm_User+7)
#DEFINE   lb_GetSel              (wm_User+8)
#DEFINE   lb_GetCurSel           (wm_User+9)
#DEFINE   lb_GetText             (wm_User+10)
#DEFINE   lb_GetTextLen          (wm_User+11)
#DEFINE   lb_GetCount            (wm_User+12)
#DEFINE   lb_SelectString        (wm_User+13)
#DEFINE   lb_Dir                 (wm_User+14)
#DEFINE   lb_GetTopIndex         (wm_User+15)
#DEFINE   lb_FindString          (wm_User+16)
#DEFINE   lb_GetSelCount         (wm_User+17)
#DEFINE   lb_GetSelItems         (wm_User+18)
#DEFINE   lb_SetTabStops         (wm_User+19)
#DEFINE   lb_GetHorizontalExt    (wm_User+20)
#DEFINE   lb_SetHorizontalExt    (wm_User+21)
#DEFINE   lb_SetColumnWidth      (wm_User+22)
#DEFINE   lb_SetTopIndex         (wm_User+24)
#DEFINE   lb_GetItemRect         (wm_User+25)
#DEFINE   lb_GetItemData         (wm_User+26)
#DEFINE   lb_SetItemData         (wm_User+27)
#DEFINE   lb_SelItemRange        (wm_User+28)
#DEFINE   lb_SetCaretIndex       (wm_User+31)
#DEFINE   lb_GetCaretIndex       (wm_User+32)
#DEFINE   lb_MsgMax              (wm_User+33)
#DEFINE   lb_FindStringExact     (wm_User+35)
#DEFINE   lb_SetItemHeight       (wm_User+33)
#DEFINE   lb_GetItemHeight       (wm_User+34)

// Listbox Styles

#DEFINE   lbs_Notify            0x0001
#DEFINE   lbs_Sort              0x0002
#DEFINE   lbs_NoRedraw          0x0004
#DEFINE   lbs_MultipleSel       0x0008
#DEFINE   lbs_OwnerDrawFixed    0x0010
#DEFINE   lbs_OwnerDrawVar      0x0020
#DEFINE   lbs_HasStrings        0x0040
#DEFINE   lbs_UseTabStops       0x0080
#DEFINE   lbs_NoIntegralHeight  0x0100
#DEFINE   lbs_MultiColumn       0x0200
#DEFINE   lbs_WantKeyInput      0x0400
#DEFINE   lbs_ExtendedSel       0x0800
#DEFINE   lbs_Standard          lbs_Notify + lbs_Sort + ws_VScroll + ws_Border
#DEFINE   lbs_DisableNoScroll   0x1000

// Combo Box return Values
#DEFINE   cb_Okay     0
#DEFINE   cb_Err      (-1)
#DEFINE   cb_ErrSpace (-2)

// Combo Box Notification Codes
#DEFINE   cbn_ErrSpace   (-1)
#DEFINE   cbn_SelChange  1
#DEFINE   cbn_DblClk     2
#DEFINE   cbn_SetFocus   3
#DEFINE   cbn_KillFocus  4
#DEFINE   cbn_EditChange 5
#DEFINE   cbn_EditUpdate 6
#DEFINE   cbn_DropDown   7
#DEFINE   cbn_SelEndOk 9

// Combo Box styles

#DEFINE   cbs_Simple            0x0001
#DEFINE   cbs_DropDown          0x0002
#DEFINE   cbs_DropDownList      0x0003
#DEFINE   cbs_OwnerDrawFixed    0x0010
#DEFINE   cbs_OwnerDrawVariable 0x0020
#DEFINE   cbs_AutoHScroll       0x0040
#DEFINE   cbs_OEMConvert        0x0080
#DEFINE   cbs_Sort              0x0100
#DEFINE   cbs_HasStrings        0x0200
#DEFINE   cbs_NoIntegralHeight  0x0400

// Combo Box messages

#DEFINE   cb_GetEditSel            (wm_User+0)
#DEFINE   cb_LimitText             (wm_User+1)
#DEFINE   cb_SetEditSel            (wm_User+2)
#DEFINE   cb_AddString             (wm_User+3)
#DEFINE   cb_DeleteString          (wm_User+4)
#DEFINE   cb_Dir                   (wm_User+5)
#DEFINE   cb_GetCount              (wm_User+6)
#DEFINE   cb_GetCurSel             (wm_User+7)
#DEFINE   cb_GetLBText             (wm_User+8)
#DEFINE   cb_GetLBTextLen          (wm_User+9)
#DEFINE   cb_InsertString          (wm_User+10)
#DEFINE   cb_ResetContent          (wm_User+11)
#DEFINE   cb_FindString            (wm_User+12)
#DEFINE   cb_SelectString          (wm_User+13)
#DEFINE   cb_SetCurSel             (wm_User+14)
#DEFINE   cb_ShowDropDown          (wm_User+15)
#DEFINE   cb_GetItemData           (wm_User+16)
#DEFINE   cb_SetItemData           (wm_User+17)
#DEFINE   cb_GetDroppedControlRect (wm_User+18)      //Imported from WIN31.SH
#DEFINE   cb_SetItemHeight         (wm_User+19)      //Imported from WIN31.SH
#DEFINE   cb_GetItemHeight         (wm_User+20)      //Imported from WIN31.SH
#DEFINE   cb_SetExtendedUI         (wm_User+21)      //Imported from WIN31.SH
#DEFINE   cb_GetExtendedUI         (wm_User+22)      //Imported from WIN31.SH
#DEFINE   cb_GetDroppedState       (wm_User+23)      //Imported from WIN31.SH
#DEFINE   cb_FindStringExact       (wm_User+24)      //Imported from WIN31.SH

// Virtual Keys, Standard Set

#DEFINE   vk_LButton   0x01
#DEFINE   vk_RButton   0x02
#DEFINE   vk_Cancel    0x03
#DEFINE   vk_MButton   0x04   // NOT contiguous with L & RBUTTON
#DEFINE   vk_Back      0x08
#DEFINE   vk_Tab       0x09
#DEFINE   vk_Clear     0x0C
#DEFINE   vk_Return    0x0D
#DEFINE   vk_Shift     0x10
#DEFINE   vk_Control   0x11
#DEFINE   vk_Menu      0x12
#DEFINE   vk_Pause     0x13
#DEFINE   vk_Capital   0x14
#DEFINE   vk_Escape    0x1B
#DEFINE   vk_Space     0x20
#DEFINE   vk_Prior     0x21
#DEFINE   vk_Next      0x22
#DEFINE   vk_End       0x23
#DEFINE   vk_Home      0x24
#DEFINE   vk_Left      0x25
#DEFINE   vk_Up        0x26
#DEFINE   vk_Right     0x27
#DEFINE   vk_Down      0x28
#DEFINE   vk_Select    0x29
#DEFINE   vk_Print     0x2A
#DEFINE   vk_Execute   0x2B
#DEFINE   vk_SnapShot  0x2C
// vk_Copy      = $2C not used by keyboards
#DEFINE   vk_Insert    0x2D
#DEFINE   vk_Delete    0x2E
#DEFINE   vk_Help      0x2F
// vk_A thru vk_Z are the same as their ASCII equivalents: 'A' thru 'Z'
// vk_0 thru vk_9 are the same as their ASCII equivalents: '0' thru '9'
#DEFINE   vk_NumPad0   0x60
#DEFINE   vk_NumPad1   0x61
#DEFINE   vk_NumPad2   0x62
#DEFINE   vk_NumPad3   0x63
#DEFINE   vk_NumPad4   0x64
#DEFINE   vk_NumPad5   0x65
#DEFINE   vk_NumPad6   0x66
#DEFINE   vk_NumPad7   0x67
#DEFINE   vk_NumPad8   0x68
#DEFINE   vk_NumPad9   0x69
#DEFINE   vk_Multiply  0x6A
#DEFINE   vk_Add       0x6B
#DEFINE   vk_Separator 0x6C
#DEFINE   vk_Subtract  0x6D
#DEFINE   vk_Decimal   0x6E
#DEFINE   vk_Divide    0x6F
#DEFINE   vk_F1        0x70
#DEFINE   vk_F2        0x71
#DEFINE   vk_F3        0x72
#DEFINE   vk_F4        0x73
#DEFINE   vk_F5        0x74
#DEFINE   vk_F6        0x75
#DEFINE   vk_F7        0x76
#DEFINE   vk_F8        0x77
#DEFINE   vk_F9        0x78
#DEFINE   vk_F10       0x79
#DEFINE   vk_F11       0x7A
#DEFINE   vk_F12       0x7B
#DEFINE   vk_F13       0x7C
#DEFINE   vk_F14       0x7D
#DEFINE   vk_F15       0x7E
#DEFINE   vk_F16       0x7F
#DEFINE   vk_NumLock   0x90

// GetSystemMetrics codes

#DEFINE   sm_CXScreen      0
#DEFINE   sm_CYScreen      1
#DEFINE   sm_CXVScroll     2
#DEFINE   sm_CYHScroll     3
#DEFINE   sm_CYCaption     4
#DEFINE   sm_CXBorder      5
#DEFINE   sm_CYBorder      6
#DEFINE   sm_CXDlgFrame    7
#DEFINE   sm_CYDlgFrame    8
#DEFINE   sm_CYVThumb      9
#DEFINE   sm_CXHThumb      10
#DEFINE   sm_CXIcon        11
#DEFINE   sm_CYIcon        12
#DEFINE   sm_CXCursor      13
#DEFINE   sm_CYCursor      14
#DEFINE   sm_CYMenu        15
#DEFINE   sm_CXFullScreen  16
#DEFINE   sm_CYFullScreen  17
#DEFINE   sm_CYKanjiWindow 18
#DEFINE   sm_MousePresent  19
#DEFINE   sm_CYVScroll     20
#DEFINE   sm_CXHScroll     21
#DEFINE   sm_Debug         22
#DEFINE   sm_SwapButton    23
#DEFINE   sm_Reserved1     24
#DEFINE   sm_Reserved2     25
#DEFINE   sm_Reserved3     26
#DEFINE   sm_Reserved4     27
#DEFINE   sm_CXMin         28
#DEFINE   sm_CYMin         29
#DEFINE   sm_CXSize        30
#DEFINE   sm_CYSize        31
#DEFINE   sm_CXFrame       32
#DEFINE   sm_CYFrame       33
#DEFINE   sm_CXMinTrack    34
#DEFINE   sm_CYMinTrack    35
#DEFINE   sm_CMetrics      36

// SetWindowPos Flags

#DEFINE   swp_NoSize       0x0001
#DEFINE   swp_NoMove       0x0002
#DEFINE   swp_NoZOrder     0x0004
#DEFINE   swp_NoRedraw     0x0008
#DEFINE   swp_NoActivate   0x0010
#DEFINE   swp_DrawFrame    0x0020
#DEFINE   swp_ShowWindow   0x0040
#DEFINE   swp_HideWindow   0x0080
#DEFINE   swp_NoCopyBits   0x0100
#DEFINE   swp_NoReposition 0x0200

// Edit Control Messages

#DEFINE   em_GetSel          (wm_User+0)
#DEFINE   em_SetSel          (wm_User+1)
#DEFINE   em_GetRect         (wm_User+2)
#DEFINE   em_SetRect         (wm_User+3)
#DEFINE   em_SetRectNP       (wm_User+4)
#DEFINE   em_Scroll          (wm_User+5)
#DEFINE   em_LineScroll      (wm_User+6)
#DEFINE   em_GetModify       (wm_User+8)
#DEFINE   em_SetModify       (wm_User+9)
#DEFINE   em_GetLineCount    (wm_User+10)
#DEFINE   em_LineIndex       (wm_User+11)
#DEFINE   em_SetHandle       (wm_User+12)
#DEFINE   em_GetHandle       (wm_User+13)
#DEFINE   em_GetThumb        (wm_User+14)
#DEFINE   em_LineLength      (wm_User+17)
#DEFINE   em_ReplaceSel      (wm_User+18)
#DEFINE   em_SetFont         (wm_User+19)
#DEFINE   em_GetLine         (wm_User+20)
#DEFINE   em_LimitText       (wm_User+21)
#DEFINE   em_CanUndo         (wm_User+22)
#DEFINE   em_Undo            (wm_User+23)
#DEFINE   em_FmtLines        (wm_User+24)
#DEFINE   em_LineFromChar    (wm_User+25)
#DEFINE   em_SetWordBreak    (wm_User+26)
#DEFINE   em_SetTabStops     (wm_User+27)
#DEFINE   em_SetPasswordChar (wm_User+28)
#DEFINE   em_EmptyUndoBuffer (wm_User+29)
#DEFINE   em_MsgMax          (wm_User+30)

  // Flags for TrackPopupMenu  //USED in MOUSE.S only

#DEFINE   tpm_LeftButton  0x0000
#DEFINE   tpm_RightButton 0x0002
#DEFINE   tpm_LeftAlign   0x0000
#DEFINE   tpm_CenterAlign 0x0004
#DEFINE   tpm_RightAlign  0x0008

// Button Control Messages

#DEFINE   bm_GetCheck (wm_User+0)
#DEFINE   bm_SetCheck (wm_User+1)
#DEFINE   bm_GetState (wm_User+2)
#DEFINE   bm_SetState (wm_User+3)
#DEFINE   bm_SetStyle (wm_User+4)

// Edit Control Notification Codes

#DEFINE   en_SetFocus  0x0100
#DEFINE   en_KillFocus 0x0200
#DEFINE   en_Change    0x0300
#DEFINE   en_Update    0x0400
#DEFINE   en_ErrSpace  0x0500
#DEFINE   en_MaxText   0x0501
#DEFINE   en_HScroll   0x0601
#DEFINE   en_VScroll   0x0602


#DEFINE   dm_GetDefID (wm_User+0)
#DEFINE   dm_SetDefID (wm_User+1)
#DEFINE   dc_HasDefID 0x534B

// RedrawWindow() flags

#DEFINE   rdw_Invalidate      0x0001
#DEFINE   rdw_InternalPaint   0x0002
#DEFINE   rdw_Erase           0x0004

#DEFINE   rdw_Validate        0x0008
#DEFINE   rdw_NoInternalPaint 0x0010
#DEFINE   rdw_NoErase         0x0020

#DEFINE   rdw_NoChildren      0x0040
#DEFINE   rdw_AllChildren     0x0080

#DEFINE   rdw_UpdateNow       0x0100
#DEFINE   rdw_EraseNow        0x0200
#DEFINE   rdw_Frame           0x0400
#DEFINE   rdw_NoFrame         0x0800

#DEFINE   lbn_ErrSpace  (-2)
#DEFINE   lbn_SelChange 1
#DEFINE   lbn_DblClk    2
#DEFINE   lbn_SelCancel 3
#DEFINE   lbn_SetFocus  4
#DEFINE   lbn_KillFocus 5


#DEFINE POFStruct  POINTER
structure TOFStruct
{
    Byte cBytes;
    Byte fFixedDisk;
    Word nErrCode;
    Byte reserved[4];
    Char szPathName[128];
}

#DEFINE PTextMetric   POINTER
structure TTextMetric
{
    int16 tmHeight;
    int16 tmAscent;
    int16 tmDescent;
    int16 tmInternalLeading;
    int16 tmExternalLeading;
    int16 tmAveCharWidth;
    int16 tmMaxCharWidth;
    int16 tmWeight;
    Byte tmItalic;
    Byte tmUnderlined;
    Byte tmStruckOut;
    Byte tmFirstChar;
    Byte tmLastChar;
    Byte tmDefaultChar;
    Byte tmBreakChar;
    Byte tmPitchAndFamily;
    Byte tmCharSet;
    int16 tmOverhang;
    int16 tmDigitizedAspectX;
    int16 tmDigitizedAspectY;
}

#DEFINE _PRect POINTER

#DEFINE _TRect int16 left; int16 top; int16 right; int16 bottom
#DEFINE PRect  POINTER
structure TRect
{
    int16 left;
    int16 top;
    int16 right;
    int16 bottom;
}

#DEFINE _TPoint int16 x; int16 y
#DEFINE PPoint   POINTER
structure TPoint
{
    int16 x;
    int16 y;
}

#DEFINE PMsg POINTER
structure TMsg
{
    HWnd hwnd;
    Word message;
    Word wParam;
    int lParam;
    int time;
    _Tpoint;
//    TPoint pt;                   NOT YET SUPPORTED, SEE PREVIOUS
}

#DEFINE PPaintStruct POINTER
structure TPaintStruct
{
    HDC hdc;
    Bool fErase;
    _Trect;
//    TRect rcPaint;  NOT YET SUPPORTED, SEE ABOVE
    Bool fRestore;
    Bool fIncUpdate;
     Byte rgbReserved[16];
}


#DEFINE PWindowPlacement POINTER
struct TWindowPlacement
{
    word length;
    word flags;
    word showCmd;
    //TPoint ptMinPosition;
    int16 ptMinPos_x;
    int16 ptMinPos_y;
    //TPoint ptMaxPosition;
    int16 ptMaxPos_x;
    int16 ptMaxPos_y;
    //TRect rcNormalPosition;
    int16 rcNormPos_left;
    int16 rcNormPos_top;
    int16 rcNormPos_right;
    int16 rcNormPos_bottom;
}


#DEFINE PKeyboardState POINTER
structure TKeyboardState
{
  BYTE k[256];
}


import Bool     AppendMenu(HMenu Menu, Word Flags, Word IDNewItem, ASCIIZ NewItem)  USER 411;
import HDC      BeginPaint(HWnd Wnd, PPaintStruct Paint)  USER 39;
import void     BringWindowToTop(HWnd Wnd) USER 45;
import Bool     CheckMenuItem(HMenu Menu, Word IDCheckItem, Word Check)  USER 154;
import void     ClientToScreen(HWnd Wnd, PPoint Point) USER 28;
import HMenu    CreateMenu()  USER 151;
import HMenu    CreatePopupMenu()  USER 415;
import HBrush   CreateSolidBrush(TColorRef Color)  GDI 66;
import HWnd     CreateWindow(ASCIIZ ClassName, ASCIIZ WindowName, LongInt Style,
                  _int16 X, _int16 Y, _int16 Width, _int16 Height, HWnd WndParent, HMenu Menu,
                  THandle Instance, Pointer Param)  USER 41;
import Bool     DeleteObject(THandle Handle)  GDI 69;
import Bool     DeleteMenu(HMenu Menu, Word Position, Word Flags)  USER 413;
import Bool     DestroyMenu(HMenu Menu)  USER 152;
import Bool     DestroyWindow(HWnd Wnd)  USER 53;
import LongInt  DispatchMessage(PMsg Msg)  USER 114;
import void     DrawMenuBar(HWnd Wnd) USER 160;
import Bool     EnableWindow(HWnd Wnd, Bool Enable)  USER 34;
import void     EndPaint(HWnd Wnd, PPaintStruct Paint) USER 40;
import HWnd     GetActiveWindow()  USER 60;
import void     GetCaretPos(PPoint Point) USER 183;
import void     GetClientRect(HWnd Wnd, _PRect Rect) USER 33;
import HDC      GetDC(HWnd Wnd)  USER 66;
import LongInt  GetDialogBaseUnits()  USER 243;
import _int16   GetDlgCtrlID(HWnd Wnd)  USER 277;
import HWnd     GetDlgItem(HWnd Dlg, _int16 IDDlgItem)  USER 91;
import Word     GetDlgItemInt(HWnd Dlg, _int16 IDDlgItem, PBool Translate, Bool Signed)  USER 95;
import _int16   GetDlgItemText(HWnd Dlg, _int16 IDDlgItem, *ASCIIZ Str, _int16 MaxCount)  USER 93;
import HWnd     GetFocus()  USER 23;
import void     GetKeyboardState(PKeyboardState KeyState) USER 222;
import _int16   GetKeyState(_int16 VirtKey)  USER 106;
import HMenu    GetMenu(HWnd Wnd)  USER 157;
import _int16   GetMenuItemCount  (HMenu Menu) USER 263;   //Imported from WIN31.SH
import Bool     GetMessage(PMsg Msg, HWnd Wnd, Word MsgFilterMin,Word MsgFilterMax)  USER 108;
import LongInt  GetMessageTime()  USER 120;
import THandle  GetModuleHandle(ASCIIZ ModuleName)  KERNEL 47;
import _int16   GetModuleUsage(THandle Module)  KERNEL 48;
import HWnd     GetParent(HWnd Wnd)  USER 46;
import Word     GetProfileInt(ASCIIZ AppName, ASCIIZ KeyName, _int16 Default)  KERNEL 57;
import _int16   GetProfileString(ASCIIZ AppName, ASCIIZ KeyName, ASCIIZ Default, *ASCIIZ ReturnedString, _int16 Size)  KERNEL 58;
import THandle  GetStockObject(_int16 Index)  GDI 87;
import _int16   GetSystemMetrics(_int16 Index)  USER 179;
import LongInt  GetTextExtent(HDC DC, ASCIIZ Str, _int16 Count)  GDI 91;
import Bool     GetTextMetrics(HDC DC, PTextMetric Metrics)  GDI 93;
import HWnd     GetWindow(HWnd Wnd, Word Cmd)  USER 262;
import LongInt  GetWindowLong(HWnd Wnd, _int16 Index)  USER 135;
import Bool     GetWindowPlacement(HWnd Wnd, PWindowPlacement Placement) USER 370;
import void     GetWindowRect(HWnd Wnd, _PRect Rect) USER 32;
import _int16   GetWindowText(HWnd Wnd, *ASCIIZ Str, _int16 MaxCount)  USER 36;
import Bool     IsDialogMessage(HWnd Dlg, PMsg Msg)  USER 90;
import Word     IsDlgButtonChecked(HWnd Wnd, _int16 IDButton)  USER 98;
import Bool     IsIconic(HWnd Wnd)  USER 31;
import Bool     IsWindow(HWnd Wnd)  USER 47;
import Bool     IsWindowEnabled(HWnd Wnd)  USER 35;
import Bool     IsWindowVisible(HWnd Wnd)  USER 49;
import Bool     IsZoomed(HWnd Wnd)  USER 272;
import Bool     KillTimer(HWnd Wnd, _int16 IDEvent)  USER 12;
import HMenu    LoadMenu(THandle Instance, ASCIIZ MenuName)  USER 150;
import Word     MapVirtualKey(Word Code, Word MapType)  KEYBOARD 131;
import void     MessageBeep(Word BeepType) USER 104;
import _int16   MessageBox(HWnd WndParent, ASCIIZ Txt, ASCIIZ Caption, Word TextType)  USER 1;
import void     MoveWindow(HWnd Wnd, _int16 X, _int16 Y, _int16 Width, _int16 Height, Bool Repaint) USER 56;
import _int16   OpenFile(ASCIIZ FileName, POfStruct ReOpenBuff, Word Style)  KERNEL 74;
import Bool     PeekMessage(PMsg Msg, HWnd Wnd, Word MsgFilterMin,Word MsgFilterMax, Word RemoveMsg)  USER 109;
import Bool     PostMessage(HWnd Wnd, Word Msg, Word wParam, LongInt lParam)  USER 110;
import Bool     Rectangle(HDC DC, _int16 X1, _int16 Y1, _int16 X2, _int16 Y2)  GDI 27;
IMPORT BOOL     RedrawWindow(HWnd Wnd, POINTER UpdateRect, HRgn UpdateRgn,WORD Flags) USER 290;
import _int16   ReleaseDC(HWnd Wnd, HDC DC)  USER 68;
import void     ScreenToClient(HWnd Wnd, PPoint Point) USER 29;
import THandle  SelectObject(HDC DC, THandle hObject)  GDI 45;
import LongInt  SendDlgItemMessage(HWnd Dlg, _int16 IDDlgItem, Word Msg, Word wParam, LongInt lParam)  USER 101;

	// This is a modified version of SendDlgItemMessage that passes a *ASCIIZ
	//   instead of a DWORD
import DWORD    SendDlgItemMessageStr(WORD Dlg, WORD IDDlgItem, WORD Msg, WORD wParam, *ASCIIZ lParam) USER 101;
import LongInt  SendMessage(HWnd Wnd, Word Msg, Word wParam, LongInt lParam)  USER 111;
IMPORT DWORD    SendMessageStr( WORD win, WORD msg, WORD wParam, ASCIIZ s ) USER 111;
import HWnd     SetActiveWindow(HWnd Wnd)  USER 59;
import TColorRef SetBkColor(HDC DC, TColorRef Color)  GDI 1;
import _int16   SetBkMode(HDC DC, _int16 BkMode)  GDI 2;
import void     SetDlgItemText(HWnd Dlg, _int16 IDDlgItem, ASCIIZ Str) USER 92;
import HWnd     SetFocus(HWnd Wnd)  USER 22;
import void     SetKeyboardState(PKeyboardState KeyState) USER 223;
import Bool     SetMenu(HWnd Wnd, HMenu Menu)  USER 158;
import TColorRef SetTextColor(HDC DC, TColorRef Color)  GDI 9;
import Word     SetTimer(HWnd Wnd, _int16 IDEvent, Word Elapse, TFarProc TimerFunc)  USER 10;
import LongInt  SetWindowLong(HWnd Wnd, _int16 Index, LongInt NewLong)  USER 136;
import Bool     SetWindowPlacement(HWnd Wnd, PWindowPlacement Placement) USER 371;
import void     SetWindowPos(HWnd Wnd, HWnd WndInsertAfter, _int16 X, _int16 Y, _int16 cx, _int16 cy, Word Flags) USER 232;
import void     SetWindowText(HWnd Wnd, ASCIIZ Str) USER 37;
import Bool     ShowWindow(HWnd Wnd, _int16 CmdShow)  USER 42;
import Bool     TextOut(HDC DC, _int16 X, _int16 Y, ASCIIZ Str, _int16 Count)  GDI 33;
import Bool     TrackPopupMenu(HMenu Menu, Word Flags, _int16 x, _int16 y, _int16 Reserved, HWnd Wnd, Pointer Reserved)  USER 416;
import Bool     TranslateMessage(PMsg Msg)  USER 113;
import void     UpdateWindow(HWnd Wnd) USER 124;