' windef.ab

#ifndef _WINDEF_
#define _WINDEF_

'#ifndef WINVER
'#define WINVER &h0500
'#endif

#ifndef BASETYPES
#define BASETYPES
'TypeDef ULONG = DWord
'TypeDef PULONG = *ULONG
'TypeDef USHORT = Word
'TypeDef PUSHORT = *USHORT
TypeDef UCHAR = Byte
TypeDef PUCHAR = *UCHAR
'TypeDef PSZ = *SByte
#endif

Const MAX_PATH = 260

'#ifndef NULL
'#define NULL
Const NULL = 0 As VoidPtr
'#endif

'#ifndef FALSE
'#define FALSE
Const FALSE = 0
'#endif

'#ifndef TRUE
'#define TRUE
Const TRUE = 1
'#endif

TypeDef DWORD = DWord
TypeDef BOOL = Long
TypeDef BYTE = Byte
TypeDef WORD = Word
'TypeDef FLOAT = Single
'TypeDef PFLOAT = *FLOAT
'TypeDef PBOOL = *BOOL
'TypeDef LPBOOL = *BOOL
'TypeDef PBYTE = *Byte
'TypeDef LPBYTE = *Byte
'TypeDef PINT = *Long
'TypeDef LPINT = *Long
'TypeDef PWORD = *Word
'TypeDef LPWORD = *Word
'TypeDef LPLONG = *Long
'TypeDef PDWORD = *DWord
'TypeDef LPDWORD = *DWord
TypeDef LPVOID = VoidPtr
TypeDef LPCVOID = VoidPtr

'TypeDef INT = Long
'TypeDef UINT = DWord
'TypeDef PUINT = *DWord

#ifndef NT_INCLUDED
#require <winnt.ab>
#endif

'#require <specstrings.ab>

TypeDef WPARAM = ULONG_PTR
TypeDef LPARAM = LONG_PTR
TypeDef LRESULT = LONG_PTR
/*
#ifndef NOMINMAX

#ifndef max
#endif

#ifndef min
#endif

#endif
*/

Const MAKEWORD(l, h) = (((l As Word) And &HFF) Or (((h As Word) And &HFF) << 8)) As Word
Const MAKELONG(l, h) = (((l As DWord) And &HFFFF) Or (((h As DWord) And &HFFFF) << 16)) As Long
Const HIBYTE(w) = (((w As Word) >> 8) And &HFF) As Byte
Const LOBYTE(w) = ((w As Word) And &HFF) As Byte
Const HIWORD(dw) = (((dw As DWord) >> 16) And &HFFFF) As Word
Const LOWORD(dw) = ((dw As DWord) And &HFFFF) As Word

#ifndef WIN_INTERNAL
Type _System_DeclareHandle_HWND:unused As DWord:End Type
TypeDef HWND = *_System_DeclareHandle_HWND
Type _System_DeclareHandle_HHOOK:unused As DWord:End Type
TypeDef HHOOK = *_System_DeclareHandle_HHOOK
#ifdef WINABLE
Type _System_DeclareHandleHEVENT:unused As DWord:End Type
TypeDef HEVENT = *_System_DeclareHandle_HEVENT
#endif
#endif

TypeDef ATOM = Word
TypeDef SPHANDLE = *HANDLE
TypeDef LPHANDLE = *HANDLE
TypeDef HGLOBAL = HANDLE
TypeDef HLOCAL = HANDLE
TypeDef GLOBALHANDLE = HANDLE
TypeDef LOCALHANDLE = HANDLE

TypeDef FARPROC = *Function() As LONG_PTR
TypeDef NEARPROC = *Function() As LONG_PTR
TypeDef PROC = *Function() As LONG_PTR

TypeDef HGDIOBJ = VoidPtr

Type _System_DeclareHandle_HKEY:unused As DWord:End Type
TypeDef HKEY = *_System_DeclareHandle_HKEY
TypeDef PHKEY = *HKEY

#ifndef WIN_INTERNAL
Type _System_DeclareHandle_HACCEL:unused As DWord:End Type
TypeDef HACCEL = *_System_DeclareHandle_HACCEL
#endif
#ifndef GDI_INTERNAL
Type _System_DeclareHandle_HBITMAP:unused As DWord:End Type
TypeDef HBITMAP = *_System_DeclareHandle_HBITMAP
Type _System_DeclareHandle_HBRUSH:unused As DWord:End Type
TypeDef HBRUSH = *_System_DeclareHandle_HBRUSH
#endif
Type _System_DeclareHandle_HCOLORSPACE:unused As DWord:End Type
TypeDef HCOLORSPACE = *_System_DeclareHandle_HCOLORSPACE
#ifndef GDI_INTERNAL
Type _System_DeclareHandle_HDC:unused As DWord:End Type
TypeDef HDC = *_System_DeclareHandle_HDC
#endif
Type _System_DeclareHandle_HGLRC:unused As DWord:End Type
TypeDef HGLRC = *_System_DeclareHandle_HGLRC
Type _System_DeclareHandle_HDESK:unused As DWord:End Type
TypeDef HDESK = *_System_DeclareHandle_HDESK
Type _System_DeclareHandle_HENHMETAFILE:unused As DWord:End Type
TypeDef HENHMETAFILE = *_System_DeclareHandle_HENHMETAFILE
#ifndef GDI_INTERNAL
Type _System_DeclareHandle_HFONT:unused As DWord:End Type
TypeDef HFONT = *_System_DeclareHandle_HFONT
#endif
Type _System_DeclareHandle_HICON:unused As DWord:End Type
TypeDef HICON = *_System_DeclareHandle_HICON
#ifndef WIN_INTERNAL
Type _System_DeclareHandle_HMENU:unused As DWord:End Type
TypeDef HMENU = *_System_DeclareHandle_HMENU
#endif
Type _System_DeclareHandle_HMETAFILE:unused As DWord:End Type
TypeDef HMETAFILE = *_System_DeclareHandle_HMETAFILE
Type _System_DeclareHandle_HINSTANCE:unused As DWord:End Type
TypeDef HINSTANCE = *_System_DeclareHandle_HINSTANCE
TypeDef HMODULE = HINSTANCE
#ifndef GDI_INTERNAL
Type _System_DeclareHandle_HPALETTE:unused As DWord:End Type
TypeDef HPALETTE = *_System_DeclareHandle_HPALETTE
Type _System_DeclareHandle_HPEN:unused As DWord:End Type
TypeDef HPEN = *_System_DeclareHandle_HPEN
#endif
Type _System_DeclareHandle_HRGN:unused As DWord:End Type
TypeDef HRGN = *_System_DeclareHandle_HRGN
Type _System_DeclareHandle_HRSRC:unused As DWord:End Type
TypeDef HRSRC = *_System_DeclareHandle_HRSRC
Type _System_DeclareHandle_HSPRITE:unused As DWord:End Type
TypeDef HSPRITE = *_System_DeclareHandle_HSPRITE
Type _System_DeclareHandle_HSTR:unused As DWord:End Type
TypeDef HSTR = *_System_DeclareHandle_HSTR
Type _System_DeclareHandle_HTASK:unused As DWord:End Type
TypeDef HTASK = *_System_DeclareHandle_HTASK
Type _System_DeclareHandle_HWINSTA:unused As DWord:End Type
TypeDef HWINSTA = *_System_DeclareHandle_HWINSTA
Type _System_DeclareHandle_HKL:unused As DWord:End Type
TypeDef HKL = *_System_DeclareHandle_HKL

Type _System_DeclareHandle_HWINEVENTHOOK:unused As DWord:End Type
TypeDef HWINEVENTHOOK = *_System_DeclareHandle_HWINEVENTHOOK

'#if(WINVER >= 0x0500)
Type _System_DeclareHandle_HMONITOR:unused As DWord:End Type
TypeDef HMONITOR = *_System_DeclareHandle_HMONITOR
Type _System_DeclareHandle_HUMPD:unused As DWord:End Type
TypeDef HUMPD = *_System_DeclareHandle_HUMPD
'#endif

TypeDef HFILE = Long
TypeDef HCURSOR = HICON

TypeDef COLORREF = DWord
TypeDef LPCOLORREF = *DWord

Const HFILE_ERROR = ((-1) As HFILE)

Type RECT
	left As Long
	top As Long
	right As Long
	bottom As Long
End Type

TypeDef PRECT = *RECT
TypeDef NPRECT = *RECT
TypeDef LPRECT = *RECT
TypeDef LPCRECT = *RECT

TypeDef RECTL = RECT
TypeDef PRECTL = *RECTL
TypeDef LPRECTL = *RECTL
TypeDef LPCRECTL = *RECTL

Type POINTAPI
	x As Long
	y As Long
End Type

TypeDef PPOINT = *POINTAPI
TypeDef NPPOINT = *POINTAPI
TypeDef LPPOINT = *POINTAPI

TypeDef POINTL = POINTAPI
TypeDef PPOINTL = *POINTL

Type SIZE
	cx As Long
	cy As Long
End Type

TypeDef PSIZE = *SIZE
TypeDef LPSIZE = *SIZE

TypeDef SIZEL = SIZE
TypeDef PSIZEL = *SIZEL
TypeDef LPSIZEL = *SIZEL

Type POINTS
	x As Integer
	y As Integer
End Type

TypeDef PPOINTS = *POINTS
TypeDef LPPOINTS = *POINTS

Type FILETIME
	dwLowDateTime As DWord
	dwHighDateTime As DWord
End Type

TypeDef PFILETIME = *FILETIME
TypeDef LPFILETIME = *FILETIME

#define _FILETIME_

Const DM_UPDATE = 1
Const DM_COPY = 2
Const DM_PROMPT = 4
Const DM_MODIFY = 8

Const DM_IN_BUFFER = DM_MODIFY
Const DM_IN_PROMPT = DM_PROMPT
Const DM_OUT_BUFFER = DM_COPY
Const DM_OUT_DEFAULT = DM_UPDATE

Const DC_FIELDS = 1
Const DC_PAPERS = 2
Const DC_PAPERSIZE = 3
Const DC_MINEXTENT = 4
Const DC_MAXEXTENT = 5
Const DC_BINS = 6
Const DC_DUPLEX = 7
Const DC_SIZE = 8
Const DC_EXTRA = 9
Const DC_VERSION = 10
Const DC_DRIVER = 11
Const DC_BINNAMES = 12
Const DC_ENUMRESOLUTIONS = 13
Const DC_FILEDEPENDENCIES = 14
Const DC_TRUETYPE = 15
Const DC_PAPERNAMES = 16
Const DC_ORIENTATION = 17
Const DC_COPIES = 18

#endif
