Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - programatrix

#1031

'  constants used with JOYINFOEX structure
Public Const JOY_POVCENTERED = -1
Public Const JOY_POVFORWARD = 0
Public Const JOY_POVRIGHT = 9000
Public Const JOY_POVBACKWARD = 18000
Public Const JOY_POVLEFT = 27000
Public Const JOY_RETURNX = &H1&
Public Const JOY_RETURNY = &H2&
Public Const JOY_RETURNZ = &H4&
Public Const JOY_RETURNR = &H8&
Public Const JOY_RETURNU = &H10                             '  axis 5
Public Const JOY_RETURNV = &H20                             '  axis 6
Public Const JOY_RETURNPOV = &H40&
Public Const JOY_RETURNBUTTONS = &H80&
Public Const JOY_RETURNRAWDATA = &H100&
Public Const JOY_RETURNPOVCTS = &H200&
Public Const JOY_RETURNCENTERED = &H400&
Public Const JOY_USEDEADZONE = &H800&
Public Const JOY_RETURNALL = (JOY_RETURNX Or JOY_RETURNY Or JOY_RETURNZ Or JOY_RETURNR Or JOY_RETURNU Or JOY_RETURNV Or JOY_RETURNPOV Or JOY_RETURNBUTTONS)
Public Const JOY_CAL_READALWAYS = &H10000
Public Const JOY_CAL_READXYONLY = &H20000
Public Const JOY_CAL_READ3 = &H40000
Public Const JOY_CAL_READ4 = &H80000
Public Const JOY_CAL_READXONLY = &H100000
Public Const JOY_CAL_READYONLY = &H200000
Public Const JOY_CAL_READ5 = &H400000
Public Const JOY_CAL_READ6 = &H800000
Public Const JOY_CAL_READZONLY = &H1000000
Public Const JOY_CAL_READRONLY = &H2000000
Public Const JOY_CAL_READUONLY = &H4000000
Public Const JOY_CAL_READVONLY = &H8000000

Declare Function joyGetPos Lib "winmm.dll" Alias "joyGetPos" (ByVal uJoyID As Long, pji As JOYINFO) As Long
Declare Function joyGetPosEx Lib "winmm.dll" Alias "joyGetPosEx" (ByVal uJoyID As Long, pji As JOYINFOEX) As Long
Public Const WAVE_FORMAT_QUERY = &H1
Public Const SND_PURGE = &H40               '  purge non-static events for task
Public Const SND_APPLICATION = &H80         '  look for application specific association
Public Const WAVE_MAPPED = &H4
Public Const WAVE_FORMAT_DIRECT = &H8
Public Const WAVE_FORMAT_DIRECT_QUERY = (WAVE_FORMAT_QUERY Or WAVE_FORMAT_DIRECT)
Public Const MIM_MOREDATA = MM_MIM_MOREDATA
Public Const MOM_POSITIONCB = MM_MOM_POSITIONCB

'  flags for dwFlags parm of midiInOpen()
Public Const MIDI_IO_STATUS = &H20&

Declare Function midiStreamOpen Lib "winmm.dll" Alias "midiStreamOpen" (phms As Long, puDeviceID As Long, ByVal cMidi As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal fdwOpen As Long) As Long
Declare Function midiStreamClose Lib "winmm.dll" Alias "midiStreamClose" (ByVal hms As Long) As Long

Declare Function midiStreamProperty Lib "winmm.dll" Alias "midiStreamProperty" (ByVal hms As Long, lppropdata As Byte, ByVal dwProperty As Long) As Long
Declare Function midiStreamPosition Lib "winmm.dll" Alias "midiStreamPosition" (ByVal hms As Long, lpmmt As MMTIME, ByVal cbmmt As Long) As Long
Declare Function midiStreamOut Lib "winmm.dll" Alias "midiStreamOut" (ByVal hms As Long, pmh As MIDIHDR, ByVal cbmh As Long) As Long
Declare Function midiStreamPause Lib "winmm.dll" Alias "midiStreamPause" (ByVal hms As Long) As Long
Declare Function midiStreamRestart Lib "winmm.dll" Alias "midiStreamRestart" (ByVal hms As Long) As Long
Declare Function midiStreamStop Lib "winmm.dll" Alias "midiStreamStop" (ByVal hms As Long) As Long
Declare Function midiConnect Lib "winmm.dll" Alias "midiConnect" (ByVal hmi As Long, ByVal hmo As Long, pReserved As Any) As Long
Declare Function midiDisconnect Lib "winmm.dll" Alias "midiDisconnect" (ByVal hmi As Long, ByVal hmo As Long, pReserved As Any) As Long

Type JOYINFOEX
        dwSize As Long                 '  size of structure
        dwFlags As Long                 '  flags to indicate what to return
        dwXpos As Long                '  x position
        dwYpos As Long                '  y position
        dwZpos As Long                '  z position
        dwRpos As Long                 '  rudder/4th axis position
        dwUpos As Long                 '  5th axis position
        dwVpos As Long                 '  6th axis position
        dwButtons As Long             '  button states
        dwButtonNumber As Long        '  current button number pressed
        dwPOV As Long                 '  point of view state
        dwReserved1 As Long                 '  reserved for communication between winmm driver
        dwReserved2 As Long                 '  reserved for future expansion
End Type
' Installable driver support

' Driver messages
Public Const DRV_LOAD = &H1
Public Const DRV_ENABLE = &H2
Public Const DRV_OPEN = &H3
Public Const DRV_CLOSE = &H4
Public Const DRV_DISABLE = &H5
Public Const DRV_FREE = &H6
Public Const DRV_CONFIGURE = &H7
Public Const DRV_QUERYCONFIGURE = &H8
Public Const DRV_INSTALL = &H9
Public Const DRV_REMOVE = &HA
Public Const DRV_EXITSESSION = &HB
Public Const DRV_POWER = &HF
Public Const DRV_RESERVED = &H800
Public Const DRV_USER = &H4000

Type DRVCONFIGINFO
        dwDCISize As Long
        lpszDCISectionName As String
        lpszDCIAliasName As String
        dnDevNode As Long
End Type

' Supported return values for DRV_CONFIGURE message
Public Const DRVCNF_CANCEL = &H0
Public Const DRVCNF_OK = &H1
Public Const DRVCNF_RESTART = &H2

'  return values from DriverProc() function
Public Const DRV_CANCEL = DRVCNF_CANCEL
Public Const DRV_OK = DRVCNF_OK
Public Const DRV_RESTART = DRVCNF_RESTART

Declare Function CloseDriver Lib "winmm.dll" Alias "CloseDriver" (ByVal hDriver As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long
Declare Function OpenDriver Lib "winmm.dll" Alias "OpenDriver" (ByVal szDriverName As String, ByVal szSectionName As String, ByVal lParam2 As Long) As Long
Declare Function SendDriverMessage Lib "winmm.dll" Alias "SendDriverMessage" (ByVal hDriver As Long, ByVal message As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long
Declare Function DrvGetModuleHandle Lib "winmm.dll" Alias "DrvGetModuleHandle" (ByVal hDriver As Long) As Long
Declare Function GetDriverModuleHandle Lib "winmm.dll" Alias "GetDriverModuleHandle" (ByVal hDriver As Long) As Long
Declare Function DefDriverProc Lib "winmm.dll" Alias "DefDriverProc" (ByVal dwDriverIdentifier As Long, ByVal hdrvr As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long

Public Const DRV_MCI_FIRST = DRV_RESERVED
Public Const DRV_MCI_LAST = DRV_RESERVED + &HFFF

' Driver callback support

'  flags used with waveOutOpen(), waveInOpen(), midiInOpen(), and
'  midiOutOpen() to specify the type of the dwCallback parameter.
Public Const CALLBACK_TYPEMASK = &H70000      '  callback type mask
Public Const CALLBACK_NULL = &H0        '  no callback
Public Const CALLBACK_WINDOW = &H10000      '  dwCallback is a HWND
Public Const CALLBACK_TASK = &H20000      '  dwCallback is a HTASK
Public Const CALLBACK_FUNCTION = &H30000      '  dwCallback is a FARPROC

'  manufacturer IDs
Public Const MM_MICROSOFT = 1  '  Microsoft Corp.

'  product IDs
Public Const MM_MIDI_MAPPER = 1  '  MIDI Mapper
Public Const MM_WAVE_MAPPER = 2  '  Wave Mapper

Public Const MM_SNDBLST_MIDIOUT = 3  '  Sound Blaster MIDI output port
Public Const MM_SNDBLST_MIDIIN = 4  '  Sound Blaster MIDI input port
Public Const MM_SNDBLST_SYNTH = 5  '  Sound Blaster internal synthesizer
Public Const MM_SNDBLST_WAVEOUT = 6  '  Sound Blaster waveform output
Public Const MM_SNDBLST_WAVEIN = 7  '  Sound Blaster waveform input

Public Const MM_ADLIB = 9  '  Ad Lib-compatible synthesizer

Public Const MM_MPU401_MIDIOUT = 10  '  MPU401-compatible MIDI output port
Public Const MM_MPU401_MIDIIN = 11  '  MPU401-compatible MIDI input port

Public Const MM_PC_JOYSTICK = 12  '  Joystick adapter

Declare Function mmsystemGetVersion Lib "winmm.dll" Alias "mmsystemGetVersion" () As Long
Declare Sub OutputDebugStr Lib "winmm.dll" Alias "OutputDebugStr" (ByVal lpszOutputString As String)

Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

'  flag values for uFlags parameter
Public Const SND_SYNC = &H0         '  play synchronously (default)
Public Const SND_ASYNC = &H1         '  play asynchronously

Public Const SND_NODEFAULT = &H2         '  silence not default, if sound not found

Public Const SND_MEMORY = &H4         '  lpszSoundName points to a memory file
Public Const SND_ALIAS = &H10000     '  name is a WIN.INI [sounds] entry
Public Const SND_FILENAME = &H20000     '  name is a file name
Public Const SND_RESOURCE = &H40004     '  name is a resource name or atom
Public Const SND_ALIAS_ID = &H110000    '  name is a WIN.INI [sounds] entry identifier

Public Const SND_ALIAS_START = 0  '  must be > 4096 to keep strings in same section of resource file

Public Const SND_LOOP = &H8         '  loop the sound until next sndPlaySound
Public Const SND_NOSTOP = &H10        '  don't stop any currently playing sound
Public Const SND_VALID = &H1F        '  valid flags          / ;Internal /

Public Const SND_NOWAIT = &H2000      '  don't wait if the driver is busy

Public Const SND_VALIDFLAGS = &H17201F    '  Set of valid flag bits.  Anything outside
                                    '  this range will raise an error
Public Const SND_RESERVED = &HFF000000  '  In particular these flags are reserved

Public Const SND_TYPE_MASK = &H170007

Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

'  waveform audio error return values
Public Const WAVERR_BADFORMAT = (WAVERR_BASE + 0)    '  unsupported wave format
Public Const WAVERR_STILLPLAYING = (WAVERR_BASE + 1)    '  still something playing
Public Const WAVERR_UNPREPARED = (WAVERR_BASE + 2)    '  header not prepared
Public Const WAVERR_SYNC = (WAVERR_BASE + 3)    '  device is synchronous
Public Const WAVERR_LASTERROR = (WAVERR_BASE + 3)    '  last error in range

'  wave callback messages
Public Const WOM_OPEN = MM_WOM_OPEN
Public Const WOM_CLOSE = MM_WOM_CLOSE
Public Const WOM_DONE = MM_WOM_DONE
Public Const WIM_OPEN = MM_WIM_OPEN
Public Const WIM_CLOSE = MM_WIM_CLOSE
Public Const WIM_DATA = MM_WIM_DATA

'  device ID for wave device mapper
Public Const WAVE_MAPPER = -1&

'  flags for dwFlags parameter in waveOutOpen() and waveInOpen()

Public Const WAVE_ALLOWSYNC = &H2
Public Const WAVE_VALID = &H3         '  ;Internal

Type WAVEHDR
        lpData As String
        dwBufferLength As Long
        dwBytesRecorded As Long
        dwUser As Long
        dwFlags As Long
        dwLoops As Long
        lpNext As Long
        Reserved As Long
End Type

'  flags for dwFlags field of WAVEHDR
Public Const WHDR_DONE = &H1         '  done bit
Public Const WHDR_PREPARED = &H2         '  set if this header has been prepared
Public Const WHDR_BEGINLOOP = &H4         '  loop start block
Public Const WHDR_ENDLOOP = &H8         '  loop end block
Public Const WHDR_INQUEUE = &H10        '  reserved for driver
Public Const WHDR_VALID = &H1F        '  valid flags      / ;Internal /

Type WAVEOUTCAPS
        wMid As Integer
        wPid As Integer
        vDriverVersion As Long
        szPname As String * MAXPNAMELEN
        dwFormats As Long
        wChannels As Integer
        dwSupport As Long
End Type

'  flags for dwSupport field of WAVEOUTCAPS
Public Const WAVECAPS_PITCH = &H1         '  supports pitch control
Public Const WAVECAPS_PLAYBACKRATE = &H2         '  supports playback rate control
Public Const WAVECAPS_VOLUME = &H4         '  supports volume control
Public Const WAVECAPS_LRVOLUME = &H8         '  separate left-right volume control
Public Const WAVECAPS_SYNC = &H10

Type WAVEINCAPS
        wMid As Integer
        wPid As Integer
        vDriverVersion As Long
        szPname As String * MAXPNAMELEN
        dwFormats As Long
        wChannels As Integer
End Type

'  defines for dwFormat field of WAVEINCAPS and WAVEOUTCAPS
Public Const WAVE_INVALIDFORMAT = &H0              '  invalid format
Public Const WAVE_FORMAT_1M08 = &H1              '  11.025 kHz, Mono,   8-bit
Public Const WAVE_FORMAT_1S08 = &H2              '  11.025 kHz, Stereo, 8-bit
Public Const WAVE_FORMAT_1M16 = &H4              '  11.025 kHz, Mono,   16-bit
Public Const WAVE_FORMAT_1S16 = &H8              '  11.025 kHz, Stereo, 16-bit
Public Const WAVE_FORMAT_2M08 = &H10             '  22.05  kHz, Mono,   8-bit
Public Const WAVE_FORMAT_2S08 = &H20             '  22.05  kHz, Stereo, 8-bit
Public Const WAVE_FORMAT_2M16 = &H40             '  22.05  kHz, Mono,   16-bit
Public Const WAVE_FORMAT_2S16 = &H80             '  22.05  kHz, Stereo, 16-bit
Public Const WAVE_FORMAT_4M08 = &H100            '  44.1   kHz, Mono,   8-bit
Public Const WAVE_FORMAT_4S08 = &H200            '  44.1   kHz, Stereo, 8-bit
Public Const WAVE_FORMAT_4M16 = &H400            '  44.1   kHz, Mono,   16-bit
Public Const WAVE_FORMAT_4S16 = &H800            '  44.1   kHz, Stereo, 16-bit

'  flags for wFormatTag field of WAVEFORMAT
Public Const WAVE_FORMAT_PCM = 1  '  Needed in resource files so outside #ifndef RC_INVOKED

Type WAVEFORMAT
        wFormatTag As Integer
        nChannels As Integer
        nSamplesPerSec As Long
        nAvgBytesPerSec As Long
        nBlockAlign As Integer
End Type

Type PCMWAVEFORMAT
        wf As WAVEFORMAT
        wBitsPerSample As Integer
End Type

Declare Function waveOutGetNumDevs Lib "winmm.dll" Alias "waveOutGetNumDevs" () As Long
Declare Function waveOutGetDevCaps Lib "winmm.dll" Alias "waveOutGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As WAVEOUTCAPS, ByVal uSize As Long) As Long

Declare Function waveOutGetVolume Lib "winmm.dll" Alias "waveOutGetVolume" (ByVal uDeviceID As Long, lpdwVolume As Long) As Long
Declare Function waveOutSetVolume Lib "winmm.dll" Alias "waveOutSetVolume" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long

Declare Function waveOutGetErrorText Lib "winmm.dll" Alias "waveOutGetErrorTextA" (ByVal err As Long, ByVal lpText As String, ByVal uSize As Long) As Long

Declare Function waveOutOpen Lib "winmm.dll" Alias "waveOutOpen" (lphWaveOut As Long, ByVal uDeviceID As Long, lpFormat As WAVEFORMAT, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
Declare Function waveOutClose Lib "winmm.dll" Alias "waveOutClose" (ByVal hWaveOut As Long) As Long
Declare Function waveOutPrepareHeader Lib "winmm.dll" Alias "waveOutPrepareHeader" (ByVal hWaveOut As Long, lpWaveOutHdr As WAVEHDR, ByVal uSize As Long) As Long
Declare Function waveOutUnprepareHeader Lib "winmm.dll" Alias "waveOutUnprepareHeader" (ByVal hWaveOut As Long, lpWaveOutHdr As WAVEHDR, ByVal uSize As Long) As Long
Declare Function waveOutWrite Lib "winmm.dll" Alias "waveOutWrite" (ByVal hWaveOut As Long, lpWaveOutHdr As WAVEHDR, ByVal uSize As Long) As Long
Declare Function waveOutPause Lib "winmm.dll" Alias "waveOutPause" (ByVal hWaveOut As Long) As Long
Declare Function waveOutRestart Lib "winmm.dll" Alias "waveOutRestart" (ByVal hWaveOut As Long) As Long
Declare Function waveOutReset Lib "winmm.dll" Alias "waveOutReset" (ByVal hWaveOut As Long) As Long
Declare Function waveOutBreakLoop Lib "winmm.dll" Alias "waveOutBreakLoop" (ByVal hWaveOut As Long) As Long
Declare Function waveOutGetPosition Lib "winmm.dll" Alias "waveOutGetPosition" (ByVal hWaveOut As Long, lpInfo As MMTIME, ByVal uSize As Long) As Long
Declare Function waveOutGetPitch Lib "winmm.dll" Alias "waveOutGetPitch" (ByVal hWaveOut As Long, lpdwPitch As Long) As Long
Declare Function waveOutSetPitch Lib "winmm.dll" Alias "waveOutSetPitch" (ByVal hWaveOut As Long, ByVal dwPitch As Long) As Long
Declare Function waveOutGetPlaybackRate Lib "winmm.dll" Alias "waveOutGetPlaybackRate" (ByVal hWaveOut As Long, lpdwRate As Long) As Long
Declare Function waveOutSetPlaybackRate Lib "winmm.dll" Alias "waveOutSetPlaybackRate" (ByVal hWaveOut As Long, ByVal dwRate As Long) As Long
Declare Function waveOutGetID Lib "winmm.dll" Alias "waveOutGetID" (ByVal hWaveOut As Long, lpuDeviceID As Long) As Long
Declare Function waveOutMessage Lib "winmm.dll" Alias "waveOutMessage" (ByVal hWaveOut As Long, ByVal msg As Long, ByVal dw1 As Long, ByVal dw2 As Long) As Long
Declare Function waveInGetNumDevs Lib "winmm.dll" Alias "waveInGetNumDevs" () As Long

Declare Function waveInGetDevCaps Lib "winmm.dll" Alias "waveInGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As WAVEINCAPS, ByVal uSize As Long) As Long

Declare Function waveInGetErrorText Lib "winmm.dll" Alias "waveInGetErrorTextA" (ByVal err As Long, ByVal lpText As String, ByVal uSize As Long) As Long

Declare Function waveInOpen Lib "winmm.dll" Alias "waveInOpen" (lphWaveIn As Long, ByVal uDeviceID As Long, lpFormat As WAVEFORMAT, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
Declare Function waveInClose Lib "winmm.dll" Alias "waveInClose" (ByVal hWaveIn As Long) As Long
Declare Function waveInPrepareHeader Lib "winmm.dll" Alias "waveInPrepareHeader" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
Declare Function waveInUnprepareHeader Lib "winmm.dll" Alias "waveInUnprepareHeader" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
Declare Function waveInAddBuffer Lib "winmm.dll" Alias "waveInAddBuffer" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
Declare Function waveInStart Lib "winmm.dll" Alias "waveInStart" (ByVal hWaveIn As Long) As Long
Declare Function waveInStop Lib "winmm.dll" Alias "waveInStop" (ByVal hWaveIn As Long) As Long
Declare Function waveInReset Lib "winmm.dll" Alias "waveInReset" (ByVal hWaveIn As Long) As Long
Declare Function waveInGetPosition Lib "winmm.dll" Alias "waveInGetPosition" (ByVal hWaveIn As Long, lpInfo As MMTIME, ByVal uSize As Long) As Long
Declare Function waveInGetID Lib "winmm.dll" Alias "waveInGetID" (ByVal hWaveIn As Long, lpuDeviceID As Long) As Long
Declare Function waveInMessage Lib "winmm.dll" Alias "waveInMessage" (ByVal hWaveIn As Long, ByVal msg As Long, ByVal dw1 As Long, ByVal dw2 As Long) As Long

'  MIDI error return values
Public Const MIDIERR_UNPREPARED = (MIDIERR_BASE + 0)   '  header not prepared
Public Const MIDIERR_STILLPLAYING = (MIDIERR_BASE + 1)   '  still something playing
Public Const MIDIERR_NOMAP = (MIDIERR_BASE + 2)   '  no current map
Public Const MIDIERR_NOTREADY = (MIDIERR_BASE + 3)   '  hardware is still busy
Public Const MIDIERR_NODEVICE = (MIDIERR_BASE + 4)   '  port no longer connected
Public Const MIDIERR_INVALIDSETUP = (MIDIERR_BASE + 5)   '  invalid setup
Public Const MIDIERR_LASTERROR = (MIDIERR_BASE + 5)   '  last error in range

'  MIDI callback messages
Public Const MIM_OPEN = MM_MIM_OPEN
Public Const MIM_CLOSE = MM_MIM_CLOSE
Public Const MIM_DATA = MM_MIM_DATA
Public Const MIM_LONGDATA = MM_MIM_LONGDATA
Public Const MIM_ERROR = MM_MIM_ERROR
Public Const MIM_LONGERROR = MM_MIM_LONGERROR
Public Const MOM_OPEN = MM_MOM_OPEN
Public Const MOM_CLOSE = MM_MOM_CLOSE
Public Const MOM_DONE = MM_MOM_DONE

'  device ID for MIDI mapper
Public Const MIDIMAPPER = (-1)  '  Cannot be cast to DWORD as RC complains
Public Const MIDI_MAPPER = -1&

'  flags for wFlags parm of midiOutCachePatches(), midiOutCacheDrumPatches()
Public Const MIDI_CACHE_ALL = 1
Public Const MIDI_CACHE_BESTFIT = 2
Public Const MIDI_CACHE_QUERY = 3
Public Const MIDI_UNCACHE = 4
Public Const MIDI_CACHE_VALID = (MIDI_CACHE_ALL Or MIDI_CACHE_BESTFIT Or MIDI_CACHE_QUERY Or MIDI_UNCACHE)  '  ;Internal

Type MIDIOUTCAPS
        wMid As Integer
        wPid As Integer
        vDriverVersion As Long
        szPname As String * MAXPNAMELEN
        wTechnology As Integer
        wVoices As Integer
        wNotes As Integer
        wChannelMask As Integer
        dwSupport As Long
End Type

'  flags for wTechnology field of MIDIOUTCAPS structure
Public Const MOD_MIDIPORT = 1  '  output port
Public Const MOD_SYNTH = 2  '  generic internal synth
Public Const MOD_SQSYNTH = 3  '  square wave internal synth
Public Const MOD_FMSYNTH = 4  '  FM internal synth
Public Const MOD_MAPPER = 5  '  MIDI mapper

'  flags for dwSupport field of MIDIOUTCAPS
Public Const MIDICAPS_VOLUME = &H1         '  supports volume control
Public Const MIDICAPS_LRVOLUME = &H2         '  separate left-right volume control
Public Const MIDICAPS_CACHE = &H4

Type MIDIINCAPS
        wMid As Integer
        wPid As Integer
        vDriverVersion As Long
        szPname As String * MAXPNAMELEN
End Type

Type MIDIHDR
        lpData As String
        dwBufferLength As Long
        dwBytesRecorded As Long
        dwUser As Long
        dwFlags As Long
        lpNext As Long
        Reserved As Long
End Type

'  flags for dwFlags field of MIDIHDR structure
Public Const MHDR_DONE = &H1         '  done bit
Public Const MHDR_PREPARED = &H2         '  set if header prepared
Public Const MHDR_INQUEUE = &H4         '  reserved for driver
Public Const MHDR_VALID = &H7         '  valid flags / ;Internal /

Declare Function midiOutGetDevCaps Lib "winmm.dll" Alias "midiOutGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As MIDIOUTCAPS, ByVal uSize As Long) As Long

Declare Function midiOutGetVolume Lib "winmm.dll" Alias "midiOutGetVolume" (ByVal uDeviceID As Long, lpdwVolume As Long) As Long
Declare Function midiOutSetVolume Lib "winmm.dll" Alias "midiOutSetVolume" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long

Declare Function midiOutGetErrorText Lib "winmm.dll" Alias "midiOutGetErrorTextA" (ByVal err As Long, ByVal lpText As String, ByVal uSize As Long) As Long

Declare Function midiOutOpen Lib "winmm.dll" Alias "midiOutOpen" (lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
Declare Function midiOutClose Lib "winmm.dll" Alias "midiOutClose" (ByVal hMidiOut As Long) As Long
Declare Function midiOutPrepareHeader Lib "winmm.dll" Alias "midiOutPrepareHeader" (ByVal hMidiOut As Long, lpMidiOutHdr As MIDIHDR, ByVal uSize As Long) As Long
Declare Function midiOutUnprepareHeader Lib "winmm.dll" Alias "midiOutUnprepareHeader" (ByVal hMidiOut As Long, lpMidiOutHdr As MIDIHDR, ByVal uSize As Long) As Long
Declare Function midiOutShortMsg Lib "winmm.dll" Alias "midiOutShortMsg" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long
Declare Function midiOutLongMsg Lib "winmm.dll" Alias "midiOutLongMsg" (ByVal hMidiOut As Long, lpMidiOutHdr As MIDIHDR, ByVal uSize As Long) As Long
Declare Function midiOutReset Lib "winmm.dll" Alias "midiOutReset" (ByVal hMidiOut As Long) As Long
Declare Function midiOutCachePatches Lib "winmm.dll" Alias "midiOutCachePatches" (ByVal hMidiOut As Long, ByVal uBank As Long, lpPatchArray As Long, ByVal uFlags As Long) As Long
Declare Function midiOutCacheDrumPatches Lib "winmm.dll" Alias "midiOutCacheDrumPatches" (ByVal hMidiOut As Long, ByVal uPatch As Long, lpKeyArray As Long, ByVal uFlags As Long) As Long
Declare Function midiOutGetID Lib "winmm.dll" Alias "midiOutGetID" (ByVal hMidiOut As Long, lpuDeviceID As Long) As Long
Declare Function midiOutMessage Lib "winmm.dll" Alias "midiOutMessage" (ByVal hMidiOut As Long, ByVal msg As Long, ByVal dw1 As Long, ByVal dw2 As Long) As Long
Declare Function midiInGetNumDevs Lib "winmm.dll" Alias "midiInGetNumDevs" () As Long

Declare Function midiInGetDevCaps Lib "winmm.dll" Alias "midiInGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As MIDIINCAPS, ByVal uSize As Long) As Long

Declare Function midiInGetErrorText Lib "winmm.dll" Alias "midiInGetErrorTextA" (ByVal err As Long, ByVal lpText As String, ByVal uSize As Long) As Long

Declare Function midiInOpen Lib "winmm.dll" Alias "midiInOpen" (lphMidiIn As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
Declare Function midiInClose Lib "winmm.dll" Alias "midiInClose" (ByVal hMidiIn As Long) As Long
Declare Function midiInPrepareHeader Lib "winmm.dll" Alias "midiInPrepareHeader" (ByVal hMidiIn As Long, lpMidiInHdr As MIDIHDR, ByVal uSize As Long) As Long
Declare Function midiInUnprepareHeader Lib "winmm.dll" Alias "midiInUnprepareHeader" (ByVal hMidiIn As Long, lpMidiInHdr As MIDIHDR, ByVal uSize As Long) As Long
Declare Function midiInAddBuffer Lib "winmm.dll" Alias "midiInAddBuffer" (ByVal hMidiIn As Long, lpMidiInHdr As MIDIHDR, ByVal uSize As Long) As Long
Declare Function midiInStart Lib "winmm.dll" Alias "midiInStart" (ByVal hMidiIn As Long) As Long
Declare Function midiInStop Lib "winmm.dll" Alias "midiInStop" (ByVal hMidiIn As Long) As Long
Declare Function midiInReset Lib "winmm.dll" Alias "midiInReset" (ByVal hMidiIn As Long) As Long
Declare Function midiInGetID Lib "winmm.dll" Alias "midiInGetID" (ByVal hMidiIn As Long, lpuDeviceID As Long) As Long
Declare Function midiInMessage Lib "winmm.dll" Alias "midiInMessage" (ByVal hMidiIn As Long, ByVal msg As Long, ByVal dw1 As Long, ByVal dw2 As Long) As Long

'  device ID for aux device mapper
Public Const AUX_MAPPER = -1&

Type AUXCAPS
        wMid As Integer
        wPid As Integer
        vDriverVersion As Long
        szPname As String * MAXPNAMELEN
        wTechnology As Integer
        dwSupport As Long
End Type

'  flags for wTechnology field in AUXCAPS structure
Public Const AUXCAPS_CDAUDIO = 1  '  audio from internal CD-ROM drive
Public Const AUXCAPS_AUXIN = 2  '  audio from auxiliary input jacks

'  flags for dwSupport field in AUXCAPS structure
Public Const AUXCAPS_VOLUME = &H1         '  supports volume control
Public Const AUXCAPS_LRVOLUME = &H2         '  separate left-right volume control

Declare Function auxGetNumDevs Lib "winmm.dll" Alias "auxGetNumDevs" () As Long
Declare Function auxGetDevCaps Lib "winmm.dll" Alias "auxGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As AUXCAPS, ByVal uSize As Long) As Long

Declare Function auxSetVolume Lib "winmm.dll" Alias "auxSetVolume" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long
Declare Function auxGetVolume Lib "winmm.dll" Alias "auxGetVolume" (ByVal uDeviceID As Long, lpdwVolume As Long) As Long
Declare Function auxOutMessage Lib "winmm.dll" Alias "auxOutMessage" (ByVal uDeviceID As Long, ByVal msg As Long, ByVal dw1 As Long, ByVal dw2 As Long) As Long

'  timer error return values
Public Const TIMERR_NOERROR = (0)  '  no error
Public Const TIMERR_NOCANDO = (TIMERR_BASE + 1) '  request not completed
Public Const TIMERR_STRUCT = (TIMERR_BASE + 33) '  time struct size

'  flags for wFlags parameter of timeSetEvent() function
Public Const TIME_ONESHOT = 0  '  program timer for single event
Public Const TIME_PERIODIC = 1  '  program for continuous periodic event

Type TIMECAPS
        wPeriodMin As Long
        wPeriodMax As Long
End Type

Declare Function timeGetSystemTime Lib "winmm.dll" Alias "timeGetSystemTime" (lpTime As MMTIME, ByVal uSize As Long) As Long
Declare Function timeGetTime Lib "winmm.dll" Alias "timeGetTime" () As Long
Declare Function timeSetEvent Lib "winmm.dll" Alias "timeSetEvent" (ByVal uDelay As Long, ByVal uResolution As Long, ByVal lpFunction As Long, ByVal dwUser As Long, ByVal uFlags As Long) As Long
Declare Function timeKillEvent Lib "winmm.dll" Alias "timeKillEvent" (ByVal uID As Long) As Long
Declare Function timeGetDevCaps Lib "winmm.dll" Alias "timeGetDevCaps" (lpTimeCaps As TIMECAPS, ByVal uSize As Long) As Long
Declare Function timeBeginPeriod Lib "winmm.dll" Alias "timeBeginPeriod" (ByVal uPeriod As Long) As Long
Declare Function timeEndPeriod Lib "winmm.dll" Alias "timeEndPeriod" (ByVal uPeriod As Long) As Long

'  joystick error return values
Public Const JOYERR_NOERROR = (0)  '  no error
Public Const JOYERR_PARMS = (JOYERR_BASE + 5) '  bad parameters
Public Const JOYERR_NOCANDO = (JOYERR_BASE + 6) '  request not completed
Public Const JOYERR_UNPLUGGED = (JOYERR_BASE + 7) '  joystick is unplugged

'  constants used with JOYINFO structure and MM_JOY messages
Public Const JOY_BUTTON1 = &H1
Public Const JOY_BUTTON2 = &H2
Public Const JOY_BUTTON3 = &H4
Public Const JOY_BUTTON4 = &H8
Public Const JOY_BUTTON1CHG = &H100
Public Const JOY_BUTTON2CHG = &H200
Public Const JOY_BUTTON3CHG = &H400
Public Const JOY_BUTTON4CHG = &H800

'  joystick ID constants
Public Const JOYSTICKID1 = 0
Public Const JOYSTICKID2 = 1

Type JOYCAPS
        wMid As Integer
        wPid As Integer
        szPname As String * MAXPNAMELEN
        wXmin As Integer
        wXmax As Integer
        wYmin As Integer
        wYmax As Integer
        wZmin As Integer
        wZmax As Integer
        wNumButtons As Integer
        wPeriodMin As Integer
        wPeriodMax As Integer
End Type

Type JOYINFO
        wXpos As Integer
        wYpos As Integer
        wZpos As Integer
        wButtons As Integer
End Type

Declare Function joyGetDevCaps Lib "winmm.dll" Alias "joyGetDevCapsA" (ByVal id As Long, lpCaps As JOYCAPS, ByVal uSize As Long) As Long

Declare Function joyGetNumDevs Lib "winmm.dll" Alias "joyGetNumDev" () As Long
Declare Function joyGetThreshold Lib "winmm.dll" Alias "joyGetThreshold" (ByVal id As Long, lpuThreshold As Long) As Long
Declare Function joyReleaseCapture Lib "winmm.dll" Alias "joyReleaseCapture" (ByVal id As Long) As Long
Declare Function joySetCapture Lib "winmm.dll" Alias "joySetCapture" (ByVal hwnd As Long, ByVal uID As Long, ByVal uPeriod As Long, ByVal bChanged As Long) As Long
Declare Function joySetThreshold Lib "winmm.dll" Alias "joySetThreshold" (ByVal id As Long, ByVal uThreshold As Long) As Long

'  MMIO error return values
Public Const MMIOERR_BASE = 256
Public Const MMIOERR_FILENOTFOUND = (MMIOERR_BASE + 1)  '  file not found
Public Const MMIOERR_OUTOFMEMORY = (MMIOERR_BASE + 2)  '  out of memory
Public Const MMIOERR_CANNOTOPEN = (MMIOERR_BASE + 3)  '  cannot open
Public Const MMIOERR_CANNOTCLOSE = (MMIOERR_BASE + 4)  '  cannot close
Public Const MMIOERR_CANNOTREAD = (MMIOERR_BASE + 5)  '  cannot read
Public Const MMIOERR_CANNOTWRITE = (MMIOERR_BASE + 6) '  cannot write
Public Const MMIOERR_CANNOTSEEK = (MMIOERR_BASE + 7)  '  cannot seek
Public Const MMIOERR_CANNOTEXPAND = (MMIOERR_BASE + 8)  '  cannot expand file
Public Const MMIOERR_CHUNKNOTFOUND = (MMIOERR_BASE + 9)  '  chunk not found
Public Const MMIOERR_UNBUFFERED = (MMIOERR_BASE + 10) '  file is unbuffered

'  MMIO constants
Public Const CFSEPCHAR = "+"  '  compound file name separator char.

Type MMIOINFO
        dwFlags As Long
        fccIOProc As Long
        pIOProc As Long
        wErrorRet As Long
        htask As Long
        cchBuffer As Long
        pchBuffer As String
        pchNext As String
        pchEndRead As String
        pchEndWrite As String
        lBufOffset As Long
        lDiskOffset As Long
        adwInfo(4) As Long
        dwReserved1 As Long
        dwReserved2 As Long
        hmmio As Long
End Type

Public Const MMIO_RWMODE = &H3         '  mask to get bits used for opening
                                        '  file for reading/writing/both
Public Const MMIO_SHAREMODE = &H70        '  file sharing mode number

'  constants for dwFlags field of MMIOINFO
Public Const MMIO_CREATE = &H1000      '  create new file (or truncate file)
Public Const MMIO_PARSE = &H100       '  parse new file returning path
Public Const MMIO_DELETE = &H200       '  create new file (or truncate file)
Public Const MMIO_EXIST = &H4000      '  checks for existence of file
Public Const MMIO_ALLOCBUF = &H10000     '  mmioOpen() should allocate a buffer
Public Const MMIO_GETTEMP = &H20000     '  mmioOpen() should retrieve temp name

Public Const MMIO_DIRTY = &H10000000  '  I/O buffer is dirty
'  MMIO_DIRTY is also used in the <dwFlags> field of MMCKINFO structure

Public Const MMIO_OPEN_VALID = &H3FFFF     '  valid flags for mmioOpen / ;Internal /

'  read/write mode numbers (bit field MMIO_RWMODE)
Public Const MMIO_READ = &H0         '  open file for reading only
Public Const MMIO_WRITE = &H1         '  open file for writing only
Public Const MMIO_READWRITE = &H2         '  open file for reading and writing

'  share mode numbers (bit field MMIO_SHAREMODE)
Public Const MMIO_COMPAT = &H0         '  compatibility mode
Public Const MMIO_EXCLUSIVE = &H10        '  exclusive-access mode
Public Const MMIO_DENYWRITE = &H20        '  deny writing to other processes
Public Const MMIO_DENYREAD = &H30        '  deny reading to other processes
Public Const MMIO_DENYNONE = &H40        '  deny nothing to other processes

'  flags for other functions
Public Const MMIO_FHOPEN = &H10    '  mmioClose(): keep file handle open
Public Const MMIO_EMPTYBUF = &H10    '  mmioFlush(): empty the I/O buffer
Public Const MMIO_TOUPPER = &H10    '  mmioStringToFOURCC(): cvt. to u-case
Public Const MMIO_INSTALLPROC = &H10000     '  mmioInstallIOProc(): install MMIOProc
Public Const MMIO_PUBLICPROC = &H10000000  '  mmioInstallIOProc: install Globally
Public Const MMIO_UNICODEPROC = &H1000000   '  mmioInstallIOProc(): Unicode MMIOProc
Public Const MMIO_REMOVEPROC = &H20000     '  mmioInstallIOProc(): remove MMIOProc
Public Const MMIO_FINDPROC = &H40000     '  mmioInstallIOProc(): find an MMIOProc
Public Const MMIO_FINDCHUNK = &H10    '  mmioDescend(): find a chunk by ID
Public Const MMIO_FINDRIFF = &H20    '  mmioDescend(): find a LIST chunk
Public Const MMIO_FINDLIST = &H40    '  mmioDescend(): find a RIFF chunk
Public Const MMIO_CREATERIFF = &H20    '  mmioCreateChunk(): make a LIST chunk
Public Const MMIO_CREATELIST = &H40    '  mmioCreateChunk(): make a RIFF chunk

Public Const MMIO_VALIDPROC = &H11070000  '  valid for mmioInstallIOProc / ;Internal /

'  message numbers for MMIOPROC I/O procedure functions
Public Const MMIOM_READ = MMIO_READ  '  read (must equal MMIO_READ!)
Public Const MMIOM_WRITE = MMIO_WRITE  '  write (must equal MMIO_WRITE!)
Public Const MMIOM_SEEK = 2  '  seek to a new position in file
Public Const MMIOM_OPEN = 3  '  open file
Public Const MMIOM_CLOSE = 4  '  close file
Public Const MMIOM_WRITEFLUSH = 5  '  write and flush
Public Const MMIOM_RENAME = 6  '  rename specified file
Public Const MMIOM_USER = &H8000  '  beginning of user-defined messages

'  flags for mmioSeek()
Public Const SEEK_SET = 0  '  seek to an absolute position
Public Const SEEK_CUR = 1  '  seek relative to current position
Public Const SEEK_END = 2  '  seek relative to end of file

'  other constants
Public Const MMIO_DEFAULTBUFFER = 8192  '  default buffer size

Type MMCKINFO
    ckid As Long
    ckSize As Long
    fccType As Long
    dwDataOffset As Long
    dwFlags As Long
End Type

Declare Function mmioStringToFOURCC Lib "winmm.dll" Alias "mmioStringToFOURCCA" (ByVal sz As String, ByVal uFlags As Long) As Long

Declare Function mmioOpen Lib "winmm.dll" Alias "mmioOpenA" (ByVal szFileName As String, lpmmioinfo As MMIOINFO, ByVal dwOpenFlags As Long) As Long

Declare Function mmioRename Lib "winmm.dll" Alias "mmioRenameA" (ByVal szFileName As String, ByVal SzNewFileName As String, lpmmioinfo As MMIOINFO, ByVal dwRenameFlags As Long) As Long

Declare Function mmioClose Lib "winmm.dll" Alias "mmioClose" (ByVal hmmio As Long, ByVal uFlags As Long) As Long
Declare Function mmioRead Lib "winmm.dll" Alias "mmioRead" (ByVal hmmio As Long, ByVal pch As String, ByVal cch As Long) As Long
Declare Function mmioWrite Lib "winmm.dll" Alias "mmioWrite" (ByVal hmmio As Long, ByVal pch As String, ByVal cch As Long) As Long
Declare Function mmioSeek Lib "winmm.dll" Alias "mmioSeek" (ByVal hmmio As Long, ByVal lOffset As Long, ByVal iOrigin As Long) As Long
Declare Function mmioGetInfo Lib "winmm.dll" Alias "mmioGetInfo" (ByVal hmmio As Long, lpmmioinfo As MMIOINFO, ByVal uFlags As Long) As Long
Declare Function mmioSetInfo Lib "winmm.dll" Alias "mmioSetInfo" (ByVal hmmio As Long, lpmmioinfo As MMIOINFO, ByVal uFlags As Long) As Long
Declare Function mmioSetBuffer Lib "winmm.dll" Alias "mmioSetBuffer" (ByVal hmmio As Long, ByVal pchBuffer As String, ByVal cchBuffer As Long, ByVal uFlags As Long) As Long
Declare Function mmioFlush Lib "winmm.dll" Alias "mmioFlush" (ByVal hmmio As Long, ByVal uFlags As Long) As Long
Declare Function mmioAdvance Lib "winmm.dll" Alias "mmioAdvance" (ByVal hmmio As Long, lpmmioinfo As MMIOINFO, ByVal uFlags As Long) As Long
Declare Function mmioSendMessage Lib "winmm.dll" Alias "mmioSendMessage" (ByVal hmmio As Long, ByVal uMsg As Long, ByVal lParam1 As Long, ByVal lParam2 As Long) As Long

Declare Function mmioDescend Lib "winmm.dll" Alias "mmioDescend" (ByVal hmmio As Long, lpck As MMCKINFO, lpckParent As MMCKINFO, ByVal uFlags As Long) As Long
Declare Function mmioAscend Lib "winmm.dll" Alias "mmioAscend" (ByVal hmmio As Long, lpck As MMCKINFO, ByVal uFlags As Long) As Long
Declare Function mmioCreateChunk Lib "winmm.dll" Alias "mmioCreateChunk" (ByVal hmmio As Long, lpck As MMCKINFO, ByVal uFlags As Long) As Long

' MCI functions

Declare Function mciSendCommand Lib "winmm.dll" Alias "mciSendCommandA" (ByVal wDeviceID As Long, ByVal uMessage As Long, ByVal dwParam1 As Long, ByVal dwParam2 As Any) As Long

Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

Declare Function mciGetCreatorTask Lib "winmm.dll" Alias "mciGetCreatorTask" (ByVal wDeviceID As Long) As Long

Declare Function mciGetDeviceID Lib "winmm.dll" Alias "mciGetDeviceIDA" (ByVal lpstrName As String) As Long

Declare Function mciGetDeviceIDFromElementID Lib "winmm.dll" Alias "mciGetDeviceIDFromElementIDA" (ByVal dwElementID As Long, ByVal lpstrType As String) As Long

Declare Function mciGetErrorString Lib "winmm.dll" Alias "mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal uLength As Long) As Long

Declare Function mciExecute Lib "winmm.dll" Alias "mciExecute" (ByVal lpstrCommand As String) As Long

'   MCI error return values
Public Const MCIERR_INVALID_DEVICE_ID = (MCIERR_BASE + 1)
Public Const MCIERR_UNRECOGNIZED_KEYWORD = (MCIERR_BASE + 3)
Public Const MCIERR_UNRECOGNIZED_COMMAND = (MCIERR_BASE + 5)
Public Const MCIERR_HARDWARE = (MCIERR_BASE + 6)
Public Const MCIERR_INVALID_DEVICE_NAME = (MCIERR_BASE + 7)
Public Const MCIERR_OUT_OF_MEMORY = (MCIERR_BASE + 8)
Public Const MCIERR_DEVICE_OPEN = (MCIERR_BASE + 9)
Public Const MCIERR_CANNOT_LOAD_DRIVER = (MCIERR_BASE + 10)
Public Const MCIERR_MISSING_COMMAND_STRING = (MCIERR_BASE + 11)
Public Const MCIERR_PARAM_OVERFLOW = (MCIERR_BASE + 12)
Public Const MCIERR_MISSING_STRING_ARGUMENT = (MCIERR_BASE + 13)
Public Const MCIERR_BAD_INTEGER = (MCIERR_BASE + 14)
Public Const MCIERR_PARSER_INTERNAL = (MCIERR_BASE + 15)
Public Const MCIERR_DRIVER_INTERNAL = (MCIERR_BASE + 16)
Public Const MCIERR_MISSING_PARAMETER = (MCIERR_BASE + 17)
Public Const MCIERR_UNSUPPORTED_FUNCTION = (MCIERR_BASE + 18)
Public Const MCIERR_FILE_NOT_FOUND = (MCIERR_BASE + 19)
Public Const MCIERR_DEVICE_NOT_READY = (MCIERR_BASE + 20)
Public Const MCIERR_INTERNAL = (MCIERR_BASE + 21)
Public Const MCIERR_DRIVER = (MCIERR_BASE + 22)
Public Const MCIERR_CANNOT_USE_ALL = (MCIERR_BASE + 23)
Public Const MCIERR_MULTIPLE = (MCIERR_BASE + 24)
Public Const MCIERR_EXTENSION_NOT_FOUND = (MCIERR_BASE + 25)
Public Const MCIERR_OUTOFRANGE = (MCIERR_BASE + 26)
Public Const MCIERR_FLAGS_NOT_COMPATIBLE = (MCIERR_BASE + 28)
Public Const MCIERR_FILE_NOT_SAVED = (MCIERR_BASE + 30)
Public Const MCIERR_DEVICE_TYPE_REQUIRED = (MCIERR_BASE + 31)
Public Const MCIERR_DEVICE_LOCKED = (MCIERR_BASE + 32)
Public Const MCIERR_DUPLICATE_ALIAS = (MCIERR_BASE + 33)
Public Const MCIERR_BAD_CONSTANT = (MCIERR_BASE + 34)
Public Const MCIERR_MUST_USE_SHAREABLE = (MCIERR_BASE + 35)
Public Const MCIERR_MISSING_DEVICE_NAME = (MCIERR_BASE + 36)
Public Const MCIERR_BAD_TIME_FORMAT = (MCIERR_BASE + 37)
Public Const MCIERR_NO_CLOSING_QUOTE = (MCIERR_BASE + 38)
Public Const MCIERR_DUPLICATE_FLAGS = (MCIERR_BASE + 39)
Public Const MCIERR_INVALID_FILE = (MCIERR_BASE + 40)
Public Const MCIERR_NULL_PARAMETER_BLOCK = (MCIERR_BASE + 41)
Public Const MCIERR_UNNAMED_RESOURCE = (MCIERR_BASE + 42)
Public Const MCIERR_NEW_REQUIRES_ALIAS = (MCIERR_BASE + 43)
Public Const MCIERR_NOTIFY_ON_AUTO_OPEN = (MCIERR_BASE + 44)
Public Const MCIERR_NO_ELEMENT_ALLOWED = (MCIERR_BASE + 45)
Public Const MCIERR_NONAPPLICABLE_FUNCTION = (MCIERR_BASE + 46)
Public Const MCIERR_ILLEGAL_FOR_AUTO_OPEN = (MCIERR_BASE + 47)
Public Const MCIERR_FILENAME_REQUIRED = (MCIERR_BASE + 48)
Public Const MCIERR_EXTRA_CHARACTERS = (MCIERR_BASE + 49)
Public Const MCIERR_DEVICE_NOT_INSTALLED = (MCIERR_BASE + 50)
Public Const MCIERR_GET_CD = (MCIERR_BASE + 51)
Public Const MCIERR_SET_CD = (MCIERR_BASE + 52)
Public Const MCIERR_SET_DRIVE = (MCIERR_BASE + 53)
Public Const MCIERR_DEVICE_LENGTH = (MCIERR_BASE + 54)
Public Const MCIERR_DEVICE_ORD_LENGTH = (MCIERR_BASE + 55)
Public Const MCIERR_NO_INTEGER = (MCIERR_BASE + 56)

Public Const MCIERR_WAVE_OUTPUTSINUSE = (MCIERR_BASE + 64)
Public Const MCIERR_WAVE_SETOUTPUTINUSE = (MCIERR_BASE + 65)
Public Const MCIERR_WAVE_INPUTSINUSE = (MCIERR_BASE + 66)
Public Const MCIERR_WAVE_SETINPUTINUSE = (MCIERR_BASE + 67)
Public Const MCIERR_WAVE_OUTPUTUNSPECIFIED = (MCIERR_BASE + 68)
Public Const MCIERR_WAVE_INPUTUNSPECIFIED = (MCIERR_BASE + 69)
Public Const MCIERR_WAVE_OUTPUTSUNSUITABLE = (MCIERR_BASE + 70)
Public Const MCIERR_WAVE_SETOUTPUTUNSUITABLE = (MCIERR_BASE + 71)
Public Const MCIERR_WAVE_INPUTSUNSUITABLE = (MCIERR_BASE + 72)
Public Const MCIERR_WAVE_SETINPUTUNSUITABLE = (MCIERR_BASE + 73)

Public Const MCIERR_SEQ_DIV_INCOMPATIBLE = (MCIERR_BASE + 80)
Public Const MCIERR_SEQ_PORT_INUSE = (MCIERR_BASE + 81)
Public Const MCIERR_SEQ_PORT_NONEXISTENT = (MCIERR_BASE + 82)
Public Const MCIERR_SEQ_PORT_MAPNODEVICE = (MCIERR_BASE + 83)
Public Const MCIERR_SEQ_PORT_MISCERROR = (MCIERR_BASE + 84)
Public Const MCIERR_SEQ_TIMER = (MCIERR_BASE + 85)
Public Const MCIERR_SEQ_PORTUNSPECIFIED = (MCIERR_BASE + 86)
Public Const MCIERR_SEQ_NOMIDIPRESENT = (MCIERR_BASE + 87)

Public Const MCIERR_NO_WINDOW = (MCIERR_BASE + 90)
Public Const MCIERR_CREATEWINDOW = (MCIERR_BASE + 91)
Public Const MCIERR_FILE_READ = (MCIERR_BASE + 92)
Public Const MCIERR_FILE_WRITE = (MCIERR_BASE + 93)

'  All custom device driver errors must be >= this value
Public Const MCIERR_CUSTOM_DRIVER_BASE = (MCIERR_BASE + 256)

'  Message numbers must be in the range between MCI_FIRST and MCI_LAST

Public Const MCI_FIRST = &H800
'  Messages 0x801 and 0x802 are reserved
Public Const MCI_OPEN = &H803
Public Const MCI_CLOSE = &H804
Public Const MCI_ESCAPE = &H805
Public Const MCI_PLAY = &H806
Public Const MCI_SEEK = &H807
Public Const MCI_STOP = &H808
Public Const MCI_PAUSE = &H809
Public Const MCI_INFO = &H80A
Public Const MCI_GETDEVCAPS = &H80B
Public Const MCI_SPIN = &H80C
Public Const MCI_SET = &H80D
Public Const MCI_STEP = &H80E
Public Const MCI_RECORD = &H80F
Public Const MCI_SYSINFO = &H810
Public Const MCI_BREAK = &H811
Public Const MCI_SOUND = &H812
Public Const MCI_SAVE = &H813
Public Const MCI_STATUS = &H814

Public Const MCI_CUE = &H830

Public Const MCI_REALIZE = &H840
Public Const MCI_WINDOW = &H841
Public Const MCI_PUT = &H842
Public Const MCI_WHERE = &H843
Public Const MCI_FREEZE = &H844
Public Const MCI_UNFREEZE = &H845

Public Const MCI_LOAD = &H850
Public Const MCI_CUT = &H851
Public Const MCI_COPY = &H852
Public Const MCI_PASTE = &H853
Public Const MCI_UPDATE = &H854
Public Const MCI_RESUME = &H855
Public Const MCI_DELETE = &H856

Public Const MCI_LAST = &HFFF

'  the next 0x400 message ID's are reserved for custom drivers
'  all custom MCI command messages must be >= than this value
Public Const MCI_USER_MESSAGES = (&H400 + MCI_FIRST)
Public Const MCI_ALL_DEVICE_ID =  - 1 '  Matches all MCI devices

'  constants for predefined MCI device types
Public Const MCI_DEVTYPE_VCR = 513
Public Const MCI_DEVTYPE_VIDEODISC = 514
Public Const MCI_DEVTYPE_OVERLAY = 515
Public Const MCI_DEVTYPE_CD_AUDIO = 516
Public Const MCI_DEVTYPE_DAT = 517
Public Const MCI_DEVTYPE_SCANNER = 518
Public Const MCI_DEVTYPE_ANIMATION = 519
Public Const MCI_DEVTYPE_DIGITAL_VIDEO = 520
Public Const MCI_DEVTYPE_OTHER = 521
Public Const MCI_DEVTYPE_WAVEFORM_AUDIO = 522
Public Const MCI_DEVTYPE_SEQUENCER = 523

Public Const MCI_DEVTYPE_FIRST = MCI_DEVTYPE_VCR
Public Const MCI_DEVTYPE_LAST = MCI_DEVTYPE_SEQUENCER

Public Const MCI_DEVTYPE_FIRST_USER = &H1000

'  return values for 'status mode' command
Public Const MCI_MODE_NOT_READY = (MCI_STRING_OFFSET + 12)
Public Const MCI_MODE_STOP = (MCI_STRING_OFFSET + 13)
Public Const MCI_MODE_PLAY = (MCI_STRING_OFFSET + 14)
Public Const MCI_MODE_RECORD = (MCI_STRING_OFFSET + 15)
Public Const MCI_MODE_SEEK = (MCI_STRING_OFFSET + 16)
Public Const MCI_MODE_PAUSE = (MCI_STRING_OFFSET + 17)
Public Const MCI_MODE_OPEN = (MCI_STRING_OFFSET + 18)

'  constants used in 'set time format' and 'status time format' commands
Public Const MCI_FORMAT_MILLISECONDS = 0
Public Const MCI_FORMAT_HMS = 1
Public Const MCI_FORMAT_MSF = 2
Public Const MCI_FORMAT_FRAMES = 3
Public Const MCI_FORMAT_SMPTE_24 = 4
Public Const MCI_FORMAT_SMPTE_25 = 5
Public Const MCI_FORMAT_SMPTE_30 = 6
Public Const MCI_FORMAT_SMPTE_30DROP = 7
Public Const MCI_FORMAT_BYTES = 8
Public Const MCI_FORMAT_SAMPLES = 9
Public Const MCI_FORMAT_TMSF = 10

'  Flags for wParam of the MM_MCINOTIFY message
Public Const MCI_NOTIFY_SUCCESSFUL = &H1
Public Const MCI_NOTIFY_SUPERSEDED = &H2
Public Const MCI_NOTIFY_ABORTED = &H4
Public Const MCI_NOTIFY_FAILURE = &H8

'  common flags for dwFlags parameter of MCI command messages
Public Const MCI_NOTIFY = &H1&
Public Const MCI_WAIT = &H2&
Public Const MCI_FROM = &H4&
Public Const MCI_TO = &H8&
Public Const MCI_TRACK = &H10&

'  flags for dwFlags parameter of MCI_OPEN command message
Public Const MCI_OPEN_SHAREABLE = &H100&
Public Const MCI_OPEN_ELEMENT = &H200&
Public Const MCI_OPEN_ALIAS = &H400&
Public Const MCI_OPEN_ELEMENT_ID = &H800&
Public Const MCI_OPEN_TYPE_ID = &H1000&
Public Const MCI_OPEN_TYPE = &H2000&

'  flags for dwFlags parameter of MCI_SEEK command message
Public Const MCI_SEEK_TO_START = &H100&
Public Const MCI_SEEK_TO_END = &H200&

'  flags for dwFlags parameter of MCI_STATUS command message
Public Const MCI_STATUS_ITEM = &H100&
Public Const MCI_STATUS_START = &H200&

'  flags for dwItem field of the MCI_STATUS_PARMS parameter block
Public Const MCI_STATUS_LENGTH = &H1&
Public Const MCI_STATUS_POSITION = &H2&
Public Const MCI_STATUS_NUMBER_OF_TRACKS = &H3&
Public Const MCI_STATUS_MODE = &H4&
Public Const MCI_STATUS_MEDIA_PRESENT = &H5&
Public Const MCI_STATUS_TIME_FORMAT = &H6&
Public Const MCI_STATUS_READY = &H7&
Public Const MCI_STATUS_CURRENT_TRACK = &H8&

'  flags for dwFlags parameter of MCI_INFO command message
Public Const MCI_INFO_PRODUCT = &H100&
Public Const MCI_INFO_FILE = &H200&

'  flags for dwFlags parameter of MCI_GETDEVCAPS command message
Public Const MCI_GETDEVCAPS_ITEM = &H100&

'  flags for dwItem field of the MCI_GETDEVCAPS_PARMS parameter block
Public Const MCI_GETDEVCAPS_CAN_RECORD = &H1&
Public Const MCI_GETDEVCAPS_HAS_AUDIO = &H2&
Public Const MCI_GETDEVCAPS_HAS_VIDEO = &H3&
Public Const MCI_GETDEVCAPS_DEVICE_TYPE = &H4&
Public Const MCI_GETDEVCAPS_USES_FILES = &H5&
Public Const MCI_GETDEVCAPS_COMPOUND_DEVICE = &H6&
Public Const MCI_GETDEVCAPS_CAN_EJECT = &H7&
Public Const MCI_GETDEVCAPS_CAN_PLAY = &H8&
Public Const MCI_GETDEVCAPS_CAN_SAVE = &H9&

'  flags for dwFlags parameter of MCI_SYSINFO command message
Public Const MCI_SYSINFO_QUANTITY = &H100&
Public Const MCI_SYSINFO_OPEN = &H200&
Public Const MCI_SYSINFO_NAME = &H400&
Public Const MCI_SYSINFO_INSTALLNAME = &H800&

'  flags for dwFlags parameter of MCI_SET command message
Public Const MCI_SET_DOOR_OPEN = &H100&
Public Const MCI_SET_DOOR_CLOSED = &H200&
Public Const MCI_SET_TIME_FORMAT = &H400&
Public Const MCI_SET_AUDIO = &H800&
Public Const MCI_SET_VIDEO = &H1000&
Public Const MCI_SET_ON = &H2000&
Public Const MCI_SET_OFF = &H4000&

'  flags for dwAudio field of MCI_SET_PARMS or MCI_SEQ_SET_PARMS
Public Const MCI_SET_AUDIO_ALL = &H4001&
Public Const MCI_SET_AUDIO_LEFT = &H4002&
Public Const MCI_SET_AUDIO_RIGHT = &H4003&

'  flags for dwFlags parameter of MCI_BREAK command message
Public Const MCI_BREAK_KEY = &H100&
Public Const MCI_BREAK_HWND = &H200&
Public Const MCI_BREAK_OFF = &H400&

'  flags for dwFlags parameter of MCI_RECORD command message
Public Const MCI_RECORD_INSERT = &H100&
Public Const MCI_RECORD_OVERWRITE = &H200&

'  flags for dwFlags parameter of MCI_SOUND command message
Public Const MCI_SOUND_NAME = &H100&

'  flags for dwFlags parameter of MCI_SAVE command message
Public Const MCI_SAVE_FILE = &H100&

'  flags for dwFlags parameter of MCI_LOAD command message
Public Const MCI_LOAD_FILE = &H100&
#1032

'  Type codes which go in the high byte of the event DWORD of a stream buffer

'  Type codes 00-7F contain parameters within the low 24 bits
'  Type codes 80-FF contain a length of their parameter in the low 24
'  bits, followed by their parameter data in the buffer. The event
'  DWORD contains the exact byte length; the parm data itself must be
'  padded to be an even multiple of 4 Byte long.
'

Public Const MEVT_F_SHORT = &H0&
Public Const MEVT_F_LONG = &H80000000
Public Const MEVT_F_CALLBACK = &H40000000
Public Const MIDISTRM_ERROR = -2

'
'  Structures and defines for midiStreamProperty
'
Public Const MIDIPROP_SET = &H80000000
Public Const MIDIPROP_GET = &H40000000

'  These are intentionally both non-zero so the app cannot accidentally
'  leave the operation off and happen to appear to work due to default
'  action.

Public Const MIDIPROP_TIMEDIV = &H1&
Public Const MIDIPROP_TEMPO = &H2&

Type MIDIPROPTIMEDIV
        cbStruct As Long
        dwTimeDiv As Long
End Type

Type MIDIPROPTEMPO
        cbStruct As Long
        dwTempo As Long
End Type


'  MIDI function prototypes *

' ***************************************************************************

'                             Mixer Support

' **************************************************************************

Public Const MIXER_SHORT_NAME_CHARS = 16
Public Const MIXER_LONG_NAME_CHARS = 64

'
'   MMRESULT error return values specific to the mixer API
'
'
Public Const MIXERR_BASE = 1024
Public Const MIXERR_INVALLINE = (MIXERR_BASE + 0)
Public Const MIXERR_INVALCONTROL = (MIXERR_BASE + 1)
Public Const MIXERR_INVALVALUE = (MIXERR_BASE + 2)
Public Const MIXERR_LASTERROR = (MIXERR_BASE + 2)


Public Const MIXER_OBJECTF_HANDLE = &H80000000
Public Const MIXER_OBJECTF_MIXER = &H0&
Public Const MIXER_OBJECTF_HMIXER = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_MIXER)
Public Const MIXER_OBJECTF_WAVEOUT = &H10000000
Public Const MIXER_OBJECTF_HWAVEOUT = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_WAVEOUT)
Public Const MIXER_OBJECTF_WAVEIN = &H20000000
Public Const MIXER_OBJECTF_HWAVEIN = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_WAVEIN)
Public Const MIXER_OBJECTF_MIDIOUT = &H30000000
Public Const MIXER_OBJECTF_HMIDIOUT = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_MIDIOUT)
Public Const MIXER_OBJECTF_MIDIIN = &H40000000
Public Const MIXER_OBJECTF_HMIDIIN = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_MIDIIN)
Public Const MIXER_OBJECTF_AUX = &H50000000

Declare Function mixerGetNumDevs Lib "winmm.dll" Alias "mixerGetNumDevs" () As Long

Type MIXERCAPS
        wMid As Integer                   '  manufacturer id
        wPid As Integer                   '  product id
        vDriverVersion As Long            '  version of the driver
        szPname As String * MAXPNAMELEN   '  product name
        fdwSupport As Long             '  misc. support bits
        cDestinations As Long          '  count of destinations
End Type

Declare Function mixerGetDevCaps Lib "winmm.dll" Alias "mixerGetDevCapsA" (ByVal uMxId As Long, ByVal pmxcaps As MIXERCAPS, ByVal cbmxcaps As Long) As Long
Declare Function mixerOpen Lib "winmm.dll" Alias "mixerOpen" (phmx As Long, ByVal uMxId As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal fdwOpen As Long) As Long
Declare Function mixerClose Lib "winmm.dll" Alias "mixerClose" (ByVal hmx As Long) As Long
Declare Function mixerMessage Lib "winmm.dll" Alias "mixerMessage" (ByVal hmx As Long, ByVal uMsg As Long, ByVal dwParam1 As Long, ByVal dwParam2 As Long) As Long

Type Target    ' for use in MIXERLINE and others (embedded structure)

        dwType As Long                 '  MIXERLINE_TARGETTYPE_xxxx
        dwDeviceID As Long             '  target device ID of device type
        wMid As Integer                   '  of target device
        wPid As Integer                   '       "
        vDriverVersion As Long            '       "
        szPname As String * MAXPNAMELEN
End Type

Type MIXERLINE
        cbStruct As Long               '  size of MIXERLINE structure
        dwDestination As Long          '  zero based destination index
        dwSource As Long               '  zero based source index (if source)
        dwLineID As Long               '  unique line id for mixer device
        fdwLine As Long                '  state/information about line
        dwUser As Long                 '  driver specific information
        dwComponentType As Long        '  component type line connects to
        cChannels As Long              '  number of channels line supports
        cConnections As Long           '  number of connections (possible)
        cControls As Long              '  number of controls at this line
        szShortName As String * MIXER_SHORT_NAME_CHARS
        szName As String * MIXER_LONG_NAME_CHARS
        lpTarget As Target
End Type

'   MIXERLINE.fdwLine

Public Const MIXERLINE_LINEF_ACTIVE = &H1&
Public Const MIXERLINE_LINEF_DISCONNECTED = &H8000&
Public Const MIXERLINE_LINEF_SOURCE = &H80000000

'   MIXERLINE.dwComponentType

'   component types for destinations and sources

Public Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &H0&
Public Const MIXERLINE_COMPONENTTYPE_DST_UNDEFINED = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 0)
Public Const MIXERLINE_COMPONENTTYPE_DST_DIGITAL = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 1)
Public Const MIXERLINE_COMPONENTTYPE_DST_LINE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 2)
Public Const MIXERLINE_COMPONENTTYPE_DST_MONITOR = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 3)
Public Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4)
Public Const MIXERLINE_COMPONENTTYPE_DST_HEADPHONES = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 5)
Public Const MIXERLINE_COMPONENTTYPE_DST_TELEPHONE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 6)
Public Const MIXERLINE_COMPONENTTYPE_DST_WAVEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 7)
Public Const MIXERLINE_COMPONENTTYPE_DST_VOICEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8)
Public Const MIXERLINE_COMPONENTTYPE_DST_LAST = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8)

Public Const MIXERLINE_COMPONENTTYPE_SRC_FIRST = &H1000&
Public Const MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0)
Public Const MIXERLINE_COMPONENTTYPE_SRC_DIGITAL = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1)
Public Const MIXERLINE_COMPONENTTYPE_SRC_LINE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2)
Public Const MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3)
Public Const MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4)
Public Const MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5)
Public Const MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6)
Public Const MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7)
Public Const MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8)
Public Const MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9)
Public Const MIXERLINE_COMPONENTTYPE_SRC_ANALOG = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10)
Public Const MIXERLINE_COMPONENTTYPE_SRC_LAST = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10)


'
'   MIXERLINE.Target.dwType
'
'
Public Const MIXERLINE_TARGETTYPE_UNDEFINED = 0
Public Const MIXERLINE_TARGETTYPE_WAVEOUT = 1
Public Const MIXERLINE_TARGETTYPE_WAVEIN = 2
Public Const MIXERLINE_TARGETTYPE_MIDIOUT = 3
Public Const MIXERLINE_TARGETTYPE_MIDIIN = 4
Public Const MIXERLINE_TARGETTYPE_AUX = 5

Declare Function mixerGetLineInfo Lib "winmm.dll" Alias "mixerGetLineInfoA" (ByVal hmxobj As Long, pmxl As MIXERLINE, ByVal fdwInfo As Long) As Long
Public Const MIXER_GETLINEINFOF_DESTINATION = &H0&
Public Const MIXER_GETLINEINFOF_SOURCE = &H1&
Public Const MIXER_GETLINEINFOF_LINEID = &H2&
Public Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H3&
Public Const MIXER_GETLINEINFOF_TARGETTYPE = &H4&
Public Const MIXER_GETLINEINFOF_QUERYMASK = &HF&

Declare Function mixerGetID Lib "winmm.dll" Alias "mixerGetID" (ByVal hmxobj As Long, pumxID As Long, ByVal fdwId As Long) As Long

'   MIXERCONTROL

Type MIXERCONTROL
        cbStruct As Long           '  size in Byte of MIXERCONTROL
        dwControlID As Long        '  unique control id for mixer device
        dwControlType As Long      '  MIXERCONTROL_CONTROLTYPE_xxx
        fdwControl As Long         '  MIXERCONTROL_CONTROLF_xxx
        cMultipleItems As Long     '  if MIXERCONTROL_CONTROLF_MULTIPLE set
        szShortName As String * MIXER_SHORT_NAME_CHARS
        szName As String * MIXER_LONG_NAME_CHARS
        Bounds As Double
        Metrics As Long
End Type
'
'   MIXERCONTROL.fdwControl

Public Const MIXERCONTROL_CONTROLF_UNIFORM = &H1&
Public Const MIXERCONTROL_CONTROLF_MULTIPLE = &H2&
Public Const MIXERCONTROL_CONTROLF_DISABLED = &H80000000

'   MIXERCONTROL_CONTROLTYPE_xxx building block defines

Public Const MIXERCONTROL_CT_CLASS_MASK = &HF0000000
Public Const MIXERCONTROL_CT_CLASS_CUSTOM = &H0&
Public Const MIXERCONTROL_CT_CLASS_METER = &H10000000
Public Const MIXERCONTROL_CT_CLASS_SWITCH = &H20000000
Public Const MIXERCONTROL_CT_CLASS_NUMBER = &H30000000
Public Const MIXERCONTROL_CT_CLASS_SLIDER = &H40000000
Public Const MIXERCONTROL_CT_CLASS_FADER = &H50000000
Public Const MIXERCONTROL_CT_CLASS_TIME = &H60000000
Public Const MIXERCONTROL_CT_CLASS_LIST = &H70000000
Public Const MIXERCONTROL_CT_SUBCLASS_MASK = &HF000000
Public Const MIXERCONTROL_CT_SC_SWITCH_BOOLEAN = &H0&
Public Const MIXERCONTROL_CT_SC_SWITCH_BUTTON = &H1000000
Public Const MIXERCONTROL_CT_SC_METER_POLLED = &H0&
Public Const MIXERCONTROL_CT_SC_TIME_MICROSECS = &H0&
Public Const MIXERCONTROL_CT_SC_TIME_MILLISECS = &H1000000
Public Const MIXERCONTROL_CT_SC_LIST_SINGLE = &H0&
Public Const MIXERCONTROL_CT_SC_LIST_MULTIPLE = &H1000000
Public Const MIXERCONTROL_CT_UNITS_MASK = &HFF0000
Public Const MIXERCONTROL_CT_UNITS_CUSTOM = &H0&
Public Const MIXERCONTROL_CT_UNITS_BOOLEAN = &H10000
Public Const MIXERCONTROL_CT_UNITS_SIGNED = &H20000
Public Const MIXERCONTROL_CT_UNITS_UNSIGNED = &H30000
Public Const MIXERCONTROL_CT_UNITS_DECIBELS = &H40000 '  in 10ths
Public Const MIXERCONTROL_CT_UNITS_PERCENT = &H50000 '  in 10ths
'
'   Commonly used control types for specifying MIXERCONTROL.dwControlType
'
Public Const MIXERCONTROL_CONTROLTYPE_CUSTOM = (MIXERCONTROL_CT_CLASS_CUSTOM Or MIXERCONTROL_CT_UNITS_CUSTOM)
Public Const MIXERCONTROL_CONTROLTYPE_BOOLEANMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_SIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_PEAKMETER = (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1)
Public Const MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_BOOLEAN = (MIXERCONTROL_CT_CLASS_SWITCH Or MIXERCONTROL_CT_SC_SWITCH_BOOLEAN Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_ONOFF = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1)
Public Const MIXERCONTROL_CONTROLTYPE_MUTE = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2)
Public Const MIXERCONTROL_CONTROLTYPE_MONO = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3)
Public Const MIXERCONTROL_CONTROLTYPE_LOUDNESS = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4)
Public Const MIXERCONTROL_CONTROLTYPE_STEREOENH = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5)
Public Const MIXERCONTROL_CONTROLTYPE_BUTTON = (MIXERCONTROL_CT_CLASS_SWITCH Or MIXERCONTROL_CT_SC_SWITCH_BUTTON Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_DECIBELS = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_DECIBELS)
Public Const MIXERCONTROL_CONTROLTYPE_SIGNED = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_SIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_UNSIGNED = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_PERCENT = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_PERCENT)
Public Const MIXERCONTROL_CONTROLTYPE_SLIDER = (MIXERCONTROL_CT_CLASS_SLIDER Or MIXERCONTROL_CT_UNITS_SIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_PAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 1)
Public Const MIXERCONTROL_CONTROLTYPE_QSOUNDPAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 2)
Public Const MIXERCONTROL_CONTROLTYPE_FADER = (MIXERCONTROL_CT_CLASS_FADER Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_VOLUME = (MIXERCONTROL_CONTROLTYPE_FADER + 1)
Public Const MIXERCONTROL_CONTROLTYPE_BASS = (MIXERCONTROL_CONTROLTYPE_FADER + 2)
Public Const MIXERCONTROL_CONTROLTYPE_TREBLE = (MIXERCONTROL_CONTROLTYPE_FADER + 3)
Public Const MIXERCONTROL_CONTROLTYPE_EQUALIZER = (MIXERCONTROL_CONTROLTYPE_FADER + 4)
Public Const MIXERCONTROL_CONTROLTYPE_SINGLESELECT = (MIXERCONTROL_CT_CLASS_LIST Or MIXERCONTROL_CT_SC_LIST_SINGLE Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_MUX = (MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1)
Public Const MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT = (MIXERCONTROL_CT_CLASS_LIST Or MIXERCONTROL_CT_SC_LIST_MULTIPLE Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_MIXER = (MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1)
Public Const MIXERCONTROL_CONTROLTYPE_MICROTIME = (MIXERCONTROL_CT_CLASS_TIME Or MIXERCONTROL_CT_SC_TIME_MICROSECS Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_MILLITIME = (MIXERCONTROL_CT_CLASS_TIME Or MIXERCONTROL_CT_SC_TIME_MILLISECS Or MIXERCONTROL_CT_UNITS_UNSIGNED)
'
'   MIXERLINECONTROLS
'
Type MIXERLINECONTROLS
        cbStruct As Long       '  size in Byte of MIXERLINECONTROLS
        dwLineID As Long       '  line id (from MIXERLINE.dwLineID)
                                             '  MIXER_GETLINECONTROLSF_ONEBYID or
        dwControl As Long  '  MIXER_GETLINECONTROLSF_ONEBYTYPE
        cControls As Long      '  count of controls pmxctrl points to
        cbmxctrl As Long       '  size in Byte of _one_ MIXERCONTROL
        pamxctrl As MIXERCONTROL       '  pointer to first MIXERCONTROL array
End Type

Declare Function mixerGetLineControls Lib "winmm.dll" Alias "mixerGetLineControlsA" (ByVal hmxobj As Long, pmxlc As MIXERLINECONTROLS, ByVal fdwControls As Long) As Long

Public Const MIXER_GETLINECONTROLSF_ALL = &H0&
Public Const MIXER_GETLINECONTROLSF_ONEBYID = &H1&
Public Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &H2&
Public Const MIXER_GETLINECONTROLSF_QUERYMASK = &HF&

Type MIXERCONTROLDETAILS
        cbStruct As Long       '  size in Byte of MIXERCONTROLDETAILS
        dwControlID As Long    '  control id to get/set details on
        cChannels As Long      '  number of channels in paDetails array
        item As Long                           ' hwndOwner or cMultipleItems
        cbDetails As Long      '  size of _one_ details_XX struct
        paDetails As Long      '  pointer to array of details_XX structs
End Type

'   MIXER_GETCONTROLDETAILSF_LISTTEXT

Type MIXERCONTROLDETAILS_LISTTEXT
        dwParam1 As Long
        dwParam2 As Long
        szName As String * MIXER_LONG_NAME_CHARS
End Type

'   MIXER_GETCONTROLDETAILSF_VALUE

Type MIXERCONTROLDETAILS_BOOLEAN
        fValue As Long
End Type

Type MIXERCONTROLDETAILS_SIGNED
        lValue As Long
End Type

Type MIXERCONTROLDETAILS_UNSIGNED
        dwValue As Long
End Type

Declare Function mixerGetControlDetails Lib "winmm.dll" Alias "mixerGetControlDetailsA" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long

Public Const MIXER_GETCONTROLDETAILSF_VALUE = &H0&
Public Const MIXER_GETCONTROLDETAILSF_LISTTEXT = &H1&
Public Const MIXER_GETCONTROLDETAILSF_QUERYMASK = &HF&

Declare Function mixerSetControlDetails Lib "winmm.dll" Alias "mixerSetControlDetails" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long

Public Const MIXER_SETCONTROLDETAILSF_VALUE = &H0&
Public Const MIXER_SETCONTROLDETAILSF_CUSTOM = &H1&
Public Const MIXER_SETCONTROLDETAILSF_QUERYMASK = &HF&

'  constants used with JOYINFOEX
Public Const JOY_BUTTON5 = &H10&
Public Const JOY_BUTTON6 = &H20&
Public Const JOY_BUTTON7 = &H40&
Public Const JOY_BUTTON8 = &H80&
Public Const JOY_BUTTON9 = &H100&
Public Const JOY_BUTTON10 = &H200&
Public Const JOY_BUTTON11 = &H400&
Public Const JOY_BUTTON12 = &H800&
Public Const JOY_BUTTON13 = &H1000&
Public Const JOY_BUTTON14 = &H2000&
Public Const JOY_BUTTON15 = &H4000&
Public Const JOY_BUTTON16 = &H8000&
Public Const JOY_BUTTON17 = &H10000
Public Const JOY_BUTTON18 = &H20000
Public Const JOY_BUTTON19 = &H40000
Public Const JOY_BUTTON20 = &H80000
Public Const JOY_BUTTON21 = &H100000
Public Const JOY_BUTTON22 = &H200000
Public Const JOY_BUTTON23 = &H400000
Public Const JOY_BUTTON24 = &H800000
Public Const JOY_BUTTON25 = &H1000000
Public Const JOY_BUTTON26 = &H2000000
Public Const JOY_BUTTON27 = &H4000000
Public Const JOY_BUTTON28 = &H8000000
Public Const JOY_BUTTON29 = &H10000000
Public Const JOY_BUTTON30 = &H20000000
Public Const JOY_BUTTON31 = &H40000000
Public Const JOY_BUTTON32 = &H80000000

#1033

' /////////////////////////
'                        //
'    RPC Status Codes    //
'                        //
' /////////////////////////

'   The string binding is invalid.
Public Const RPC_S_INVALID_STRING_BINDING = 1700&

'   The binding handle is not the correct type.
Public Const RPC_S_WRONG_KIND_OF_BINDING = 1701&

'   The binding handle is invalid.
Public Const RPC_S_INVALID_BINDING = 1702&

'   The RPC protocol sequence is not supported.
Public Const RPC_S_PROTSEQ_NOT_SUPPORTED = 1703&

'   The RPC protocol sequence is invalid.
Public Const RPC_S_INVALID_RPC_PROTSEQ = 1704&

'   The string universal unique identifier (UUID) is invalid.
Public Const RPC_S_INVALID_STRING_UUID = 1705&

'   The endpoint format is invalid.
Public Const RPC_S_INVALID_ENDPOINT_FORMAT = 1706&

'   The network address is invalid.
Public Const RPC_S_INVALID_NET_ADDR = 1707&

'   No endpoint was found.
Public Const RPC_S_NO_ENDPOINT_FOUND = 1708&

'   The timeout value is invalid.
Public Const RPC_S_INVALID_TIMEOUT = 1709&

'   The object universal unique identifier (UUID) was not found.
Public Const RPC_S_OBJECT_NOT_FOUND = 1710&

'   The object universal unique identifier (UUID) has already been registered.
Public Const RPC_S_ALREADY_REGISTERED = 1711&

'   The type universal unique identifier (UUID) has already been registered.
Public Const RPC_S_TYPE_ALREADY_REGISTERED = 1712&

'   The RPC server is already listening.
Public Const RPC_S_ALREADY_LISTENING = 1713&

'   No protocol sequences have been registered.
Public Const RPC_S_NO_PROTSEQS_REGISTERED = 1714&

'   The RPC server is not listening.
Public Const RPC_S_NOT_LISTENING = 1715&

'   The manager type is unknown.
Public Const RPC_S_UNKNOWN_MGR_TYPE = 1716&

'   The interface is unknown.
Public Const RPC_S_UNKNOWN_IF = 1717&

'   There are no bindings.
Public Const RPC_S_NO_BINDINGS = 1718&

'   There are no protocol sequences.
Public Const RPC_S_NO_PROTSEQS = 1719&

'   The endpoint cannot be created.
Public Const RPC_S_CANT_CREATE_ENDPOINT = 1720&

'   Not enough resources are available to complete this operation.
Public Const RPC_S_OUT_OF_RESOURCES = 1721&

'   The RPC server is unavailable.
Public Const RPC_S_SERVER_UNAVAILABLE = 1722&

'   The RPC server is too busy to complete this operation.
Public Const RPC_S_SERVER_TOO_BUSY = 1723&

'   The network options are invalid.
Public Const RPC_S_INVALID_NETWORK_OPTIONS = 1724&

'   There is not a remote procedure call active in this thread.
Public Const RPC_S_NO_CALL_ACTIVE = 1725&

'   The remote procedure call failed.
Public Const RPC_S_CALL_FAILED = 1726&

'   The remote procedure call failed and did not execute.
Public Const RPC_S_CALL_FAILED_DNE = 1727&

'   A remote procedure call (RPC) protocol error occurred.
Public Const RPC_S_PROTOCOL_ERROR = 1728&

'   The transfer syntax is not supported by the RPC server.
Public Const RPC_S_UNSUPPORTED_TRANS_SYN = 1730&

'   The universal unique identifier (UUID) type is not supported.
Public Const RPC_S_UNSUPPORTED_TYPE = 1732&

'   The tag is invalid.
Public Const RPC_S_INVALID_TAG = 1733&

'   The array bounds are invalid.
Public Const RPC_S_INVALID_BOUND = 1734&

'   The binding does not contain an entry name.
Public Const RPC_S_NO_ENTRY_NAME = 1735&

'   The name syntax is invalid.
Public Const RPC_S_INVALID_NAME_SYNTAX = 1736&

'   The name syntax is not supported.
Public Const RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737&

'   No network address is available to use to construct a universal
'   unique identifier (UUID).
Public Const RPC_S_UUID_NO_ADDRESS = 1739&

'   The endpoint is a duplicate.
Public Const RPC_S_DUPLICATE_ENDPOINT = 1740&

'   The authentication type is unknown.
Public Const RPC_S_UNKNOWN_AUTHN_TYPE = 1741&

'   The maximum number of calls is too small.
Public Const RPC_S_MAX_CALLS_TOO_SMALL = 1742&

'   The string is too long.
Public Const RPC_S_STRING_TOO_LONG = 1743&

'   The RPC protocol sequence was not found.
Public Const RPC_S_PROTSEQ_NOT_FOUND = 1744&

'   The procedure number is out of range.
Public Const RPC_S_PROCNUM_OUT_OF_RANGE = 1745&

'   The binding does not contain any authentication information.
Public Const RPC_S_BINDING_HAS_NO_AUTH = 1746&

'   The authentication service is unknown.
Public Const RPC_S_UNKNOWN_AUTHN_SERVICE = 1747&

'   The authentication level is unknown.
Public Const RPC_S_UNKNOWN_AUTHN_LEVEL = 1748&

'   The security context is invalid.
Public Const RPC_S_INVALID_AUTH_IDENTITY = 1749&

'   The authorization service is unknown.
Public Const RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750&

'   The entry is invalid.
Public Const EPT_S_INVALID_ENTRY = 1751&

'   The server endpoint cannot perform the operation.
Public Const EPT_S_CANT_PERFORM_OP = 1752&

'   There are no more endpoints available from the endpoint mapper.
Public Const EPT_S_NOT_REGISTERED = 1753&

'   No interfaces have been exported.
Public Const RPC_S_NOTHING_TO_EXPORT = 1754&

'   The entry name is incomplete.
Public Const RPC_S_INCOMPLETE_NAME = 1755&

'   The version option is invalid.
Public Const RPC_S_INVALID_VERS_OPTION = 1756&

'   There are no more members.
Public Const RPC_S_NO_MORE_MEMBERS = 1757&

'   There is nothing to unexport.
Public Const RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758&

'   The interface was not found.
Public Const RPC_S_INTERFACE_NOT_FOUND = 1759&

'   The entry already exists.
Public Const RPC_S_ENTRY_ALREADY_EXISTS = 1760&

'   The entry is not found.
Public Const RPC_S_ENTRY_NOT_FOUND = 1761&

'   The name service is unavailable.
Public Const RPC_S_NAME_SERVICE_UNAVAILABLE = 1762&

'   The network address family is invalid.
Public Const RPC_S_INVALID_NAF_ID = 1763&

'   The requested operation is not supported.
Public Const RPC_S_CANNOT_SUPPORT = 1764&

'   No security context is available to allow impersonation.
Public Const RPC_S_NO_CONTEXT_AVAILABLE = 1765&

'   An internal error occurred in a remote procedure call (RPC).
Public Const RPC_S_INTERNAL_ERROR = 1766&

'   The RPC server attempted an integer division by zero.'
Public Const RPC_S_ZERO_DIVIDE = 1767&

'   An addressing error occurred in the RPC server.
Public Const RPC_S_ADDRESS_ERROR = 1768&

'   A floating-point operation at the RPC server caused a division by zero.
Public Const RPC_S_FP_DIV_ZERO = 1769&

'   A floating-point underflow occurred at the RPC server.
Public Const RPC_S_FP_UNDERFLOW = 1770&

'   A floating-point overflow occurred at the RPC server.
Public Const RPC_S_FP_OVERFLOW = 1771&

'   The list of RPC servers available for the binding of auto handles
'   has been exhausted.
Public Const RPC_X_NO_MORE_ENTRIES = 1772&

'   Unable to open the character translation table file.
Public Const RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773&

'   The file containing the character translation table has fewer than
'   512 bytes.
Public Const RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774&

'   A null context handle was passed from the client to the host during
'   a remote procedure call.
Public Const RPC_X_SS_IN_NULL_CONTEXT = 1775&

'   The context handle changed during a remote procedure call.
Public Const RPC_X_SS_CONTEXT_DAMAGED = 1777&

'   The binding handles passed to a remote procedure call do not match.
Public Const RPC_X_SS_HANDLES_MISMATCH = 1778&

'   The stub is unable to get the remote procedure call handle.
Public Const RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779&

'   A null reference pointer was passed to the stub.
Public Const RPC_X_NULL_REF_POINTER = 1780&

'   The enumeration value is out of range.
Public Const RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781&

'   The byte count is too small.
Public Const RPC_X_BYTE_COUNT_TOO_SMALL = 1782&

'   The stub received bad data.
Public Const RPC_X_BAD_STUB_DATA = 1783&

'   The supplied user buffer is not valid for the requested operation.
Public Const ERROR_INVALID_USER_BUFFER = 1784&

'   The disk media is not recognized.  It may not be formatted.
Public Const ERROR_UNRECOGNIZED_MEDIA = 1785&

'   The workstation does not have a trust secret.
Public Const ERROR_NO_TRUST_LSA_SECRET = 1786&

'   The SAM database on the Windows NT Advanced Server does not have a computer
'   account for this workstation trust relationship.
Public Const ERROR_NO_TRUST_SAM_ACCOUNT = 1787&

'   The trust relationship between the primary domain and the trusted
'   domain failed.
Public Const ERROR_TRUSTED_DOMAIN_FAILURE = 1788&

'   The trust relationship between this workstation and the primary
'   domain failed.
Public Const ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789&

'   The network logon failed.
Public Const ERROR_TRUST_FAILURE = 1790&

'   A remote procedure call is already in progress for this thread.
Public Const RPC_S_CALL_IN_PROGRESS = 1791&

'   An attempt was made to logon, but the network logon service was not started.
Public Const ERROR_NETLOGON_NOT_STARTED = 1792&

'   The user's account has expired.
Public Const ERROR_ACCOUNT_EXPIRED = 1793&

'   The redirector is in use and cannot be unloaded.
Public Const ERROR_REDIRECTOR_HAS_OPEN_HANDLES = 1794&

'   The specified printer driver is already installed.
Public Const ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795&

'   The specified port is unknown.
Public Const ERROR_UNKNOWN_PORT = 1796&

'   The printer driver is unknown.
Public Const ERROR_UNKNOWN_PRINTER_DRIVER = 1797&

'   The print processor is unknown.
'
Public Const ERROR_UNKNOWN_PRINTPROCESSOR = 1798&

'   The specified separator file is invalid.
Public Const ERROR_INVALID_SEPARATOR_FILE = 1799&

'   The specified priority is invalid.
Public Const ERROR_INVALID_PRIORITY = 1800&

'   The printer name is invalid.
Public Const ERROR_INVALID_PRINTER_NAME = 1801&

'   The printer already exists.
Public Const ERROR_PRINTER_ALREADY_EXISTS = 1802&

'   The printer command is invalid.
Public Const ERROR_INVALID_PRINTER_COMMAND = 1803&

'   The specified datatype is invalid.
Public Const ERROR_INVALID_DATATYPE = 1804&

'   The Environment specified is invalid.
Public Const ERROR_INVALID_ENVIRONMENT = 1805&

'   There are no more bindings.
Public Const RPC_S_NO_MORE_BINDINGS = 1806&

'   The account used is an interdomain trust account.  Use your Global user account or local user account to access this server.
Public Const ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807&

'   The account used is a Computer Account.  Use your Global user account or local user account to access this server.
Public Const ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808&

'   The account used is an server trust account.  Use your Global user account or local user account to access this server.
Public Const ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809&

'   The name or security ID (SID) of the domain specified is inconsistent
'   with the trust information for that domain.
Public Const ERROR_DOMAIN_TRUST_INCONSISTENT = 1810&

'   The server is in use and cannot be unloaded.
Public Const ERROR_SERVER_HAS_OPEN_HANDLES = 1811&

'   The specified image file did not contain a resource section.
Public Const ERROR_RESOURCE_DATA_NOT_FOUND = 1812&

'   The specified resource type can not be found in the image file.
Public Const ERROR_RESOURCE_TYPE_NOT_FOUND = 1813&

'   The specified resource name can not be found in the image file.
Public Const ERROR_RESOURCE_NAME_NOT_FOUND = 1814&

'   The specified resource language ID cannot be found in the image file.
Public Const ERROR_RESOURCE_LANG_NOT_FOUND = 1815&

'   Not enough quota is available to process this command.
Public Const ERROR_NOT_ENOUGH_QUOTA = 1816&

'   The group member was not found.
Public Const RPC_S_GROUP_MEMBER_NOT_FOUND = 1898&

'   The endpoint mapper database could not be created.
Public Const EPT_S_CANT_CREATE = 1899&

'   The object universal unique identifier (UUID) is the nil UUID.
Public Const RPC_S_INVALID_OBJECT = 1900&

'   The specified time is invalid.
Public Const ERROR_INVALID_TIME = 1901&

'   The specified Form name is invalid.
Public Const ERROR_INVALID_FORM_NAME = 1902&

'   The specified Form size is invalid
Public Const ERROR_INVALID_FORM_SIZE = 1903&

'   The specified Printer handle is already being waited on
Public Const ERROR_ALREADY_WAITING = 1904&

'   The specified Printer has been deleted
Public Const ERROR_PRINTER_DELETED = 1905&

'   The state of the Printer is invalid
Public Const ERROR_INVALID_PRINTER_STATE = 1906&

'   The list of servers for this workgroup is not currently available
Public Const ERROR_NO_BROWSER_SERVERS_FOUND = 6118&


' -------------------------
'  MMSystem Section
' -------------------------

' This section defines all the support for Multimedia applications

'  general constants
Public Const MAXPNAMELEN = 32  '  max product name length (including NULL)
Public Const MAXERRORLENGTH = 128  '  max error text length (including final NULL)

Type smpte
        hour As Byte
        min As Byte
        sec As Byte
        frame As Byte
        fps As Byte
        dummy As Byte
        pad(2) As Byte
End Type

Type midi
        songptrpos As Long
End Type

Type MMTIME
        wType As Long
        u As Long
End Type

'  values for wType field in MMTIME struct
Public Const TIME_MS = &H1     '  time in Milliseconds
Public Const TIME_SAMPLES = &H2     '  number of wave samples
Public Const TIME_BYTES = &H4     '  current byte offset
Public Const TIME_SMPTE = &H8     '  SMPTE time
Public Const TIME_MIDI = &H10    '  MIDI time

'  Multimedia Window Messages
Public Const MM_JOY1MOVE = &H3A0  '  joystick
Public Const MM_JOY2MOVE = &H3A1
Public Const MM_JOY1ZMOVE = &H3A2
Public Const MM_JOY2ZMOVE = &H3A3
Public Const MM_JOY1BUTTONDOWN = &H3B5
Public Const MM_JOY2BUTTONDOWN = &H3B6
Public Const MM_JOY1BUTTONUP = &H3B7
Public Const MM_JOY2BUTTONUP = &H3B8

Public Const MM_MCINOTIFY = &H3B9  '  MCI
Public Const MM_MCISYSTEM_STRING = &H3CA

Public Const MM_WOM_OPEN = &H3BB  '  waveform output
Public Const MM_WOM_CLOSE = &H3BC
Public Const MM_WOM_DONE = &H3BD

Public Const MM_WIM_OPEN = &H3BE  '  waveform input
Public Const MM_WIM_CLOSE = &H3BF
Public Const MM_WIM_DATA = &H3C0

Public Const MM_MIM_OPEN = &H3C1  '  MIDI input
Public Const MM_MIM_CLOSE = &H3C2
Public Const MM_MIM_DATA = &H3C3
Public Const MM_MIM_LONGDATA = &H3C4
Public Const MM_MIM_ERROR = &H3C5
Public Const MM_MIM_LONGERROR = &H3C6

Public Const MM_MOM_OPEN = &H3C7  '  MIDI output
Public Const MM_MOM_CLOSE = &H3C8
Public Const MM_MOM_DONE = &H3C9

' String resource number bases (internal use)

Public Const MMSYSERR_BASE = 0
Public Const WAVERR_BASE = 32
Public Const MIDIERR_BASE = 64
Public Const TIMERR_BASE = 96   '  was 128, changed to match Win 31 Sonic
Public Const JOYERR_BASE = 160
Public Const MCIERR_BASE = 256

Public Const MCI_STRING_OFFSET = 512  '  if this number is changed you MUST
                                    '  alter the MCI_DEVTYPE_... list below
Public Const MCI_VD_OFFSET = 1024
Public Const MCI_CD_OFFSET = 1088
Public Const MCI_WAVE_OFFSET = 1152
Public Const MCI_SEQ_OFFSET = 1216

' General error return values
Public Const MMSYSERR_NOERROR = 0  '  no error
Public Const MMSYSERR_ERROR = (MMSYSERR_BASE + 1)  '  unspecified error
Public Const MMSYSERR_BADDEVICEID = (MMSYSERR_BASE + 2)  '  device ID out of range
Public Const MMSYSERR_NOTENABLED = (MMSYSERR_BASE + 3)  '  driver failed enable
Public Const MMSYSERR_ALLOCATED = (MMSYSERR_BASE + 4)  '  device already allocated
Public Const MMSYSERR_INVALHANDLE = (MMSYSERR_BASE + 5)  '  device handle is invalid
Public Const MMSYSERR_NODRIVER = (MMSYSERR_BASE + 6)  '  no device driver present
Public Const MMSYSERR_NOMEM = (MMSYSERR_BASE + 7)  '  memory allocation error
Public Const MMSYSERR_NOTSUPPORTED = (MMSYSERR_BASE + 8)  '  function isn't supported
Public Const MMSYSERR_BADERRNUM = (MMSYSERR_BASE + 9)  '  error value out of range
Public Const MMSYSERR_INVALFLAG = (MMSYSERR_BASE + 10) '  invalid flag passed
Public Const MMSYSERR_INVALPARAM = (MMSYSERR_BASE + 11) '  invalid parameter passed
Public Const MMSYSERR_HANDLEBUSY = (MMSYSERR_BASE + 12) '  handle being used
                                                   '  simultaneously on another
                                                   '  thread (eg callback)
Public Const MMSYSERR_INVALIDALIAS = (MMSYSERR_BASE + 13) '  "Specified alias not found in WIN.INI
Public Const MMSYSERR_LASTERROR = (MMSYSERR_BASE + 13) '  last error in range
Public Const MM_MOM_POSITIONCB = &H3CA              '  Callback for MEVT_POSITIONCB
Public Const MM_MCISIGNAL = &H3CB
Public Const MM_MIM_MOREDATA = &H3CC                '  MIM_DONE w/ pending events
Public Const MIDICAPS_STREAM = &H8               '  driver supports midiStreamOut directly


Type MIDIEVENT
        dwDeltaTime As Long          '  Ticks since last event
        dwStreamID As Long           '  Reserved; must be zero
        dwEvent As Long              '  Event type and parameters
        dwParms(1) As Long           '  Parameters if this is a long event
End Type

Type MIDISTRMBUFFVER
        dwVersion As Long                  '  Stream buffer format version
        dwMid As Long                      '  Manufacturer ID as defined in MMREG.H
        dwOEMVersion As Long               '  Manufacturer version for custom ext
End Type
#1034
' /////////////////////////
'                        //
'  Winnet32 Status Codes //
'                        //
' /////////////////////////

'   The specified username is invalid.
Public Const ERROR_BAD_USERNAME = 2202&

'   This network connection does not exist.
Public Const ERROR_NOT_CONNECTED = 2250&

'   This network connection has files open or requests pending.
Public Const ERROR_OPEN_FILES = 2401&

'   The device is in use by an active process and cannot be disconnected.
Public Const ERROR_DEVICE_IN_USE = 2404&

'   The specified device name is invalid.
Public Const ERROR_BAD_DEVICE = 1200&

'   The device is not currently connected but it is a remembered connection.
Public Const ERROR_CONNECTION_UNAVAIL = 1201&

'   An attempt was made to remember a device that had previously been remembered.
Public Const ERROR_DEVICE_ALREADY_REMEMBERED = 1202&

'   No network provider accepted the given network path.
Public Const ERROR_NO_NET_OR_BAD_PATH = 1203&

'   The specified network provider name is invalid.
Public Const ERROR_BAD_PROVIDER = 1204&

'   Unable to open the network connection profile.
Public Const ERROR_CANNOT_OPEN_PROFILE = 1205&

'   The network connection profile is corrupt.
Public Const ERROR_BAD_PROFILE = 1206&

'   Cannot enumerate a non-container.
Public Const ERROR_NOT_CONTAINER = 1207&

'   An extended error has occurred.
Public Const ERROR_EXTENDED_ERROR = 1208&

'   The format of the specified group name is invalid.
Public Const ERROR_INVALID_GROUPNAME = 1209&

'   The format of the specified computer name is invalid.
Public Const ERROR_INVALID_COMPUTERNAME = 1210&

'   The format of the specified event name is invalid.
Public Const ERROR_INVALID_EVENTNAME = 1211&

'   The format of the specified domain name is invalid.
Public Const ERROR_INVALID_DOMAINNAME = 1212&

'   The format of the specified service name is invalid.
Public Const ERROR_INVALID_SERVICENAME = 1213&

'   The format of the specified network name is invalid.
Public Const ERROR_INVALID_NETNAME = 1214&

'   The format of the specified share name is invalid.
Public Const ERROR_INVALID_SHARENAME = 1215&

'   The format of the specified password is invalid.
Public Const ERROR_INVALID_PASSWORDNAME = 1216&

'   The format of the specified message name is invalid.
Public Const ERROR_INVALID_MESSAGENAME = 1217&

'   The format of the specified message destination is invalid.
Public Const ERROR_INVALID_MESSAGEDEST = 1218&

'   The credentials supplied conflict with an existing set of credentials.
Public Const ERROR_SESSION_CREDENTIAL_CONFLICT = 1219&

'   An attempt was made to establish a session to a Lan Manager server, but there
'   are already too many sessions established to that server.
Public Const ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220&

'   The workgroup or domain name is already in use by another computer on the
'   network.
Public Const ERROR_DUP_DOMAINNAME = 1221&

'   The network is not present or not started.
Public Const ERROR_NO_NETWORK = 1222&


' /////////////////////////
'                        //
'  Security Status Codes //
'                        //
' /////////////////////////

'   Not all privileges referenced are assigned to the caller.
Public Const ERROR_NOT_ALL_ASSIGNED = 1300&

'   Some mapping between account names and security IDs was not done.
Public Const ERROR_SOME_NOT_MAPPED = 1301&

'   No system quota limits are specifically set for this account.
Public Const ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302&

'   No encryption key is available.  A well-known encryption key was returned.
Public Const ERROR_LOCAL_USER_SESSION_KEY = 1303&

'   The NT password is too complex to be converted to a LAN Manager
'   password.  The LAN Manager password returned is a NULL string.
Public Const ERROR_NULL_LM_PASSWORD = 1304&

'   The revision level is unknown.
Public Const ERROR_UNKNOWN_REVISION = 1305&

'   Indicates two revision levels are incompatible.
Public Const ERROR_REVISION_MISMATCH = 1306&

'   This security ID may not be assigned as the owner of this object.
Public Const ERROR_INVALID_OWNER = 1307&

'   This security ID may not be assigned as the primary group of an object.
Public Const ERROR_INVALID_PRIMARY_GROUP = 1308&

'   An attempt has been made to operate on an impersonation token
'   by a thread that is not currently impersonating a client.
Public Const ERROR_NO_IMPERSONATION_TOKEN = 1309&

'   The group may not be disabled.
Public Const ERROR_CANT_DISABLE_MANDATORY = 1310&

'   There are currently no logon servers available to service the logon
'   request.
Public Const ERROR_NO_LOGON_SERVERS = 1311&

'    A specified logon session does not exist.  It may already have
'    been terminated.
Public Const ERROR_NO_SUCH_LOGON_SESSION = 1312&

'    A specified privilege does not exist.
Public Const ERROR_NO_SUCH_PRIVILEGE = 1313&

'    A required privilege is not held by the client.
Public Const ERROR_PRIVILEGE_NOT_HELD = 1314&

'   The name provided is not a properly formed account name.
Public Const ERROR_INVALID_ACCOUNT_NAME = 1315&

'   The specified user already exists.
Public Const ERROR_USER_EXISTS = 1316&

'   The specified user does not exist.
Public Const ERROR_NO_SUCH_USER = 1317&

'   The specified group already exists.
Public Const ERROR_GROUP_EXISTS = 1318&

'   The specified group does not exist.
Public Const ERROR_NO_SUCH_GROUP = 1319&

'   Either the specified user account is already a member of the specified
'   group, or the specified group cannot be deleted because it contains
'   a member.
Public Const ERROR_MEMBER_IN_GROUP = 1320&

'   The specified user account is not a member of the specified group account.
Public Const ERROR_MEMBER_NOT_IN_GROUP = 1321&

'   The last remaining administration account cannot be disabled
'   or deleted.
Public Const ERROR_LAST_ADMIN = 1322&

'   Unable to update the password.  The value provided as the current
'   password is incorrect.
Public Const ERROR_WRONG_PASSWORD = 1323&

'   Unable to update the password.  The value provided for the new password
'   contains values that are not allowed in passwords.
Public Const ERROR_ILL_FORMED_PASSWORD = 1324&

'   Unable to update the password because a password update rule has been
'   violated.
Public Const ERROR_PASSWORD_RESTRICTION = 1325&

'   Logon failure: unknown user name or bad password.
Public Const ERROR_LOGON_FAILURE = 1326&

'   Logon failure: user account restriction.
Public Const ERROR_ACCOUNT_RESTRICTION = 1327&

'   Logon failure: account logon time restriction violation.
Public Const ERROR_INVALID_LOGON_HOURS = 1328&

'   Logon failure: user not allowed to log on to this computer.
Public Const ERROR_INVALID_WORKSTATION = 1329&

'   Logon failure: the specified account password has expired.
Public Const ERROR_PASSWORD_EXPIRED = 1330&

'   Logon failure: account currently disabled.
Public Const ERROR_ACCOUNT_DISABLED = 1331&

'   No mapping between account names and security IDs was done.
Public Const ERROR_NONE_MAPPED = 1332&

'   Too many local user identifiers (LUIDs) were requested at one time.
Public Const ERROR_TOO_MANY_LUIDS_REQUESTED = 1333&

'   No more local user identifiers (LUIDs) are available.
Public Const ERROR_LUIDS_EXHAUSTED = 1334&

'   The subauthority part of a security ID is invalid for this particular use.
Public Const ERROR_INVALID_SUB_AUTHORITY = 1335&

'   The access control list (ACL) structure is invalid.
Public Const ERROR_INVALID_ACL = 1336&

'   The security ID structure is invalid.
Public Const ERROR_INVALID_SID = 1337&

'   The security descriptor structure is invalid.
Public Const ERROR_INVALID_SECURITY_DESCR = 1338&

'   The inherited access control list (ACL) or access control entry (ACE)
'   could not be built.
Public Const ERROR_BAD_INHERITANCE_ACL = 1340&

'   The server is currently disabled.
Public Const ERROR_SERVER_DISABLED = 1341&

'   The server is currently enabled.
Public Const ERROR_SERVER_NOT_DISABLED = 1342&

'   The value provided was an invalid value for an identifier authority.
Public Const ERROR_INVALID_ID_AUTHORITY = 1343&

'   No more memory is available for security information updates.
Public Const ERROR_ALLOTTED_SPACE_EXCEEDED = 1344&

'   The specified attributes are invalid, or incompatible with the
'   attributes for the group as a whole.
Public Const ERROR_INVALID_GROUP_ATTRIBUTES = 1345&

'   Either a required impersonation level was not provided, or the
'   provided impersonation level is invalid.
Public Const ERROR_BAD_IMPERSONATION_LEVEL = 1346&

'   Cannot open an anonymous level security token.
Public Const ERROR_CANT_OPEN_ANONYMOUS = 1347&

'   The validation information class requested was invalid.
Public Const ERROR_BAD_VALIDATION_CLASS = 1348&

'   The type of the token is inappropriate for its attempted use.
Public Const ERROR_BAD_TOKEN_TYPE = 1349&

'   Unable to perform a security operation on an object
'   which has no associated security.
Public Const ERROR_NO_SECURITY_ON_OBJECT = 1350&

'   Indicates a Windows NT Advanced Server could not be contacted or that
'   objects within the domain are protected such that necessary
'   information could not be retrieved.
Public Const ERROR_CANT_ACCESS_DOMAIN_INFO = 1351&

'   The security account manager (SAM) or local security
'   authority (LSA) server was in the wrong state to perform
'   the security operation.
Public Const ERROR_INVALID_SERVER_STATE = 1352&

'   The domain was in the wrong state to perform the security operation.
Public Const ERROR_INVALID_DOMAIN_STATE = 1353&

'   This operation is only allowed for the Primary Domain Controller of the domain.
Public Const ERROR_INVALID_DOMAIN_ROLE = 1354&

'   The specified domain did not exist.
Public Const ERROR_NO_SUCH_DOMAIN = 1355&

'   The specified domain already exists.
Public Const ERROR_DOMAIN_EXISTS = 1356&

'   An attempt was made to exceed the limit on the number of domains per server.
Public Const ERROR_DOMAIN_LIMIT_EXCEEDED = 1357&

'   Unable to complete the requested operation because of either a
'   catastrophic media failure or a data structure corruption on the disk.
Public Const ERROR_INTERNAL_DB_CORRUPTION = 1358&

'   The security account database contains an internal inconsistency.
Public Const ERROR_INTERNAL_ERROR = 1359&

'   Generic access types were contained in an access mask which should
'   already be mapped to non-generic types.
Public Const ERROR_GENERIC_NOT_MAPPED = 1360&

'   A security descriptor is not in the right format (absolute or self-relative).
Public Const ERROR_BAD_DESCRIPTOR_FORMAT = 1361&

'   The requested action is restricted for use by logon processes
'   only.  The calling process has not registered as a logon process.
Public Const ERROR_NOT_LOGON_PROCESS = 1362&

'   Cannot start a new logon session with an ID that is already in use.
Public Const ERROR_LOGON_SESSION_EXISTS = 1363&

'   A specified authentication package is unknown.
Public Const ERROR_NO_SUCH_PACKAGE = 1364&

'   The logon session is not in a state that is consistent with the
'   requested operation.
Public Const ERROR_BAD_LOGON_SESSION_STATE = 1365&

'   The logon session ID is already in use.
Public Const ERROR_LOGON_SESSION_COLLISION = 1366&

'   A logon request contained an invalid logon type value.
Public Const ERROR_INVALID_LOGON_TYPE = 1367&

'   Unable to impersonate via a named pipe until data has been read
'   from that pipe.
Public Const ERROR_CANNOT_IMPERSONATE = 1368&

'   The transaction state of a Registry subtree is incompatible with the
'   requested operation.
Public Const ERROR_RXACT_INVALID_STATE = 1369&

'   An internal security database corruption has been encountered.
Public Const ERROR_RXACT_COMMIT_FAILURE = 1370&

'   Cannot perform this operation on built-in accounts.
Public Const ERROR_SPECIAL_ACCOUNT = 1371&

'   Cannot perform this operation on this built-in special group.
Public Const ERROR_SPECIAL_GROUP = 1372&

'   Cannot perform this operation on this built-in special user.
Public Const ERROR_SPECIAL_USER = 1373&

'   The user cannot be removed from a group because the group
'   is currently the user's primary group.
Public Const ERROR_MEMBERS_PRIMARY_GROUP = 1374&

'   The token is already in use as a primary token.
Public Const ERROR_TOKEN_ALREADY_IN_USE = 1375&

'   The specified local group does not exist.
Public Const ERROR_NO_SUCH_ALIAS = 1376&

'   The specified account name is not a member of the local group.
Public Const ERROR_MEMBER_NOT_IN_ALIAS = 1377&

'   The specified account name is already a member of the local group.
Public Const ERROR_MEMBER_IN_ALIAS = 1378&

'   The specified local group already exists.
Public Const ERROR_ALIAS_EXISTS = 1379&

'   Logon failure: the user has not been granted the requested
'   logon type at this computer.
Public Const ERROR_LOGON_NOT_GRANTED = 1380&

'   The maximum number of secrets that may be stored in a single system has been
'   exceeded.
Public Const ERROR_TOO_MANY_SECRETS = 1381&

'   The length of a secret exceeds the maximum length allowed.
Public Const ERROR_SECRET_TOO_LONG = 1382&

'   The local security authority database contains an internal inconsistency.
Public Const ERROR_INTERNAL_DB_ERROR = 1383&

'   During a logon attempt, the user's security context accumulated too many
'   security IDs.
Public Const ERROR_TOO_MANY_CONTEXT_IDS = 1384&

'   Logon failure: the user has not been granted the requested logon type
'   at this computer.
Public Const ERROR_LOGON_TYPE_NOT_GRANTED = 1385&

'   A cross-encrypted password is necessary to change a user password.
Public Const ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386&

'   A new member could not be added to a local group because the member does
'   not exist.
Public Const ERROR_NO_SUCH_MEMBER = 1387&

'   A new member could not be added to a local group because the member has the
'   wrong account type.
Public Const ERROR_INVALID_MEMBER = 1388&

'   Too many security IDs have been specified.
Public Const ERROR_TOO_MANY_SIDS = 1389&

'   A cross-encrypted password is necessary to change this user password.
Public Const ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390&

'   Indicates an ACL contains no inheritable components
Public Const ERROR_NO_INHERITANCE = 1391&

'   The file or directory is corrupt and non-readable.
Public Const ERROR_FILE_CORRUPT = 1392&

'   The disk structure is corrupt and non-readable.
Public Const ERROR_DISK_CORRUPT = 1393&

'   There is no user session key for the specified logon session.
Public Const ERROR_NO_USER_SESSION_KEY = 1394&

'  End of security error codes


' /////////////////////////
'                        //
'  WinUser Error Codes   //
'                        //
' /////////////////////////

'   Invalid window handle.
Public Const ERROR_INVALID_WINDOW_HANDLE = 1400&

'   Invalid menu handle.
Public Const ERROR_INVALID_MENU_HANDLE = 1401&

'   Invalid cursor handle.
Public Const ERROR_INVALID_CURSOR_HANDLE = 1402&

'   Invalid accelerator table handle.
Public Const ERROR_INVALID_ACCEL_HANDLE = 1403&

'   Invalid hook handle.
Public Const ERROR_INVALID_HOOK_HANDLE = 1404&

'   Invalid handle to a multiple-window position structure.
Public Const ERROR_INVALID_DWP_HANDLE = 1405&

'   Cannot create a top-level child window.
Public Const ERROR_TLW_WITH_WSCHILD = 1406&

'   Cannot find window class.
Public Const ERROR_CANNOT_FIND_WND_CLASS = 1407&

'   Invalid window, belongs to other thread.
Public Const ERROR_WINDOW_OF_OTHER_THREAD = 1408&

'   Hot key is already registered.
Public Const ERROR_HOTKEY_ALREADY_REGISTERED = 1409&

'   Class already exists.
Public Const ERROR_CLASS_ALREADY_EXISTS = 1410&

'   Class does not exist.
Public Const ERROR_CLASS_DOES_NOT_EXIST = 1411&

'   Class still has open windows.
Public Const ERROR_CLASS_HAS_WINDOWS = 1412&

'   Invalid index.
Public Const ERROR_INVALID_INDEX = 1413&

'   Invalid icon handle.
Public Const ERROR_INVALID_ICON_HANDLE = 1414&

'   Using private DIALOG window words.
Public Const ERROR_PRIVATE_DIALOG_INDEX = 1415&

'   The listbox identifier was not found.
Public Const ERROR_LISTBOX_ID_NOT_FOUND = 1416&

'   No wildcards were found.
Public Const ERROR_NO_WILDCARD_CHARACTERS = 1417&

'   Thread does not have a clipboard open.
Public Const ERROR_CLIPBOARD_NOT_OPEN = 1418&

'   Hot key is not registered.
Public Const ERROR_HOTKEY_NOT_REGISTERED = 1419&

'   The window is not a valid dialog window.
Public Const ERROR_WINDOW_NOT_DIALOG = 1420&

'   Control ID not found.
Public Const ERROR_CONTROL_ID_NOT_FOUND = 1421&

'   Invalid message for a combo box because it does not have an edit control.
Public Const ERROR_INVALID_COMBOBOX_MESSAGE = 1422&

'   The window is not a combo box.
Public Const ERROR_WINDOW_NOT_COMBOBOX = 1423&

'   Height must be less than 256.
Public Const ERROR_INVALID_EDIT_HEIGHT = 1424&

'   Invalid device context (DC) handle.
Public Const ERROR_DC_NOT_FOUND = 1425&

'   Invalid hook procedure type.
Public Const ERROR_INVALID_HOOK_FILTER = 1426&

'   Invalid hook procedure.
Public Const ERROR_INVALID_FILTER_PROC = 1427&

'   Cannot set non-local hook without a module handle.
Public Const ERROR_HOOK_NEEDS_HMOD = 1428&

'   This hook procedure can only be set Globally.
'
Public Const ERROR_PUBLIC_ONLY_HOOK = 1429&

'   The journal hook procedure is already installed.
Public Const ERROR_JOURNAL_HOOK_SET = 1430&

'   The hook procedure is not installed.
Public Const ERROR_HOOK_NOT_INSTALLED = 1431&

'   Invalid message for single-selection listbox.
Public Const ERROR_INVALID_LB_MESSAGE = 1432&

'   LB_SETCOUNT sent to non-lazy listbox.
Public Const ERROR_SETCOUNT_ON_BAD_LB = 1433&

'   This list box does not support tab stops.
Public Const ERROR_LB_WITHOUT_TABSTOPS = 1434&

'   Cannot destroy object created by another thread.
Public Const ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435&

'   Child windows cannot have menus.
Public Const ERROR_CHILD_WINDOW_MENU = 1436&

'   The window does not have a system menu.
Public Const ERROR_NO_SYSTEM_MENU = 1437&

'   Invalid message box style.
Public Const ERROR_INVALID_MSGBOX_STYLE = 1438&

'   Invalid system-wide (SPI_) parameter.
Public Const ERROR_INVALID_SPI_VALUE = 1439&

'   Screen already locked.
Public Const ERROR_SCREEN_ALREADY_LOCKED = 1440&

'   All handles to windows in a multiple-window position structure must
'   have the same parent.
Public Const ERROR_HWNDS_HAVE_DIFF_PARENT = 1441&

'   The window is not a child window.
Public Const ERROR_NOT_CHILD_WINDOW = 1442&

'   Invalid GW_ command.
Public Const ERROR_INVALID_GW_COMMAND = 1443&

'   Invalid thread identifier.
Public Const ERROR_INVALID_THREAD_ID = 1444&

'   Cannot process a message from a window that is not a multiple document
'   interface (MDI) window.
Public Const ERROR_NON_MDICHILD_WINDOW = 1445&

'   Popup menu already active.
Public Const ERROR_POPUP_ALREADY_ACTIVE = 1446&

'   The window does not have scroll bars.
Public Const ERROR_NO_SCROLLBARS = 1447&

'   Scroll bar range cannot be greater than 0x7FFF.
Public Const ERROR_INVALID_SCROLLBAR_RANGE = 1448&

'   Cannot show or remove the window in the way specified.
Public Const ERROR_INVALID_SHOWWIN_COMMAND = 1449&

'  End of WinUser error codes


' /////////////////////////
'                        //
'  Eventlog Status Codes //
'                        //
' /////////////////////////

'   The event log file is corrupt.
Public Const ERROR_EVENTLOG_FILE_CORRUPT = 1500&

'   No event log file could be opened, so the event logging service did not start.
Public Const ERROR_EVENTLOG_CANT_START = 1501&

'   The event log file is full.
Public Const ERROR_LOG_FILE_FULL = 1502&

'   The event log file has changed between reads.
Public Const ERROR_EVENTLOG_FILE_CHANGED = 1503&

'  End of eventlog error codes
#1035

'   The I/O operation has been aborted because of either a thread exit
'   or an application request.
Public Const ERROR_OPERATION_ABORTED = 995&

'   Overlapped I/O event is not in a signalled state.
Public Const ERROR_IO_INCOMPLETE = 996&

'   Overlapped I/O operation is in progress.
Public Const ERROR_IO_PENDING = 997 '  dderror

'   Invalid access to memory location.
Public Const ERROR_NOACCESS = 998&

'   Error performing inpage operation.
Public Const ERROR_SWAPERROR = 999&

'   Recursion too deep, stack overflowed.
Public Const ERROR_STACK_OVERFLOW = 1001&

'   The window cannot act on the sent message.
Public Const ERROR_INVALID_MESSAGE = 1002&

'   Cannot complete this function.
Public Const ERROR_CAN_NOT_COMPLETE = 1003&

'   Invalid flags.
Public Const ERROR_INVALID_FLAGS = 1004&

'   The volume does not contain a recognized file system.
'   Please make sure that all required file system drivers are loaded and that the
'   volume is not corrupt.
Public Const ERROR_UNRECOGNIZED_VOLUME = 1005&

'   The volume for a file has been externally altered such that the
'   opened file is no longer valid.
Public Const ERROR_FILE_INVALID = 1006&

'   The requested operation cannot be performed in full-screen mode.
Public Const ERROR_FULLSCREEN_MODE = 1007&

'   An attempt was made to reference a token that does not exist.
Public Const ERROR_NO_TOKEN = 1008&

'   The configuration registry database is corrupt.
Public Const ERROR_BADDB = 1009&

'   The configuration registry key is invalid.
Public Const ERROR_BADKEY = 1010&

'   The configuration registry key could not be opened.
Public Const ERROR_CANTOPEN = 1011&

'   The configuration registry key could not be read.
Public Const ERROR_CANTREAD = 1012&

'   The configuration registry key could not be written.
Public Const ERROR_CANTWRITE = 1013&

'   One of the files in the Registry database had to be recovered
'   by use of a log or alternate copy.  The recovery was successful.
Public Const ERROR_REGISTRY_RECOVERED = 1014&

'   The Registry is corrupt. The structure of one of the files that contains
'   Registry data is corrupt, or the system's image of the file in memory
'   is corrupt, or the file could not be recovered because the alternate
'   copy or log was absent or corrupt.
Public Const ERROR_REGISTRY_CORRUPT = 1015&

'   An I/O operation initiated by the Registry failed unrecoverably.
'   The Registry could not read in, or write out, or flush, one of the files
'   that contain the system's image of the Registry.
Public Const ERROR_REGISTRY_IO_FAILED = 1016&

'   The system has attempted to load or restore a file into the Registry, but the
'   specified file is not in a Registry file format.
Public Const ERROR_NOT_REGISTRY_FILE = 1017&

'   Illegal operation attempted on a Registry key which has been marked for deletion.
Public Const ERROR_KEY_DELETED = 1018&

'   System could not allocate the required space in a Registry log.
Public Const ERROR_NO_LOG_SPACE = 1019&

'   Cannot create a symbolic link in a Registry key that already
'   has subkeys or values.
Public Const ERROR_KEY_HAS_CHILDREN = 1020&

'   Cannot create a stable subkey under a volatile parent key.
Public Const ERROR_CHILD_MUST_BE_VOLATILE = 1021&

'   A notify change request is being completed and the information
'   is not being returned in the caller's buffer. The caller now
'   needs to enumerate the files to find the changes.
Public Const ERROR_NOTIFY_ENUM_DIR = 1022&

'   A stop control has been sent to a service which other running services
'   are dependent on.
Public Const ERROR_DEPENDENT_SERVICES_RUNNING = 1051&

'   The requested control is not valid for this service
Public Const ERROR_INVALID_SERVICE_CONTROL = 1052&

'   The service did not respond to the start or control request in a timely
'   fashion.
Public Const ERROR_SERVICE_REQUEST_TIMEOUT = 1053&

'   A thread could not be created for the service.
Public Const ERROR_SERVICE_NO_THREAD = 1054&

'   The service database is locked.
Public Const ERROR_SERVICE_DATABASE_LOCKED = 1055&

'   An instance of the service is already running.
Public Const ERROR_SERVICE_ALREADY_RUNNING = 1056&

'   The account name is invalid or does not exist.
Public Const ERROR_INVALID_SERVICE_ACCOUNT = 1057&

'   The specified service is disabled and cannot be started.
Public Const ERROR_SERVICE_DISABLED = 1058&

'   Circular service dependency was specified.
Public Const ERROR_CIRCULAR_DEPENDENCY = 1059&

'   The specified service does not exist as an installed service.
Public Const ERROR_SERVICE_DOES_NOT_EXIST = 1060&

'   The service cannot accept control messages at this time.
Public Const ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061&

'   The service has not been started.
Public Const ERROR_SERVICE_NOT_ACTIVE = 1062&

'   The service process could not connect to the service controller.
Public Const ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063&

'   An exception occurred in the service when handling the control request.
Public Const ERROR_EXCEPTION_IN_SERVICE = 1064&

'   The database specified does not exist.
Public Const ERROR_DATABASE_DOES_NOT_EXIST = 1065&

'   The service has returned a service-specific error code.
Public Const ERROR_SERVICE_SPECIFIC_ERROR = 1066&

'   The process terminated unexpectedly.
Public Const ERROR_PROCESS_ABORTED = 1067&

'   The dependency service or group failed to start.
Public Const ERROR_SERVICE_DEPENDENCY_FAIL = 1068&

'   The service did not start due to a logon failure.
Public Const ERROR_SERVICE_LOGON_FAILED = 1069&

'   After starting, the service hung in a start-pending state.
Public Const ERROR_SERVICE_START_HANG = 1070&

'   The specified service database lock is invalid.
Public Const ERROR_INVALID_SERVICE_LOCK = 1071&

'   The specified service has been marked for deletion.
Public Const ERROR_SERVICE_MARKED_FOR_DELETE = 1072&

'   The specified service already exists.
Public Const ERROR_SERVICE_EXISTS = 1073&

'   The system is currently running with the last-known-good configuration.
Public Const ERROR_ALREADY_RUNNING_LKG = 1074&

'   The dependency service does not exist or has been marked for
'   deletion.
Public Const ERROR_SERVICE_DEPENDENCY_DELETED = 1075&

'   The current boot has already been accepted for use as the
'   last-known-good control set.
Public Const ERROR_BOOT_ALREADY_ACCEPTED = 1076&

'   No attempts to start the service have been made since the last boot.
Public Const ERROR_SERVICE_NEVER_STARTED = 1077&

'   The name is already in use as either a service name or a service display
'   name.
Public Const ERROR_DUPLICATE_SERVICE_NAME = 1078&

'   The physical end of the tape has been reached.
Public Const ERROR_END_OF_MEDIA = 1100&

'   A tape access reached a filemark.
Public Const ERROR_FILEMARK_DETECTED = 1101&

'   Beginning of tape or partition was encountered.
Public Const ERROR_BEGINNING_OF_MEDIA = 1102&

'   A tape access reached the end of a set of files.
Public Const ERROR_SETMARK_DETECTED = 1103&

'   No more data is on the tape.
Public Const ERROR_NO_DATA_DETECTED = 1104&

'   Tape could not be partitioned.
Public Const ERROR_PARTITION_FAILURE = 1105&

'   When accessing a new tape of a multivolume partition, the current
'   blocksize is incorrect.
Public Const ERROR_INVALID_BLOCK_LENGTH = 1106&

'   Tape partition information could not be found when loading a tape.
Public Const ERROR_DEVICE_NOT_PARTITIONED = 1107&

'   Unable to lock the media eject mechanism.
Public Const ERROR_UNABLE_TO_LOCK_MEDIA = 1108&

'   Unable to unload the media.
Public Const ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109&

'   Media in drive may have changed.
Public Const ERROR_MEDIA_CHANGED = 1110&

'   The I/O bus was reset.
Public Const ERROR_BUS_RESET = 1111&

'   No media in drive.
Public Const ERROR_NO_MEDIA_IN_DRIVE = 1112&

'   No mapping for the Unicode character exists in the target multi-byte code page.
Public Const ERROR_NO_UNICODE_TRANSLATION = 1113&

'   A dynamic link library (DLL) initialization routine failed.
Public Const ERROR_DLL_INIT_FAILED = 1114&

'   A system shutdown is in progress.
Public Const ERROR_SHUTDOWN_IN_PROGRESS = 1115&

'   Unable to abort the system shutdown because no shutdown was in progress.
Public Const ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116&

'   The request could not be performed because of an I/O device error.
Public Const ERROR_IO_DEVICE = 1117&

'   No serial device was successfully initialized.  The serial driver will unload.
Public Const ERROR_SERIAL_NO_DEVICE = 1118&

'   Unable to open a device that was sharing an interrupt request (IRQ)
'   with other devices. At least one other device that uses that IRQ
'   was already opened.
Public Const ERROR_IRQ_BUSY = 1119&

'   A serial I/O operation was completed by another write to the serial port.
'   (The IOCTL_SERIAL_XOFF_COUNTER reached zero.)
Public Const ERROR_MORE_WRITES = 1120&

'   A serial I/O operation completed because the time-out period expired.
'   (The IOCTL_SERIAL_XOFF_COUNTER did not reach zero.)
Public Const ERROR_COUNTER_TIMEOUT = 1121&

'   No ID address mark was found on the floppy disk.
Public Const ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122&

'   Mismatch between the floppy disk sector ID field and the floppy disk
'   controller track address.
Public Const ERROR_FLOPPY_WRONG_CYLINDER = 1123&

'   The floppy disk controller reported an error that is not recognized
'   by the floppy disk driver.
Public Const ERROR_FLOPPY_UNKNOWN_ERROR = 1124&

'   The floppy disk controller returned inconsistent results in its registers.
Public Const ERROR_FLOPPY_BAD_REGISTERS = 1125&

'   While accessing the hard disk, a recalibrate operation failed, even after retries.
Public Const ERROR_DISK_RECALIBRATE_FAILED = 1126&

'   While accessing the hard disk, a disk operation failed even after retries.
Public Const ERROR_DISK_OPERATION_FAILED = 1127&

'   While accessing the hard disk, a disk controller reset was needed, but
'   even that failed.
Public Const ERROR_DISK_RESET_FAILED = 1128&

'   Physical end of tape encountered.
Public Const ERROR_EOM_OVERFLOW = 1129&

'   Not enough server storage is available to process this command.
Public Const ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130&

'   A potential deadlock condition has been detected.
Public Const ERROR_POSSIBLE_DEADLOCK = 1131&

'   The base address or the file offset specified does not have the proper
'   alignment.
Public Const ERROR_MAPPED_ALIGNMENT = 1132&

' NEW for Win32
Public Const ERROR_INVALID_PIXEL_FORMAT = 2000
Public Const ERROR_BAD_DRIVER = 2001
Public Const ERROR_INVALID_WINDOW_STYLE = 2002
Public Const ERROR_METAFILE_NOT_SUPPORTED = 2003
Public Const ERROR_TRANSFORM_NOT_SUPPORTED = 2004
Public Const ERROR_CLIPPING_NOT_SUPPORTED = 2005
Public Const ERROR_UNKNOWN_PRINT_MONITOR = 3000
Public Const ERROR_PRINTER_DRIVER_IN_USE = 3001
Public Const ERROR_SPOOL_FILE_NOT_FOUND = 3002
Public Const ERROR_SPL_NO_STARTDOC = 3003
Public Const ERROR_SPL_NO_ADDJOB = 3004
Public Const ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005
Public Const ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006
Public Const ERROR_WINS_INTERNAL = 4000
Public Const ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001
Public Const ERROR_STATIC_INIT = 4002
Public Const ERROR_INC_BACKUP = 4003
Public Const ERROR_FULL_BACKUP = 4004
Public Const ERROR_REC_NON_EXISTENT = 4005
Public Const ERROR_RPL_NOT_ALLOWED = 4006
Public Const SEVERITY_SUCCESS = 0
Public Const SEVERITY_ERROR = 1
Public Const FACILITY_NT_BIT = &H10000000
Public Const NOERROR = 0
Public Const E_UNEXPECTED = &H8000FFFF
Public Const E_NOTIMPL = &H80004001
Public Const E_OUTOFMEMORY = &H8007000E
Public Const E_INVALIDARG = &H80070057
Public Const E_NOINTERFACE = &H80004002
Public Const E_POINTER = &H80004003
Public Const E_HANDLE = &H80070006
Public Const E_ABORT = &H80004004
Public Const E_FAIL = &H80004005
Public Const E_ACCESSDENIED = &H80070005
Public Const CO_E_INIT_TLS = &H80004006
Public Const CO_E_INIT_SHARED_ALLOCATOR = &H80004007
Public Const CO_E_INIT_MEMORY_ALLOCATOR = &H80004008
Public Const CO_E_INIT_CLASS_CACHE = &H80004009
Public Const CO_E_INIT_RPC_CHANNEL = &H8000400A
Public Const CO_E_INIT_TLS_SET_CHANNEL_CONTROL = &H8000400B
Public Const CO_E_INIT_TLS_CHANNEL_CONTROL = &H8000400C
Public Const CO_E_INIT_UNACCEPTED_USER_ALLOCATOR = &H8000400D
Public Const CO_E_INIT_SCM_MUTEX_EXISTS = &H8000400E
Public Const CO_E_INIT_SCM_FILE_MAPPING_EXISTS = &H8000400F
Public Const CO_E_INIT_SCM_MAP_VIEW_OF_FILE = &H80004010
Public Const CO_E_INIT_SCM_EXEC_FAILURE = &H80004011
Public Const CO_E_INIT_ONLY_SINGLE_THREADED = &H80004012
Public Const S_OK = &H0
Public Const S_FALSE = &H1
Public Const OLE_E_FIRST = &H80040000
Public Const OLE_E_LAST = &H800400FF
Public Const OLE_S_FIRST = &H40000
Public Const OLE_S_LAST = &H400FF
Public Const OLE_E_OLEVERB = &H80040000
Public Const OLE_E_ADVF = &H80040001
Public Const OLE_E_ENUM_NOMORE = &H80040002
Public Const OLE_E_ADVISENOTSUPPORTED = &H80040003
Public Const OLE_E_NOCONNECTION = &H80040004
Public Const OLE_E_NOTRUNNING = &H80040005
Public Const OLE_E_NOCACHE = &H80040006
Public Const OLE_E_BLANK = &H80040007
Public Const OLE_E_CLASSDIFF = &H80040008
Public Const OLE_E_CANT_GETMONIKER = &H80040009
Public Const OLE_E_CANT_BINDTOSOURCE = &H8004000A
Public Const OLE_E_STATIC = &H8004000B
Public Const OLE_E_PROMPTSAVECANCELLED = &H8004000C
Public Const OLE_E_INVALIDRECT = &H8004000D
Public Const OLE_E_WRONGCOMPOBJ = &H8004000E
Public Const OLE_E_INVALIDHWND = &H8004000F
Public Const OLE_E_NOT_INPLACEACTIVE = &H80040010
Public Const OLE_E_CANTCONVERT = &H80040011
Public Const OLE_E_NOSTORAGE = &H80040012
Public Const DV_E_FORMATETC = &H80040064
Public Const DV_E_DVTARGETDEVICE = &H80040065
Public Const DV_E_STGMEDIUM = &H80040066
Public Const DV_E_STATDATA = &H80040067
Public Const DV_E_LINDEX = &H80040068
Public Const DV_E_TYMED = &H80040069
Public Const DV_E_CLIPFORMAT = &H8004006A
Public Const DV_E_DVASPECT = &H8004006B
Public Const DV_E_DVTARGETDEVICE_SIZE = &H8004006C
Public Const DV_E_NOIVIEWOBJECT = &H8004006D
Public Const DRAGDROP_E_FIRST = &H80040100
Public Const DRAGDROP_E_LAST = &H8004010F
Public Const DRAGDROP_S_FIRST = &H40100
Public Const DRAGDROP_S_LAST = &H4010F
Public Const DRAGDROP_E_NOTREGISTERED = &H80040100
Public Const DRAGDROP_E_ALREADYREGISTERED = &H80040101
Public Const DRAGDROP_E_INVALIDHWND = &H80040102
Public Const CLASSFACTORY_E_FIRST = &H80040110
Public Const CLASSFACTORY_E_LAST = &H8004011F
Public Const CLASSFACTORY_S_FIRST = &H40110
Public Const CLASSFACTORY_S_LAST = &H4011F
Public Const CLASS_E_NOAGGREGATION = &H80040110
Public Const CLASS_E_CLASSNOTAVAILABLE = &H80040111
Public Const MARSHAL_E_FIRST = &H80040120
Public Const MARSHAL_E_LAST = &H8004012F
Public Const MARSHAL_S_FIRST = &H40120
Public Const MARSHAL_S_LAST = &H4012F
Public Const DATA_E_FIRST = &H80040130
Public Const DATA_E_LAST = &H8004013F
Public Const DATA_S_FIRST = &H40130
Public Const DATA_S_LAST = &H4013F
Public Const VIEW_E_FIRST = &H80040140
Public Const VIEW_E_LAST = &H8004014F
Public Const VIEW_S_FIRST = &H40140
Public Const VIEW_S_LAST = &H4014F
Public Const VIEW_E_DRAW = &H80040140
Public Const REGDB_E_FIRST = &H80040150
Public Const REGDB_E_LAST = &H8004015F
Public Const REGDB_S_FIRST = &H40150
Public Const REGDB_S_LAST = &H4015F
Public Const REGDB_E_READREGDB = &H80040150
Public Const REGDB_E_WRITEREGDB = &H80040151
Public Const REGDB_E_KEYMISSING = &H80040152
Public Const REGDB_E_INVALIDVALUE = &H80040153
Public Const REGDB_E_CLASSNOTREG = &H80040154
Public Const REGDB_E_IIDNOTREG = &H80040155
Public Const CACHE_E_FIRST = &H80040170
Public Const CACHE_E_LAST = &H8004017F
Public Const CACHE_S_FIRST = &H40170
Public Const CACHE_S_LAST = &H4017F
Public Const CACHE_E_NOCACHE_UPDATED = &H80040170
Public Const OLEOBJ_E_FIRST = &H80040180
Public Const OLEOBJ_E_LAST = &H8004018F
Public Const OLEOBJ_S_FIRST = &H40180
Public Const OLEOBJ_S_LAST = &H4018F
Public Const OLEOBJ_E_NOVERBS = &H80040180
Public Const OLEOBJ_E_INVALIDVERB = &H80040181
Public Const CLIENTSITE_E_FIRST = &H80040190
Public Const CLIENTSITE_E_LAST = &H8004019F
Public Const CLIENTSITE_S_FIRST = &H40190
Public Const CLIENTSITE_S_LAST = &H4019F
Public Const INPLACE_E_NOTUNDOABLE = &H800401A0
Public Const INPLACE_E_NOTOOLSPACE = &H800401A1
Public Const INPLACE_E_FIRST = &H800401A0
Public Const INPLACE_E_LAST = &H800401AF
Public Const INPLACE_S_FIRST = &H401A0
Public Const INPLACE_S_LAST = &H401AF
Public Const ENUM_E_FIRST = &H800401B0
Public Const ENUM_E_LAST = &H800401BF
Public Const ENUM_S_FIRST = &H401B0
Public Const ENUM_S_LAST = &H401BF
Public Const CONVERT10_E_FIRST = &H800401C0
Public Const CONVERT10_E_LAST = &H800401CF
Public Const CONVERT10_S_FIRST = &H401C0
Public Const CONVERT10_S_LAST = &H401CF
Public Const CONVERT10_E_OLESTREAM_GET = &H800401C0
Public Const CONVERT10_E_OLESTREAM_PUT = &H800401C1
Public Const CONVERT10_E_OLESTREAM_FMT = &H800401C2
Public Const CONVERT10_E_OLESTREAM_BITMAP_TO_DIB = &H800401C3
Public Const CONVERT10_E_STG_FMT = &H800401C4
Public Const CONVERT10_E_STG_NO_STD_STREAM = &H800401C5
Public Const CONVERT10_E_STG_DIB_TO_BITMAP = &H800401C6
Public Const CLIPBRD_E_FIRST = &H800401D0
Public Const CLIPBRD_E_LAST = &H800401DF
Public Const CLIPBRD_S_FIRST = &H401D0
Public Const CLIPBRD_S_LAST = &H401DF
Public Const CLIPBRD_E_CANT_OPEN = &H800401D0
Public Const CLIPBRD_E_CANT_EMPTY = &H800401D1
Public Const CLIPBRD_E_CANT_SET = &H800401D2
Public Const CLIPBRD_E_BAD_DATA = &H800401D3
Public Const CLIPBRD_E_CANT_CLOSE = &H800401D4
Public Const MK_E_FIRST = &H800401E0
Public Const MK_E_LAST = &H800401EF
Public Const MK_S_FIRST = &H401E0
Public Const MK_S_LAST = &H401EF
Public Const MK_E_CONNECTMANUALLY = &H800401E0
Public Const MK_E_EXCEEDEDDEADLINE = &H800401E1
Public Const MK_E_NEEDGENERIC = &H800401E2
Public Const MK_E_UNAVAILABLE = &H800401E3
Public Const MK_E_SYNTAX = &H800401E4
Public Const MK_E_NOOBJECT = &H800401E5
Public Const MK_E_INVALIDEXTENSION = &H800401E6
Public Const MK_E_INTERMEDIATEINTERFACENOTSUPPORTED = &H800401E7
Public Const MK_E_NOTBINDABLE = &H800401E8
Public Const MK_E_NOTBOUND = &H800401E9
Public Const MK_E_CANTOPENFILE = &H800401EA
Public Const MK_E_MUSTBOTHERUSER = &H800401EB
Public Const MK_E_NOINVERSE = &H800401EC
Public Const MK_E_NOSTORAGE = &H800401ED
Public Const MK_E_NOPREFIX = &H800401EE
Public Const MK_E_ENUMERATION_FAILED = &H800401EF
Public Const CO_E_FIRST = &H800401F0
Public Const CO_E_LAST = &H800401FF
Public Const CO_S_FIRST = &H401F0
Public Const CO_S_LAST = &H401FF
Public Const CO_E_NOTINITIALIZED = &H800401F0
Public Const CO_E_ALREADYINITIALIZED = &H800401F1
Public Const CO_E_CANTDETERMINECLASS = &H800401F2
Public Const CO_E_CLASSSTRING = &H800401F3
Public Const CO_E_IIDSTRING = &H800401F4
Public Const CO_E_APPNOTFOUND = &H800401F5
Public Const CO_E_APPSINGLEUSE = &H800401F6
Public Const CO_E_ERRORINAPP = &H800401F7
Public Const CO_E_DLLNOTFOUND = &H800401F8
Public Const CO_E_ERRORINDLL = &H800401F9
Public Const CO_E_WRONGOSFORAPP = &H800401FA
Public Const CO_E_OBJNOTREG = &H800401FB
Public Const CO_E_OBJISREG = &H800401FC
Public Const CO_E_OBJNOTCONNECTED = &H800401FD
Public Const CO_E_APPDIDNTREG = &H800401FE
Public Const CO_E_RELEASED = &H800401FF
Public Const OLE_S_USEREG = &H40000
Public Const OLE_S_STATIC = &H40001
Public Const OLE_S_MAC_CLIPFORMAT = &H40002
Public Const DRAGDROP_S_DROP = &H40100
Public Const DRAGDROP_S_CANCEL = &H40101
Public Const DRAGDROP_S_USEDEFAULTCURSORS = &H40102
Public Const DATA_S_SAMEFORMATETC = &H40130
Public Const VIEW_S_ALREADY_FROZEN = &H40140
Public Const CACHE_S_FORMATETC_NOTSUPPORTED = &H40170
Public Const CACHE_S_SAMECACHE = &H40171
Public Const CACHE_S_SOMECACHES_NOTUPDATED = &H40172
Public Const OLEOBJ_S_INVALIDVERB = &H40180
Public Const OLEOBJ_S_CANNOT_DOVERB_NOW = &H40181
Public Const OLEOBJ_S_INVALIDHWND = &H40182
Public Const INPLACE_S_TRUNCATED = &H401A0
Public Const CONVERT10_S_NO_PRESENTATION = &H401C0
Public Const MK_S_REDUCED_TO_SELF = &H401E2
Public Const MK_S_ME = &H401E4
Public Const MK_S_HIM = &H401E5
Public Const MK_S_US = &H401E6
Public Const MK_S_MONIKERALREADYREGISTERED = &H401E7
Public Const CO_E_CLASS_CREATE_FAILED = &H80080001
Public Const CO_E_SCM_ERROR = &H80080002
Public Const CO_E_SCM_RPC_FAILURE = &H80080003
Public Const CO_E_BAD_PATH = &H80080004
Public Const CO_E_SERVER_EXEC_FAILURE = &H80080005
Public Const CO_E_OBJSRV_RPC_FAILURE = &H80080006
Public Const MK_E_NO_NORMALIZED = &H80080007
Public Const CO_E_SERVER_STOPPING = &H80080008
Public Const MEM_E_INVALID_ROOT = &H80080009
Public Const MEM_E_INVALID_LINK = &H80080010
Public Const MEM_E_INVALID_SIZE = &H80080011
Public Const DISP_E_UNKNOWNINTERFACE = &H80020001
Public Const DISP_E_MEMBERNOTFOUND = &H80020003
Public Const DISP_E_PARAMNOTFOUND = &H80020004
Public Const DISP_E_TYPEMISMATCH = &H80020005
Public Const DISP_E_UNKNOWNNAME = &H80020006
Public Const DISP_E_NONAMEDARGS = &H80020007
Public Const DISP_E_BADVARTYPE = &H80020008
Public Const DISP_E_EXCEPTION = &H80020009
Public Const DISP_E_OVERFLOW = &H8002000A
Public Const DISP_E_BADINDEX = &H8002000B
Public Const DISP_E_UNKNOWNLCID = &H8002000C
Public Const DISP_E_ARRAYISLOCKED = &H8002000D
Public Const DISP_E_BADPARAMCOUNT = &H8002000E
Public Const DISP_E_PARAMNOTOPTIONAL = &H8002000F
Public Const DISP_E_BADCALLEE = &H80020010
Public Const DISP_E_NOTACOLLECTION = &H80020011
Public Const TYPE_E_BUFFERTOOSMALL = &H80028016
Public Const TYPE_E_INVDATAREAD = &H80028018
Public Const TYPE_E_UNSUPFORMAT = &H80028019
Public Const TYPE_E_REGISTRYACCESS = &H8002801C
Public Const TYPE_E_LIBNOTREGISTERED = &H8002801D
Public Const TYPE_E_UNDEFINEDTYPE = &H80028027
Public Const TYPE_E_QUALIFIEDNAMEDISALLOWED = &H80028028
Public Const TYPE_E_INVALIDSTATE = &H80028029
Public Const TYPE_E_WRONGTYPEKIND = &H8002802A
Public Const TYPE_E_ELEMENTNOTFOUND = &H8002802B
Public Const TYPE_E_AMBIGUOUSNAME = &H8002802C
Public Const TYPE_E_NAMECONFLICT = &H8002802D
Public Const TYPE_E_UNKNOWNLCID = &H8002802E
Public Const TYPE_E_DLLFUNCTIONNOTFOUND = &H8002802F
Public Const TYPE_E_BADMODULEKIND = &H800288BD
Public Const TYPE_E_SIZETOOBIG = &H800288C5
Public Const TYPE_E_DUPLICATEID = &H800288C6
Public Const TYPE_E_INVALIDID = &H800288CF
Public Const TYPE_E_TYPEMISMATCH = &H80028CA0
Public Const TYPE_E_OUTOFBOUNDS = &H80028CA1
Public Const TYPE_E_IOERROR = &H80028CA2
Public Const TYPE_E_CANTCREATETMPFILE = &H80028CA3
Public Const TYPE_E_CANTLOADLIBRARY = &H80029C4A
Public Const TYPE_E_INCONSISTENTPROPFUNCS = &H80029C83
Public Const TYPE_E_CIRCULARTYPE = &H80029C84
Public Const STG_E_INVALIDFUNCTION = &H80030001
Public Const STG_E_FILENOTFOUND = &H80030002
Public Const STG_E_PATHNOTFOUND = &H80030003
Public Const STG_E_TOOMANYOPENFILES = &H80030004
Public Const STG_E_ACCESSDENIED = &H80030005
Public Const STG_E_INVALIDHANDLE = &H80030006
Public Const STG_E_INSUFFICIENTMEMORY = &H80030008
Public Const STG_E_INVALIDPOINTER = &H80030009
Public Const STG_E_NOMOREFILES = &H80030012
Public Const STG_E_DISKISWRITEPROTECTED = &H80030013
Public Const STG_E_SEEKERROR = &H80030019
Public Const STG_E_WRITEFAULT = &H8003001D
Public Const STG_E_READFAULT = &H8003001E
Public Const STG_E_SHAREVIOLATION = &H80030020
Public Const STG_E_LOCKVIOLATION = &H80030021
Public Const STG_E_FILEALREADYEXISTS = &H80030050
Public Const STG_E_INVALIDPARAMETER = &H80030057
Public Const STG_E_MEDIUMFULL = &H80030070
Public Const STG_E_ABNORMALAPIEXIT = &H800300FA
Public Const STG_E_INVALIDHEADER = &H800300FB
Public Const STG_E_INVALIDNAME = &H800300FC
Public Const STG_E_UNKNOWN = &H800300FD
Public Const STG_E_UNIMPLEMENTEDFUNCTION = &H800300FE
Public Const STG_E_INVALIDFLAG = &H800300FF
Public Const STG_E_INUSE = &H80030100
Public Const STG_E_NOTCURRENT = &H80030101
Public Const STG_E_REVERTED = &H80030102
Public Const STG_E_CANTSAVE = &H80030103
Public Const STG_E_OLDFORMAT = &H80030104
Public Const STG_E_OLDDLL = &H80030105
Public Const STG_E_SHAREREQUIRED = &H80030106
Public Const STG_E_NOTFILEBASEDSTORAGE = &H80030107
Public Const STG_E_EXTANTMARSHALLINGS = &H80030108
Public Const STG_S_CONVERTED = &H30200
Public Const RPC_E_CALL_REJECTED = &H80010001
Public Const RPC_E_CALL_CANCELED = &H80010002
Public Const RPC_E_CANTPOST_INSENDCALL = &H80010003
Public Const RPC_E_CANTCALLOUT_INASYNCCALL = &H80010004
Public Const RPC_E_CANTCALLOUT_INEXTERNALCALL = &H80010005
Public Const RPC_E_CONNECTION_TERMINATED = &H80010006
Public Const RPC_E_SERVER_DIED = &H80010007
Public Const RPC_E_CLIENT_DIED = &H80010008
Public Const RPC_E_INVALID_DATAPACKET = &H80010009
Public Const RPC_E_CANTTRANSMIT_CALL = &H8001000A
Public Const RPC_E_CLIENT_CANTMARSHAL_DATA = &H8001000B
Public Const RPC_E_CLIENT_CANTUNMARSHAL_DATA = &H8001000C
Public Const RPC_E_SERVER_CANTMARSHAL_DATA = &H8001000D
Public Const RPC_E_SERVER_CANTUNMARSHAL_DATA = &H8001000E
Public Const RPC_E_INVALID_DATA = &H8001000F
Public Const RPC_E_INVALID_PARAMETER = &H80010010
Public Const RPC_E_CANTCALLOUT_AGAIN = &H80010011
Public Const RPC_E_SERVER_DIED_DNE = &H80010012
Public Const RPC_E_SYS_CALL_FAILED = &H80010100
Public Const RPC_E_OUT_OF_RESOURCES = &H80010101
Public Const RPC_E_ATTEMPTED_MULTITHREAD = &H80010102
Public Const RPC_E_NOT_REGISTERED = &H80010103
Public Const RPC_E_FAULT = &H80010104
Public Const RPC_E_SERVERFAULT = &H80010105
Public Const RPC_E_CHANGED_MODE = &H80010106
Public Const RPC_E_INVALIDMETHOD = &H80010107
Public Const RPC_E_DISCONNECTED = &H80010108
Public Const RPC_E_RETRY = &H80010109
Public Const RPC_E_SERVERCALL_RETRYLATER = &H8001010A
Public Const RPC_E_SERVERCALL_REJECTED = &H8001010B
Public Const RPC_E_INVALID_CALLDATA = &H8001010C
Public Const RPC_E_CANTCALLOUT_ININPUTSYNCCALL = &H8001010D
Public Const RPC_E_WRONG_THREAD = &H8001010E
Public Const RPC_E_THREAD_NOT_INIT = &H8001010F
Public Const RPC_E_UNEXPECTED = &H8001FFFF
#1036

' -----------------------------------------
' Win32 API error code definitions
' -----------------------------------------
' This section contains the error code definitions for the Win32 API functions.

' NO_ERROR
Public Const NO_ERROR = 0 '  dderror

' The configuration registry database operation completed successfully.
Public Const ERROR_SUCCESS = 0&

'   Incorrect function.
Public Const ERROR_INVALID_FUNCTION = 1 '  dderror

'   The system cannot find the file specified.
Public Const ERROR_FILE_NOT_FOUND = 2&

'   The system cannot find the path specified.
Public Const ERROR_PATH_NOT_FOUND = 3&

'   The system cannot open the file.
Public Const ERROR_TOO_MANY_OPEN_FILES = 4&

'   Access is denied.
Public Const ERROR_ACCESS_DENIED = 5&

'   The handle is invalid.
Public Const ERROR_INVALID_HANDLE = 6&

'   The storage control blocks were destroyed.
Public Const ERROR_ARENA_TRASHED = 7&

'   Not enough storage is available to process this command.
Public Const ERROR_NOT_ENOUGH_MEMORY = 8 '  dderror

'   The storage control block address is invalid.
Public Const ERROR_INVALID_BLOCK = 9&

'   The environment is incorrect.
Public Const ERROR_BAD_ENVIRONMENT = 10&

'   An attempt was made to load a program with an
'   incorrect format.
Public Const ERROR_BAD_FORMAT = 11&

'   The access code is invalid.
Public Const ERROR_INVALID_ACCESS = 12&

'   The data is invalid.
Public Const ERROR_INVALID_DATA = 13&

'   Not enough storage is available to complete this operation.
Public Const ERROR_OUTOFMEMORY = 14&

'   The system cannot find the drive specified.
Public Const ERROR_INVALID_DRIVE = 15&

'   The directory cannot be removed.
Public Const ERROR_CURRENT_DIRECTORY = 16&

'   The system cannot move the file
'   to a different disk drive.
Public Const ERROR_NOT_SAME_DEVICE = 17&

'   There are no more files.
Public Const ERROR_NO_MORE_FILES = 18&

'   The media is write protected.
Public Const ERROR_WRITE_PROTECT = 19&

'   The system cannot find the device specified.
Public Const ERROR_BAD_UNIT = 20&

'   The device is not ready.
Public Const ERROR_NOT_READY = 21&

'   The device does not recognize the command.
Public Const ERROR_BAD_COMMAND = 22&

'   Data error (cyclic redundancy check)
Public Const ERROR_CRC = 23&

'   The program issued a command but the
'   command length is incorrect.
Public Const ERROR_BAD_LENGTH = 24&

'   The drive cannot locate a specific
'   area or track on the disk.
Public Const ERROR_SEEK = 25&

'   The specified disk or diskette cannot be accessed.
Public Const ERROR_NOT_DOS_DISK = 26&

'   The drive cannot find the sector requested.
Public Const ERROR_SECTOR_NOT_FOUND = 27&

'   The printer is out of paper.
Public Const ERROR_OUT_OF_PAPER = 28&

'   The system cannot write to the specified device.
Public Const ERROR_WRITE_FAULT = 29&

'   The system cannot read from the specified device.
Public Const ERROR_READ_FAULT = 30&

'   A device attached to the system is not functioning.
Public Const ERROR_GEN_FAILURE = 31&

'   The process cannot access the file because
'   it is being used by another process.
Public Const ERROR_SHARING_VIOLATION = 32&

'   The process cannot access the file because
'   another process has locked a portion of the file.
Public Const ERROR_LOCK_VIOLATION = 33&

'   The wrong diskette is in the drive.
'   Insert %2 (Volume Serial Number: %3)
'   into drive %1.
Public Const ERROR_WRONG_DISK = 34&

'   Too many files opened for sharing.
Public Const ERROR_SHARING_BUFFER_EXCEEDED = 36&

'   Reached end of file.
Public Const ERROR_HANDLE_EOF = 38&

'   The disk is full.
Public Const ERROR_HANDLE_DISK_FULL = 39&

'   The network request is not supported.
Public Const ERROR_NOT_SUPPORTED = 50&

'   The remote computer is not available.
Public Const ERROR_REM_NOT_LIST = 51&

'   A duplicate name exists on the network.
Public Const ERROR_DUP_NAME = 52&

'   The network path was not found.
Public Const ERROR_BAD_NETPATH = 53&

'   The network is busy.
Public Const ERROR_NETWORK_BUSY = 54&

'   The specified network resource or device is no longer
'   available.
Public Const ERROR_DEV_NOT_EXIST = 55 '  dderror

'   The network BIOS command limit has been reached.
Public Const ERROR_TOO_MANY_CMDS = 56&

'   A network adapter hardware error occurred.
Public Const ERROR_ADAP_HDW_ERR = 57&

'   The specified server cannot perform the requested
'   operation.
Public Const ERROR_BAD_NET_RESP = 58&

'   An unexpected network error occurred.
Public Const ERROR_UNEXP_NET_ERR = 59&

'   The remote adapter is not compatible.
Public Const ERROR_BAD_REM_ADAP = 60&

'   The printer queue is full.
Public Const ERROR_PRINTQ_FULL = 61&

'   Space to store the file waiting to be printed is
'   not available on the server.
Public Const ERROR_NO_SPOOL_SPACE = 62&

'   Your file waiting to be printed was deleted.
Public Const ERROR_PRINT_CANCELLED = 63&

'   The specified network name is no longer available.
Public Const ERROR_NETNAME_DELETED = 64&

'   Network access is denied.
Public Const ERROR_NETWORK_ACCESS_DENIED = 65&

'   The network resource type is not correct.
Public Const ERROR_BAD_DEV_TYPE = 66&

'   The network name cannot be found.
Public Const ERROR_BAD_NET_NAME = 67&

'   The name limit for the local computer network
'   adapter card was exceeded.
Public Const ERROR_TOO_MANY_NAMES = 68&

'   The network BIOS session limit was exceeded.
Public Const ERROR_TOO_MANY_SESS = 69&

'   The remote server has been paused or is in the
'   process of being started.
Public Const ERROR_SHARING_PAUSED = 70&

'   The network request was not accepted.
Public Const ERROR_REQ_NOT_ACCEP = 71&

'   The specified printer or disk device has been paused.
Public Const ERROR_REDIR_PAUSED = 72&

'   The file exists.
Public Const ERROR_FILE_EXISTS = 80&

'   The directory or file cannot be created.
Public Const ERROR_CANNOT_MAKE = 82&

'   Fail on INT 24
Public Const ERROR_FAIL_I24 = 83&

'   Storage to process this request is not available.
Public Const ERROR_OUT_OF_STRUCTURES = 84&

'   The local device name is already in use.
Public Const ERROR_ALREADY_ASSIGNED = 85&

'   The specified network password is not correct.
Public Const ERROR_INVALID_PASSWORD = 86&

'   The parameter is incorrect.
Public Const ERROR_INVALID_PARAMETER = 87 '  dderror

'   A write fault occurred on the network.
Public Const ERROR_NET_WRITE_FAULT = 88&

'   The system cannot start another process at
'   this time.
Public Const ERROR_NO_PROC_SLOTS = 89&

'   Cannot create another system semaphore.
Public Const ERROR_TOO_MANY_SEMAPHORES = 100&

'   The exclusive semaphore is owned by another process.
Public Const ERROR_EXCL_SEM_ALREADY_OWNED = 101&

'   The semaphore is set and cannot be closed.
Public Const ERROR_SEM_IS_SET = 102&

'   The semaphore cannot be set again.
Public Const ERROR_TOO_MANY_SEM_REQUESTS = 103&

'   Cannot request exclusive semaphores at interrupt time.
Public Const ERROR_INVALID_AT_INTERRUPT_TIME = 104&

'   The previous ownership of this semaphore has ended.
Public Const ERROR_SEM_OWNER_DIED = 105&

'   Insert the diskette for drive %1.
Public Const ERROR_SEM_USER_LIMIT = 106&

'   Program stopped because alternate diskette was not inserted.
Public Const ERROR_DISK_CHANGE = 107&

'   The disk is in use or locked by
'   another process.
Public Const ERROR_DRIVE_LOCKED = 108&

'   The pipe has been ended.
Public Const ERROR_BROKEN_PIPE = 109&

'   The system cannot open the
'   device or file specified.
Public Const ERROR_OPEN_FAILED = 110&

'   The file name is too long.
Public Const ERROR_BUFFER_OVERFLOW = 111&

'   There is not enough space on the disk.
Public Const ERROR_DISK_FULL = 112&

'   No more internal file identifiers available.
Public Const ERROR_NO_MORE_SEARCH_HANDLES = 113&

'   The target internal file identifier is incorrect.
Public Const ERROR_INVALID_TARGET_HANDLE = 114&

'   The IOCTL call made by the application program is
'   not correct.
Public Const ERROR_INVALID_CATEGORY = 117&

'   The verify-on-write switch parameter value is not
'   correct.
Public Const ERROR_INVALID_VERIFY_SWITCH = 118&

'   The system does not support the command requested.
Public Const ERROR_BAD_DRIVER_LEVEL = 119&

'   This function is only valid in Windows NT mode.
Public Const ERROR_CALL_NOT_IMPLEMENTED = 120&

'   The semaphore timeout period has expired.
Public Const ERROR_SEM_TIMEOUT = 121&

'   The data area passed to a system call is too
'   small.
Public Const ERROR_INSUFFICIENT_BUFFER = 122 '  dderror

'   The filename, directory name, or volume label syntax is incorrect.
Public Const ERROR_INVALID_NAME = 123&

'   The system call level is not correct.
Public Const ERROR_INVALID_LEVEL = 124&

'   The disk has no volume label.
Public Const ERROR_NO_VOLUME_LABEL = 125&

'   The specified module could not be found.
Public Const ERROR_MOD_NOT_FOUND = 126&

'   The specified procedure could not be found.
Public Const ERROR_PROC_NOT_FOUND = 127&

'   There are no child processes to wait for.
Public Const ERROR_WAIT_NO_CHILDREN = 128&

'   The %1 application cannot be run in Windows NT mode.
Public Const ERROR_CHILD_NOT_COMPLETE = 129&

'   Attempt to use a file handle to an open disk partition for an
'   operation other than raw disk I/O.
Public Const ERROR_DIRECT_ACCESS_HANDLE = 130&

'   An attempt was made to move the file pointer before the beginning of the file.
Public Const ERROR_NEGATIVE_SEEK = 131&

'   The file pointer cannot be set on the specified device or file.
Public Const ERROR_SEEK_ON_DEVICE = 132&

'   A JOIN or SUBST command
'   cannot be used for a drive that
'   contains previously joined drives.
Public Const ERROR_IS_JOIN_TARGET = 133&

'   An attempt was made to use a
'   JOIN or SUBST command on a drive that has
'   already been joined.
Public Const ERROR_IS_JOINED = 134&

'   An attempt was made to use a
'   JOIN or SUBST command on a drive that has
'   already been substituted.
Public Const ERROR_IS_SUBSTED = 135&

'   The system tried to delete
'   the JOIN of a drive that is not joined.
Public Const ERROR_NOT_JOINED = 136&

'   The system tried to delete the
'   substitution of a drive that is not substituted.
Public Const ERROR_NOT_SUBSTED = 137&

'   The system tried to join a drive
'   to a directory on a joined drive.
Public Const ERROR_JOIN_TO_JOIN = 138&

'   The system tried to substitute a
'   drive to a directory on a substituted drive.
Public Const ERROR_SUBST_TO_SUBST = 139&

'   The system tried to join a drive to
'   a directory on a substituted drive.
Public Const ERROR_JOIN_TO_SUBST = 140&

'   The system tried to SUBST a drive
'   to a directory on a joined drive.
Public Const ERROR_SUBST_TO_JOIN = 141&

'   The system cannot perform a JOIN or SUBST at this time.
Public Const ERROR_BUSY_DRIVE = 142&

'   The system cannot join or substitute a
'   drive to or for a directory on the same drive.
Public Const ERROR_SAME_DRIVE = 143&

'   The directory is not a subdirectory of the root directory.
Public Const ERROR_DIR_NOT_ROOT = 144&

'   The directory is not empty.
Public Const ERROR_DIR_NOT_EMPTY = 145&

'   The path specified is being used in
'   a substitute.
Public Const ERROR_IS_SUBST_PATH = 146&

'   Not enough resources are available to
'   process this command.
Public Const ERROR_IS_JOIN_PATH = 147&

'   The path specified cannot be used at this time.
Public Const ERROR_PATH_BUSY = 148&

'   An attempt was made to join
'   or substitute a drive for which a directory
'   on the drive is the target of a previous
'   substitute.
Public Const ERROR_IS_SUBST_TARGET = 149&

'   System trace information was not specified in your
'   CONFIG.SYS file, or tracing is disallowed.
Public Const ERROR_SYSTEM_TRACE = 150&

'   The number of specified semaphore events for
'   DosMuxSemWait is not correct.
Public Const ERROR_INVALID_EVENT_COUNT = 151&

'   DosMuxSemWait did not execute; too many semaphores
'   are already set.
Public Const ERROR_TOO_MANY_MUXWAITERS = 152&

'   The DosMuxSemWait list is not correct.
Public Const ERROR_INVALID_LIST_FORMAT = 153&

'   The volume label you entered exceeds the
'   11 character limit.  The first 11 characters were written
'   to disk.  Any characters that exceeded the 11 character limit
'   were automatically deleted.
Public Const ERROR_LABEL_TOO_LONG = 154&

'   Cannot create another thread.
Public Const ERROR_TOO_MANY_TCBS = 155&

'   The recipient process has refused the signal.
Public Const ERROR_SIGNAL_REFUSED = 156&

'   The segment is already discarded and cannot be locked.
Public Const ERROR_DISCARDED = 157&

'   The segment is already unlocked.
Public Const ERROR_NOT_LOCKED = 158&

'   The address for the thread ID is not correct.
Public Const ERROR_BAD_THREADID_ADDR = 159&

'   The argument string passed to DosExecPgm is not correct.
Public Const ERROR_BAD_ARGUMENTS = 160&

'   The specified path is invalid.
Public Const ERROR_BAD_PATHNAME = 161&

'   A signal is already pending.
Public Const ERROR_SIGNAL_PENDING = 162&

'   No more threads can be created in the system.
Public Const ERROR_MAX_THRDS_REACHED = 164&

'   Unable to lock a region of a file.
Public Const ERROR_LOCK_FAILED = 167&

'   The requested resource is in use.
Public Const ERROR_BUSY = 170&

'   A lock request was not outstanding for the supplied cancel region.
Public Const ERROR_CANCEL_VIOLATION = 173&

'   The file system does not support atomic changes to the lock type.
Public Const ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174&

'   The system detected a segment number that was not correct.
Public Const ERROR_INVALID_SEGMENT_NUMBER = 180&

'   The operating system cannot run %1.
Public Const ERROR_INVALID_ORDINAL = 182&

'   Cannot create a file when that file already exists.
Public Const ERROR_ALREADY_EXISTS = 183&

'   The flag passed is not correct.
Public Const ERROR_INVALID_FLAG_NUMBER = 186&

'   The specified system semaphore name was not found.
Public Const ERROR_SEM_NOT_FOUND = 187&

'   The operating system cannot run %1.
Public Const ERROR_INVALID_STARTING_CODESEG = 188&

'   The operating system cannot run %1.
Public Const ERROR_INVALID_STACKSEG = 189&

'   The operating system cannot run %1.
Public Const ERROR_INVALID_MODULETYPE = 190&

'   Cannot run %1 in Windows NT mode.
Public Const ERROR_INVALID_EXE_SIGNATURE = 191&

'   The operating system cannot run %1.
Public Const ERROR_EXE_MARKED_INVALID = 192&

'   %1 is not a valid Windows NT application.
Public Const ERROR_BAD_EXE_FORMAT = 193&

'   The operating system cannot run %1.
Public Const ERROR_ITERATED_DATA_EXCEEDS_64k = 194&

'   The operating system cannot run %1.
Public Const ERROR_INVALID_MINALLOCSIZE = 195&

'   The operating system cannot run this
'   application program.
Public Const ERROR_DYNLINK_FROM_INVALID_RING = 196&

'   The operating system is not presently
'   configured to run this application.
Public Const ERROR_IOPL_NOT_ENABLED = 197&

'   The operating system cannot run %1.
Public Const ERROR_INVALID_SEGDPL = 198&

'   The operating system cannot run this
'   application program.
Public Const ERROR_AUTODATASEG_EXCEEDS_64k = 199&

'   The code segment cannot be greater than or equal to 64KB.
Public Const ERROR_RING2SEG_MUST_BE_MOVABLE = 200&

'   The operating system cannot run %1.
Public Const ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201&

'   The operating system cannot run %1.
Public Const ERROR_INFLOOP_IN_RELOC_CHAIN = 202&

'   The system could not find the environment
'   option that was entered.
Public Const ERROR_ENVVAR_NOT_FOUND = 203&

'   No process in the command subtree has a
'   signal handler.
Public Const ERROR_NO_SIGNAL_SENT = 205&

'   The filename or extension is too long.
Public Const ERROR_FILENAME_EXCED_RANGE = 206&

'   The ring 2 stack is in use.
Public Const ERROR_RING2_STACK_IN_USE = 207&

'   The Global filename characters,  or ?, are entered
'   incorrectly or too many Global filename characters are specified.
Public Const ERROR_META_EXPANSION_TOO_LONG = 208&

'   The signal being posted is not correct.
Public Const ERROR_INVALID_SIGNAL_NUMBER = 209&

'   The signal handler cannot be set.
Public Const ERROR_THREAD_1_INACTIVE = 210&

'   The segment is locked and cannot be reallocated.
Public Const ERROR_LOCKED = 212&

'   Too many dynamic link modules are attached to this
'   program or dynamic link module.
Public Const ERROR_TOO_MANY_MODULES = 214&

'   Can't nest calls to LoadModule.
Public Const ERROR_NESTING_NOT_ALLOWED = 215&

'   The pipe state is invalid.
Public Const ERROR_BAD_PIPE = 230&

'   All pipe instances are busy.
Public Const ERROR_PIPE_BUSY = 231&

'   The pipe is being closed.
Public Const ERROR_NO_DATA = 232&

'   No process is on the other end of the pipe.
Public Const ERROR_PIPE_NOT_CONNECTED = 233&

'   More data is available.
Public Const ERROR_MORE_DATA = 234 '  dderror

'   The session was cancelled.
Public Const ERROR_VC_DISCONNECTED = 240&

'   The specified extended attribute name was invalid.
Public Const ERROR_INVALID_EA_NAME = 254&

'   The extended attributes are inconsistent.
Public Const ERROR_EA_LIST_INCONSISTENT = 255&

'   No more data is available.
Public Const ERROR_NO_MORE_ITEMS = 259&

'   The Copy API cannot be used.
Public Const ERROR_CANNOT_COPY = 266&

'   The directory name is invalid.
Public Const ERROR_DIRECTORY = 267&

'   The extended attributes did not fit in the buffer.
Public Const ERROR_EAS_DIDNT_FIT = 275&

'   The extended attribute file on the mounted file system is corrupt.
Public Const ERROR_EA_FILE_CORRUPT = 276&

'   The extended attribute table file is full.
Public Const ERROR_EA_TABLE_FULL = 277&

'   The specified extended attribute handle is invalid.
Public Const ERROR_INVALID_EA_HANDLE = 278&

'   The mounted file system does not support extended attributes.
Public Const ERROR_EAS_NOT_SUPPORTED = 282&

'   Attempt to release mutex not owned by caller.
Public Const ERROR_NOT_OWNER = 288&

'   Too many posts were made to a semaphore.
Public Const ERROR_TOO_MANY_POSTS = 298&

'   The system cannot find message for message number 0x%1
'   in message file for %2.
Public Const ERROR_MR_MID_NOT_FOUND = 317&

'   Attempt to access invalid address.
Public Const ERROR_INVALID_ADDRESS = 487&

'   Arithmetic result exceeded 32 bits.
Public Const ERROR_ARITHMETIC_OVERFLOW = 534&

'   There is a process on other end of the pipe.
Public Const ERROR_PIPE_CONNECTED = 535&

'   Waiting for a process to open the other end of the pipe.
Public Const ERROR_PIPE_LISTENING = 536&

'   Access to the extended attribute was denied.
Public Const ERROR_EA_ACCESS_DENIED = 994&
#1037

' *****************************************************************************                                                                             *
' * dde.h -       Dynamic Data Exchange structures and definitions              *
' *                                                                             *
' * Copyright (c) 1993-1995, Microsoft Corp.        All rights reserved              *
' *                                                                             *
' \*****************************************************************************/


' ----------------------------------------------------------------------------
'        DDEACK structure
'
'         Structure of wStatus (LOWORD(lParam)) in WM_DDE_ACK message
'        sent in response to a WM_DDE_DATA, WM_DDE_REQUEST, WM_DDE_POKE,
'        WM_DDE_ADVISE, or WM_DDE_UNADVISE message.
'
' ----------------------------------------------------------------------------*/

Type DDEACK
        bAppReturnCode As Integer
        Reserved As Integer
        fbusy As Integer
        fack As Integer
End Type

' ----------------------------------------------------------------------------
'        DDEADVISE structure
'
'         WM_DDE_ADVISE parameter structure for hOptions (LOWORD(lParam))
'
' ----------------------------------------------------------------------------*/

Type DDEADVISE
        Reserved As Integer
        fDeferUpd As Integer
        fAckReq As Integer
        cfFormat As Integer
End Type


' ----------------------------------------------------------------------------
'        DDEDATA structure
'
'        WM_DDE_DATA parameter structure for hData (LOWORD(lParam)).
'        The actual size of this structure depends on the size of
'        the Value array.
'
' ----------------------------------------------------------------------------*/

Type DDEDATA
        unused As Integer
        fresponse As Integer
        fRelease As Integer
        Reserved As Integer
        fAckReq As Integer
        cfFormat As Integer
        Value(1) As Byte
End Type


' ----------------------------------------------------------------------------
'         DDEPOKE structure
'
'         WM_DDE_POKE parameter structure for hData (LOWORD(lParam)).
'        The actual size of this structure depends on the size of
'        the Value array.
'
' ----------------------------------------------------------------------------*/

Type DDEPOKE
        unused As Integer
        fRelease As Integer
        fReserved As Integer
        cfFormat As Integer
        Value(1) As Byte
End Type

' ----------------------------------------------------------------------------
' The following typedef's were used in previous versions of the Windows SDK.
' They are still valid.  The above typedef's define exactly the same structures
' as those below.  The above typedef names are recommended, however, as they
' are more meaningful.

' Note that the DDEPOKE structure typedef'ed in earlier versions of DDE.H did
' not correctly define the bit positions.
' ----------------------------------------------------------------------------*/

Type DDELN
        unused As Integer
        fRelease As Integer
        fDeferUpd As Integer
        fAckReq As Integer
        cfFormat As Integer
End Type

Type DDEUP
        unused As Integer
        fAck As Integer
        fRelease As Integer
        fReserved As Integer
        fAckReq As Integer
        cfFormat As Integer
        rgb(1) As Byte
End Type

Declare Function DdeSetQualityOfService Lib "user32" Alias "DdeSetQualityOfService" (ByVal hWndClient As Long, pqosNew As SECURITY_QUALITY_OF_SERVICE, pqosPrev As SECURITY_QUALITY_OF_SERVICE) As Long
Declare Function ImpersonateDdeClientWindow Lib "user32" Alias "ImpersonateDdeClientWindow" (ByVal hWndClient As Long, ByVal hWndServer As Long) As Long
Declare Function PackDDElParam Lib "user32" Alias "PackDDElParam" (ByVal msg As Long, ByVal uiLo As Long, ByVal uiHi As Long) As Long
Declare Function UnpackDDElParam Lib "user32" Alias "UnpackDDElParam" (ByVal msg As Long, ByVal lParam As Long, puiLo As Long, puiHi As Long) As Long
Declare Function FreeDDElParam Lib "user32" Alias "FreeDDElParam" (ByVal msg As Long, ByVal lParam As Long) As Long
Declare Function ReuseDDElParam Lib "user32" Alias "ReuseDDElParam" (ByVal lParam As Long, ByVal msgIn As Long, ByVal msgOut As Long, ByVal uiLo As Long, ByVal uiHi As Long) As Long

Type HSZPAIR
        hszSvc As Long
        hszTopic As Long
End Type

'//
'// Quality Of Service
'//

Type SECURITY_QUALITY_OF_SERVICE
    Length As Long
    Impersonationlevel As Integer
    ContextTrackingMode As Integer
    EffectiveOnly As Long
End Type

Type CONVCONTEXT
        cb As Long
        wFlags As Long
        wCountryID As Long
        iCodePage As Long
        dwLangID As Long
        dwSecurity As Long
        qos As SECURITY_QUALITY_OF_SERVICE
End Type

Type CONVINFO
        cb As Long
        hUser As Long
        hConvPartner As Long
        hszSvcPartner As Long
        hszServiceReq As Long
        hszTopic As Long
        hszItem As Long
        wFmt As Long
        wType As Long
        wStatus As Long
        wConvst As Long
        wLastError As Long
        hConvList As Long
        ConvCtxt As CONVCONTEXT
        hwnd As Long
        hwndPartner As Long
End Type

'  conversation states (usState)
Public Const XST_NULL = 0  '  quiescent states
Public Const XST_INCOMPLETE = 1
Public Const XST_CONNECTED = 2
Public Const XST_INIT1 = 3  '  mid-initiation states
Public Const XST_INIT2 = 4
Public Const XST_REQSENT = 5  '  active conversation states
Public Const XST_DATARCVD = 6
Public Const XST_POKESENT = 7
Public Const XST_POKEACKRCVD = 8
Public Const XST_EXECSENT = 9
Public Const XST_EXECACKRCVD = 10
Public Const XST_ADVSENT = 11
Public Const XST_UNADVSENT = 12
Public Const XST_ADVACKRCVD = 13
Public Const XST_UNADVACKRCVD = 14
Public Const XST_ADVDATASENT = 15
Public Const XST_ADVDATAACKRCVD = 16

'  used in LOWORD(dwData1) of XTYP_ADVREQ callbacks...
Public Const CADV_LATEACK = &HFFFF

'  conversation status bits (fsStatus)
Public Const ST_CONNECTED = &H1
Public Const ST_ADVISE = &H2
Public Const ST_ISLOCAL = &H4
Public Const ST_BLOCKED = &H8
Public Const ST_CLIENT = &H10
Public Const ST_TERMINATED = &H20
Public Const ST_INLIST = &H40
Public Const ST_BLOCKNEXT = &H80
Public Const ST_ISSELF = &H100

'  DDE constants for wStatus field
Public Const DDE_FACK = &H8000
Public Const DDE_FBUSY = &H4000
Public Const DDE_FDEFERUPD = &H4000
Public Const DDE_FACKREQ = &H8000
Public Const DDE_FRELEASE = &H2000
Public Const DDE_FREQUESTED = &H1000
Public Const DDE_FAPPSTATUS = &HFF
Public Const DDE_FNOTPROCESSED = &H0

Public Const DDE_FACKRESERVED = (Not (DDE_FACK Or DDE_FBUSY Or DDE_FAPPSTATUS))
Public Const DDE_FADVRESERVED = (Not (DDE_FACKREQ Or DDE_FDEFERUPD))
Public Const DDE_FDATRESERVED = (Not (DDE_FACKREQ Or DDE_FRELEASE Or DDE_FREQUESTED))
Public Const DDE_FPOKRESERVED = (Not (DDE_FRELEASE))

'  message filter hook types
Public Const MSGF_DDEMGR = &H8001

'  codepage constants
Public Const CP_WINANSI = 1004  '  default codepage for windows old DDE convs.
Public Const CP_WINUNICODE = 1200

'  transaction types
Public Const XTYPF_NOBLOCK = &H2     '  CBR_BLOCK will not work
Public Const XTYPF_NODATA = &H4     '  DDE_FDEFERUPD
Public Const XTYPF_ACKREQ = &H8     '  DDE_FACKREQ

Public Const XCLASS_MASK = &HFC00
Public Const XCLASS_BOOL = &H1000
Public Const XCLASS_DATA = &H2000
Public Const XCLASS_FLAGS = &H4000
Public Const XCLASS_NOTIFICATION = &H8000

Public Const XTYP_ERROR = (&H0 Or XCLASS_NOTIFICATION Or XTYPF_NOBLOCK)
Public Const XTYP_ADVDATA = (&H10 Or XCLASS_FLAGS)
Public Const XTYP_ADVREQ = (&H20 Or XCLASS_DATA Or XTYPF_NOBLOCK)
Public Const XTYP_ADVSTART = (&H30 Or XCLASS_BOOL)
Public Const XTYP_ADVSTOP = (&H40 Or XCLASS_NOTIFICATION)
Public Const XTYP_EXECUTE = (&H50 Or XCLASS_FLAGS)
Public Const XTYP_CONNECT = (&H60 Or XCLASS_BOOL Or XTYPF_NOBLOCK)
Public Const XTYP_CONNECT_CONFIRM = (&H70 Or XCLASS_NOTIFICATION Or XTYPF_NOBLOCK)
Public Const XTYP_XACT_COMPLETE = (&H80 Or XCLASS_NOTIFICATION)
Public Const XTYP_POKE = (&H90 Or XCLASS_FLAGS)
Public Const XTYP_REGISTER = (&HA0 Or XCLASS_NOTIFICATION Or XTYPF_NOBLOCK)
Public Const XTYP_REQUEST = (&HB0 Or XCLASS_DATA)
Public Const XTYP_DISCONNECT = (&HC0 Or XCLASS_NOTIFICATION Or XTYPF_NOBLOCK)
Public Const XTYP_UNREGISTER = (&HD0 Or XCLASS_NOTIFICATION Or XTYPF_NOBLOCK)
Public Const XTYP_WILDCONNECT = (&HE0 Or XCLASS_DATA Or XTYPF_NOBLOCK)

Public Const XTYP_MASK = &HF0
Public Const XTYP_SHIFT = 4  '  shift to turn XTYP_ into an index

'  Timeout constants
Public Const TIMEOUT_ASYNC = &HFFFF

'  Transaction ID constants
Public Const QID_SYNC = &HFFFF

'  public strings used in DDE
Public Const SZDDESYS_TOPIC = "System"
Public Const SZDDESYS_ITEM_TOPICS = "Topics"
Public Const SZDDESYS_ITEM_SYSITEMS = "SysItems"
Public Const SZDDESYS_ITEM_RTNMSG = "ReturnMessage"
Public Const SZDDESYS_ITEM_STATUS = "Status"
Public Const SZDDESYS_ITEM_FORMATS = "Formats"
Public Const SZDDESYS_ITEM_HELP = "Help"
Public Const SZDDE_ITEM_ITEMLIST = "TopicItemList"

Public Const CBR_BLOCK = &HFFFF

' Callback filter flags for use with standard apps.
Public Const CBF_FAIL_SELFCONNECTIONS = &H1000
Public Const CBF_FAIL_CONNECTIONS = &H2000
Public Const CBF_FAIL_ADVISES = &H4000
Public Const CBF_FAIL_EXECUTES = &H8000
Public Const CBF_FAIL_POKES = &H10000
Public Const CBF_FAIL_REQUESTS = &H20000
Public Const CBF_FAIL_ALLSVRXACTIONS = &H3F000

Public Const CBF_SKIP_CONNECT_CONFIRMS = &H40000
Public Const CBF_SKIP_REGISTRATIONS = &H80000
Public Const CBF_SKIP_UNREGISTRATIONS = &H100000
Public Const CBF_SKIP_DISCONNECTS = &H200000
Public Const CBF_SKIP_ALLNOTIFICATIONS = &H3C0000

' Application command flags
Public Const APPCMD_CLIENTONLY = &H10&
Public Const APPCMD_FILTERINITS = &H20&
Public Const APPCMD_MASK = &HFF0&

' Application classification flags
Public Const APPCLASS_STANDARD = &H0&
Public Const APPCLASS_MASK = &HF&

Declare Function DdeUninitialize Lib "user32" Alias "DdeUninitialize" (ByVal idInst As Long) As Long

' conversation enumeration functions
Declare Function DdeConnectList Lib "user32" Alias "DdeConnectList" (ByVal idInst As Long, ByVal hszService As Long, ByVal hszTopic As Long, ByVal hConvList As Long, pCC As CONVCONTEXT) As Long
Declare Function DdeQueryNextServer Lib "user32" Alias "DdeQueryNextServer" (ByVal hConvList As Long, ByVal hConvPrev As Long) As Long
Declare Function DdeDisconnectList Lib "user32" Alias "DdeDisconnectList" (ByVal hConvList As Long) As Long

' conversation control functions
Declare Function DdeConnect Lib "user32" Alias "DdeConnect" (ByVal idInst As Long, ByVal hszService As Long, ByVal hszTopic As Long, pCC As CONVCONTEXT) As Long
Declare Function DdeDisconnect Lib "user32" Alias "DdeDisconnect" (ByVal hConv As Long) As Long
Declare Function DdeReconnect Lib "user32" Alias "DdeReconnect" (ByVal hConv As Long) As Long
Declare Function DdeQueryConvInfo Lib "user32" Alias "DdeQueryConvInfo" (ByVal hConv As Long, ByVal idTransaction As Long, pConvInfo As CONVINFO) As Long
Declare Function DdeSetUserHandle Lib "user32" Alias "DdeSetUserHandle" (ByVal hConv As Long, ByVal id As Long, ByVal hUser As Long) As Long
Declare Function DdeAbandonTransaction Lib "user32" Alias "DdeAbandonTransaction" (ByVal idInst As Long, ByVal hConv As Long, ByVal idTransaction As Long) As Long

' app server interface functions
Declare Function DdePostAdvise Lib "user32" Alias "DdePostAdvise" (ByVal idInst As Long, ByVal hszTopic As Long, ByVal hszItem As Long) As Long
Declare Function DdeEnableCallback Lib "user32" Alias "DdeEnableCallback" (ByVal idInst As Long, ByVal hConv As Long, ByVal wCmd As Long) As Long
Declare Function DdeImpersonateClient Lib "user32" Alias "DdeImpersonateClient" (ByVal hConv As Long) As Long

Public Const EC_ENABLEALL = 0
Public Const EC_ENABLEONE = ST_BLOCKNEXT
Public Const EC_DISABLE = ST_BLOCKED
Public Const EC_QUERYWAITING = 2

Declare Function DdeNameService Lib "user32" Alias "DdeNameService" (ByVal idInst As Long, ByVal hsz1 As Long, ByVal hsz2 As Long, ByVal afCmd As Long) As Long

Public Const DNS_REGISTER = &H1
Public Const DNS_UNREGISTER = &H2
Public Const DNS_FILTERON = &H4
Public Const DNS_FILTEROFF = &H8

' app client interface functions
Declare Function DdeClientTransaction Lib "user32" Alias "DdeClientTransaction" (pData As Byte, ByVal cbData As Long, ByVal hConv As Long, ByVal hszItem As Long, ByVal wFmt As Long, ByVal wType As Long, ByVal dwTimeout As Long, pdwResult As Long) As Long

' data transfer functions
Declare Function DdeCreateDataHandle Lib "user32" Alias "DdeCreateDataHandle" (ByVal idInst As Long, pSrc As Byte, ByVal cb As Long, ByVal cbOff As Long, ByVal hszItem As Long, ByVal wFmt As Long, ByVal afCmd As Long) As Long
Declare Function DdeAddData Lib "user32" Alias "DdeAddDataA" (ByVal hData As Long, pSrc As Byte, ByVal cb As Long, ByVal cbOff As Long) As Long
Declare Function DdeGetData Lib "user32" Alias "DdeGetDataA" (ByVal hData As Long, pDst As Byte, ByVal cbMax As Long, ByVal cbOff As Long) As Long
Declare Function DdeAccessData Lib "user32" Alias "DdeAccessDataA" (ByVal hData As Long, pcbDataSize As Long) As Long
Declare Function DdeUnaccessData Lib "user32" Alias "DdeUnaccessDataA" (ByVal hData As Long) As Long
Declare Function DdeFreeDataHandle Lib "user32" Alias "DdeFreeDataHandle" (ByVal hData As Long) As Long

Public Const HDATA_APPOWNED = &H1

Declare Function DdeGetLastError Lib "user32" Alias "DdeGetLastError" (ByVal idInst As Long) As Long

Public Const DMLERR_NO_ERROR = 0                           '  must be 0

Public Const DMLERR_FIRST = &H4000

Public Const DMLERR_ADVACKTIMEOUT = &H4000
Public Const DMLERR_BUSY = &H4001
Public Const DMLERR_DATAACKTIMEOUT = &H4002
Public Const DMLERR_DLL_NOT_INITIALIZED = &H4003
Public Const DMLERR_DLL_USAGE = &H4004
Public Const DMLERR_EXECACKTIMEOUT = &H4005
Public Const DMLERR_INVALIDPARAMETER = &H4006
Public Const DMLERR_LOW_MEMORY = &H4007
Public Const DMLERR_MEMORY_ERROR = &H4008
Public Const DMLERR_NOTPROCESSED = &H4009
Public Const DMLERR_NO_CONV_ESTABLISHED = &H400A
Public Const DMLERR_POKEACKTIMEOUT = &H400B
Public Const DMLERR_POSTMSG_FAILED = &H400C
Public Const DMLERR_REENTRANCY = &H400D
Public Const DMLERR_SERVER_DIED = &H400E
Public Const DMLERR_SYS_ERROR = &H400F
Public Const DMLERR_UNADVACKTIMEOUT = &H4010
Public Const DMLERR_UNFOUND_QUEUE_ID = &H4011

Public Const DMLERR_LAST = &H4011

Declare Function DdeCreateStringHandle Lib "user32" Alias "DdeCreateStringHandleA" (ByVal idInst As Long, ByVal psz As String, ByVal iCodePage As Long) As Long

Declare Function DdeQueryString Lib "user32" Alias "DdeQueryStringA" (ByVal idInst As Long, ByVal hsz As Long, ByVal psz As String, ByVal cchMax As Long, ByVal iCodePage As Long) As Long

Declare Function DdeFreeStringHandle Lib "user32" Alias "DdeFreeStringHandle" (ByVal idInst As Long, ByVal hsz As Long) As Long
Declare Function DdeKeepStringHandle Lib "user32" Alias "DdeKeepStringHandle" (ByVal idInst As Long, ByVal hsz As Long) As Long
Declare Function DdeCmpStringHandles Lib "user32" Alias "DdeCmpStringHandles" (ByVal hsz1 As Long, ByVal hsz2 As Long) As Long

Type DDEML_MSG_HOOK_DATA    '  new for NT
        uiLo As Long  '  unpacked lo and hi parts of lParam
        uiHi As Long
        cbData As Long   '  amount of data in message, if any. May be > than 32 bytes.
        Data(8) As Long  '  data peeking by DDESPY is limited to 32 bytes.
End Type

Type MONMSGSTRUCT
        cb As Long
        hwndTo As Long
        dwTime As Long
        htask As Long
        wMsg As Long
        wParam As Long
        lParam As Long
        dmhd As DDEML_MSG_HOOK_DATA       '  new for NT
End Type

Type MONCBSTRUCT
        cb As Long
        dwTime As Long
        htask As Long
        dwRet As Long
        wType As Long
        wFmt As Long
        hConv As Long
        hsz1 As Long
        hsz2 As Long
        hData As Long
        dwData1 As Long
        dwData2 As Long
        cc As CONVCONTEXT                 '  new for NT for XTYP_CONNECT callbacks
        cbData As Long                  '  new for NT for data peeking
        Data(8) As Long                 '  new for NT for data peeking
End Type

Type MONHSZSTRUCT
        cb As Long
        fsAction As Long '  MH_ value
        dwTime As Long
        hsz As Long
        htask As Long
        str As Byte
End Type

Public Const MH_CREATE = 1
Public Const MH_KEEP = 2
Public Const MH_DELETE = 3
Public Const MH_CLEANUP = 4

Type MONERRSTRUCT
        cb As Long
        wLastError As Long
        dwTime As Long
        htask As Long
End Type

Type MONLINKSTRUCT
        cb As Long
        dwTime As Long
        htask As Long
        fEstablished As Long
        fNoData As Long
        hszSvc As Long
        hszTopic As Long
        hszItem As Long
        wFmt As Long
        fServer As Long
        hConvServer As Long
        hConvClient As Long
End Type

Type MONCONVSTRUCT
        cb As Long
        fConnect As Long
        dwTime As Long
        htask As Long
        hszSvc As Long
        hszTopic As Long
        hConvClient As Long        '  Globally unique value != apps local hConv
        hConvServer As Long        '  Globally unique value != apps local hConv
End Type

Public Const MAX_MONITORS = 4
Public Const APPCLASS_MONITOR = &H1&
Public Const XTYP_MONITOR = (&HF0 Or XCLASS_NOTIFICATION Or XTYPF_NOBLOCK)

' Callback filter flags for use with MONITOR apps - 0 implies no monitor callbacks
Public Const MF_HSZ_INFO = &H1000000
Public Const MF_SENDMSGS = &H2000000
Public Const MF_POSTMSGS = &H4000000
Public Const MF_CALLBACKS = &H8000000
Public Const MF_ERRORS = &H10000000
Public Const MF_LINKS = &H20000000
Public Const MF_CONV = &H40000000

Public Const MF_MASK = &HFF000000
#1038

' Listbox Return Values
Public Const LB_OKAY = 0
Public Const LB_ERR = (-1)
Public Const LB_ERRSPACE = (-2)

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

' Listbox Notification Codes
Public Const LBN_ERRSPACE = (-2)
Public Const LBN_SELCHANGE = 1
Public Const LBN_DBLCLK = 2
Public Const LBN_SELCANCEL = 3
Public Const LBN_SETFOCUS = 4
Public Const LBN_KILLFOCUS = 5

' Listbox messages
Public Const LB_ADDSTRING = &H180
Public Const LB_INSERTSTRING = &H181
Public Const LB_DELETESTRING = &H182
Public Const LB_SELITEMRANGEEX = &H183
Public Const LB_RESETCONTENT = &H184
Public Const LB_SETSEL = &H185
Public Const LB_SETCURSEL = &H186
Public Const LB_GETSEL = &H187
Public Const LB_GETCURSEL = &H188
Public Const LB_GETTEXT = &H189
Public Const LB_GETTEXTLEN = &H18A
Public Const LB_GETCOUNT = &H18B
Public Const LB_SELECTSTRING = &H18C
Public Const LB_DIR = &H18D
Public Const LB_GETTOPINDEX = &H18E
Public Const LB_FINDSTRING = &H18F
Public Const LB_GETSELCOUNT = &H190
Public Const LB_GETSELITEMS = &H191
Public Const LB_SETTABSTOPS = &H192
Public Const LB_GETHORIZONTALEXTENT = &H193
Public Const LB_SETHORIZONTALEXTENT = &H194
Public Const LB_SETCOLUMNWIDTH = &H195
Public Const LB_ADDFILE = &H196
Public Const LB_SETTOPINDEX = &H197
Public Const LB_GETITEMRECT = &H198
Public Const LB_GETITEMDATA = &H199
Public Const LB_SETITEMDATA = &H19A
Public Const LB_SELITEMRANGE = &H19B
Public Const LB_SETANCHORINDEX = &H19C
Public Const LB_GETANCHORINDEX = &H19D
Public Const LB_SETCARETINDEX = &H19E
Public Const LB_GETCARETINDEX = &H19F
Public Const LB_SETITEMHEIGHT = &H1A0
Public Const LB_GETITEMHEIGHT = &H1A1
Public Const LB_FINDSTRINGEXACT = &H1A2
Public Const LB_SETLOCALE = &H1A5
Public Const LB_GETLOCALE = &H1A6
Public Const LB_SETCOUNT = &H1A7
Public Const LB_MSGMAX = &H1A8

' Listbox Styles
Public Const LBS_NOTIFY = &H1&
Public Const LBS_SORT = &H2&
Public Const LBS_NOREDRAW = &H4&
Public Const LBS_MULTIPLESEL = &H8&
Public Const LBS_OWNERDRAWFIXED = &H10&
Public Const LBS_OWNERDRAWVARIABLE = &H20&
Public Const LBS_HASSTRINGS = &H40&
Public Const LBS_USETABSTOPS = &H80&
Public Const LBS_NOINTEGRALHEIGHT = &H100&
Public Const LBS_MULTICOLUMN = &H200&
Public Const LBS_WANTKEYBOARDINPUT = &H400&
Public Const LBS_EXTENDEDSEL = &H800&
Public Const LBS_DISABLENOSCROLL = &H1000&
Public Const LBS_NODATA = &H2000&
Public Const LBS_STANDARD = (LBS_NOTIFY Or LBS_SORT Or WS_VSCROLL Or WS_BORDER)

' Combo Box return Values
Public Const CB_OKAY = 0
Public Const CB_ERR = (-1)
Public Const CB_ERRSPACE = (-2)

' Combo Box Notification Codes
Public Const CBN_ERRSPACE = (-1)
Public Const CBN_SELCHANGE = 1
Public Const CBN_DBLCLK = 2
Public Const CBN_SETFOCUS = 3
Public Const CBN_KILLFOCUS = 4
Public Const CBN_EDITCHANGE = 5
Public Const CBN_EDITUPDATE = 6
Public Const CBN_DROPDOWN = 7
Public Const CBN_CLOSEUP = 8
Public Const CBN_SELENDOK = 9
Public Const CBN_SELENDCANCEL = 10

' Combo Box styles
Public Const CBS_SIMPLE = &H1&
Public Const CBS_DROPDOWN = &H2&
Public Const CBS_DROPDOWNLIST = &H3&
Public Const CBS_OWNERDRAWFIXED = &H10&
Public Const CBS_OWNERDRAWVARIABLE = &H20&
Public Const CBS_AUTOHSCROLL = &H40&
Public Const CBS_OEMCONVERT = &H80&
Public Const CBS_SORT = &H100&
Public Const CBS_HASSTRINGS = &H200&
Public Const CBS_NOINTEGRALHEIGHT = &H400&
Public Const CBS_DISABLENOSCROLL = &H800&

' Combo Box messages
Public Const CB_GETEDITSEL = &H140
Public Const CB_LIMITTEXT = &H141
Public Const CB_SETEDITSEL = &H142
Public Const CB_ADDSTRING = &H143
Public Const CB_DELETESTRING = &H144
Public Const CB_DIR = &H145
Public Const CB_GETCOUNT = &H146
Public Const CB_GETCURSEL = &H147
Public Const CB_GETLBTEXT = &H148
Public Const CB_GETLBTEXTLEN = &H149
Public Const CB_INSERTSTRING = &H14A
Public Const CB_RESETCONTENT = &H14B
Public Const CB_FINDSTRING = &H14C
Public Const CB_SELECTSTRING = &H14D
Public Const CB_SETCURSEL = &H14E
Public Const CB_SHOWDROPDOWN = &H14F
Public Const CB_GETITEMDATA = &H150
Public Const CB_SETITEMDATA = &H151
Public Const CB_GETDROPPEDCONTROLRECT = &H152
Public Const CB_SETITEMHEIGHT = &H153
Public Const CB_GETITEMHEIGHT = &H154
Public Const CB_SETEXTENDEDUI = &H155
Public Const CB_GETEXTENDEDUI = &H156
Public Const CB_GETDROPPEDSTATE = &H157
Public Const CB_FINDSTRINGEXACT = &H158
Public Const CB_SETLOCALE = &H159
Public Const CB_GETLOCALE = &H15A
Public Const CB_MSGMAX = &H15B

' Scroll Bar Styles
Public Const SBS_HORZ = &H0&
Public Const SBS_VERT = &H1&
Public Const SBS_TOPALIGN = &H2&
Public Const SBS_LEFTALIGN = &H2&
Public Const SBS_BOTTOMALIGN = &H4&
Public Const SBS_RIGHTALIGN = &H4&
Public Const SBS_SIZEBOXTOPLEFTALIGN = &H2&
Public Const SBS_SIZEBOXBOTTOMRIGHTALIGN = &H4&
Public Const SBS_SIZEBOX = &H8&

'  Scroll bar messages
Public Const SBM_SETPOS = &HE0 ' not in win3.1
Public Const SBM_GETPOS = &HE1 ' not in win3.1
Public Const SBM_SETRANGE = &HE2 ' not in win3.1
Public Const SBM_SETRANGEREDRAW = &HE6 ' not in win3.1
Public Const SBM_GETRANGE = &HE3 ' not in win3.1
Public Const SBM_ENABLE_ARROWS = &HE4 ' not in win3.1

Public Const MDIS_ALLCHILDSTYLES = &H1

' wParam values for WM_MDITILE and WM_MDICASCADE messages.
Public Const MDITILE_VERTICAL = &H0
Public Const MDITILE_HORIZONTAL = &H1
Public Const MDITILE_SKIPDISABLED = &H2

Type MDICREATESTRUCT
        szClass As String
        szTitle As String
        hOwner As Long
        x As Long
        y As Long
        cx As Long
        cy As Long
        style As Long
        lParam As Long
End Type

Type CLIENTCREATESTRUCT
        hWindowMenu As Long
        idFirstChild As Long
End Type

Declare Function DefFrameProc Lib "user32" Alias "DefFrameProcA" (ByVal hwnd As Long, ByVal hWndMDIClient As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function DefMDIChildProc Lib "user32" Alias "DefMDIChildProcA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Declare Function TranslateMDISysAccel Lib "user32" Alias "TranslateMDISysAccel" (ByVal hWndClient As Long, lpMsg As MSG) As Long

Declare Function ArrangeIconicWindows Lib "user32" Alias "ArrangeIconicWindows" (ByVal hwnd As Long) As Long

Declare Function CreateMDIWindow Lib "user32" Alias "CreateMDIWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hInstance As Long, ByVal lParam As Long) As Long

'  Help engine section.

Type MULTIKEYHELP
        mkSize As Long
        mkKeylist As Byte
        szKeyphrase As String * 253 ' Array length is arbitrary; may be changed
End Type

Type HELPWININFO
        wStructSize As Long
        x As Long
        y As Long
        dx As Long
        dy As Long
        wMax As Long
        rgchMember As String * 2
End Type

' Commands to pass WinHelp()
Public Const HELP_CONTEXT = &H1          '  Display topic in ulTopic
Public Const HELP_QUIT = &H2             '  Terminate help
Public Const HELP_INDEX = &H3            '  Display index
Public Const HELP_CONTENTS = &H3&
Public Const HELP_HELPONHELP = &H4       '  Display help on using help
Public Const HELP_SETINDEX = &H5         '  Set current Index for multi index help
Public Const HELP_SETCONTENTS = &H5&
Public Const HELP_CONTEXTPOPUP = &H8&
Public Const HELP_FORCEFILE = &H9&
Public Const HELP_KEY = &H101            '  Display topic for keyword in offabData
Public Const HELP_COMMAND = &H102&
Public Const HELP_PARTIALKEY = &H105&
Public Const HELP_MULTIKEY = &H201&
Public Const HELP_SETWINPOS = &H203&

Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long

' Parameter for SystemParametersInfo()
Public Const SPI_GETBEEP = 1
Public Const SPI_SETBEEP = 2
Public Const SPI_GETMOUSE = 3
Public Const SPI_SETMOUSE = 4
Public Const SPI_GETBORDER = 5
Public Const SPI_SETBORDER = 6
Public Const SPI_GETKEYBOARDSPEED = 10
Public Const SPI_SETKEYBOARDSPEED = 11
Public Const SPI_LANGDRIVER = 12
Public Const SPI_ICONHORIZONTALSPACING = 13
Public Const SPI_GETSCREENSAVETIMEOUT = 14
Public Const SPI_SETSCREENSAVETIMEOUT = 15
Public Const SPI_GETSCREENSAVEACTIVE = 16
Public Const SPI_SETSCREENSAVEACTIVE = 17
Public Const SPI_GETGRIDGRANULARITY = 18
Public Const SPI_SETGRIDGRANULARITY = 19
Public Const SPI_SETDESKWALLPAPER = 20
Public Const SPI_SETDESKPATTERN = 21
Public Const SPI_GETKEYBOARDDELAY = 22
Public Const SPI_SETKEYBOARDDELAY = 23
Public Const SPI_ICONVERTICALSPACING = 24
Public Const SPI_GETICONTITLEWRAP = 25
Public Const SPI_SETICONTITLEWRAP = 26
Public Const SPI_GETMENUDROPALIGNMENT = 27
Public Const SPI_SETMENUDROPALIGNMENT = 28
Public Const SPI_SETDOUBLECLKWIDTH = 29
Public Const SPI_SETDOUBLECLKHEIGHT = 30
Public Const SPI_GETICONTITLELOGFONT = 31
Public Const SPI_SETDOUBLECLICKTIME = 32
Public Const SPI_SETMOUSEBUTTONSWAP = 33
Public Const SPI_SETICONTITLELOGFONT = 34
Public Const SPI_GETFASTTASKSWITCH = 35
Public Const SPI_SETFASTTASKSWITCH = 36
Public Const SPI_SETDRAGFULLWINDOWS = 37
Public Const SPI_GETDRAGFULLWINDOWS = 38
Public Const SPI_GETNONCLIENTMETRICS = 41
Public Const SPI_SETNONCLIENTMETRICS = 42
Public Const SPI_GETMINIMIZEDMETRICS = 43
Public Const SPI_SETMINIMIZEDMETRICS = 44
Public Const SPI_GETICONMETRICS = 45
Public Const SPI_SETICONMETRICS = 46
Public Const SPI_SETWORKAREA = 47
Public Const SPI_GETWORKAREA = 48
Public Const SPI_SETPENWINDOWS = 49
Public Const SPI_GETFILTERKEYS = 50
Public Const SPI_SETFILTERKEYS = 51
Public Const SPI_GETTOGGLEKEYS = 52
Public Const SPI_SETTOGGLEKEYS = 53
Public Const SPI_GETMOUSEKEYS = 54
Public Const SPI_SETMOUSEKEYS = 55
Public Const SPI_GETSHOWSOUNDS = 56
Public Const SPI_SETSHOWSOUNDS = 57
Public Const SPI_GETSTICKYKEYS = 58
Public Const SPI_SETSTICKYKEYS = 59
Public Const SPI_GETACCESSTIMEOUT = 60
Public Const SPI_SETACCESSTIMEOUT = 61
Public Const SPI_GETSERIALKEYS = 62
Public Const SPI_SETSERIALKEYS = 63
Public Const SPI_GETSOUNDSENTRY = 64
Public Const SPI_SETSOUNDSENTRY = 65
Public Const SPI_GETHIGHCONTRAST = 66
Public Const SPI_SETHIGHCONTRAST = 67
Public Const SPI_GETKEYBOARDPREF = 68
Public Const SPI_SETKEYBOARDPREF = 69
Public Const SPI_GETSCREENREADER = 70
Public Const SPI_SETSCREENREADER = 71
Public Const SPI_GETANIMATION = 72
Public Const SPI_SETANIMATION = 73
Public Const SPI_GETFONTSMOOTHING = 74
Public Const SPI_SETFONTSMOOTHING = 75
Public Const SPI_SETDRAGWIDTH = 76
Public Const SPI_SETDRAGHEIGHT = 77
Public Const SPI_SETHANDHELD = 78
Public Const SPI_GETLOWPOWERTIMEOUT = 79
Public Const SPI_GETPOWEROFFTIMEOUT = 80
Public Const SPI_SETLOWPOWERTIMEOUT = 81
Public Const SPI_SETPOWEROFFTIMEOUT = 82
Public Const SPI_GETLOWPOWERACTIVE = 83
Public Const SPI_GETPOWEROFFACTIVE = 84
Public Const SPI_SETLOWPOWERACTIVE = 85
Public Const SPI_SETPOWEROFFACTIVE = 86
Public Const SPI_SETCURSORS = 87
Public Const SPI_SETICONS = 88
Public Const SPI_GETDEFAULTINPUTLANG = 89
Public Const SPI_SETDEFAULTINPUTLANG = 90
Public Const SPI_SETLANGTOGGLE = 91
Public Const SPI_GETWINDOWSEXTENSION = 92
Public Const SPI_SETMOUSETRAILS = 93
Public Const SPI_GETMOUSETRAILS = 94
Public Const SPI_SCREENSAVERRUNNING = 97

' SystemParametersInfo flags
Public Const SPIF_UPDATEINIFILE = &H1
Public Const SPIF_SENDWININICHANGE = &H2

Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long

'  DDE window messages
Public Const WM_DDE_FIRST = &H3E0
Public Const WM_DDE_INITIATE = (WM_DDE_FIRST)
Public Const WM_DDE_TERMINATE = (WM_DDE_FIRST + 1)
Public Const WM_DDE_ADVISE = (WM_DDE_FIRST + 2)
Public Const WM_DDE_UNADVISE = (WM_DDE_FIRST + 3)
Public Const WM_DDE_ACK = (WM_DDE_FIRST + 4)
Public Const WM_DDE_DATA = (WM_DDE_FIRST + 5)
Public Const WM_DDE_REQUEST = (WM_DDE_FIRST + 6)
Public Const WM_DDE_POKE = (WM_DDE_FIRST + 7)
Public Const WM_DDE_EXECUTE = (WM_DDE_FIRST + 8)
Public Const WM_DDE_LAST = (WM_DDE_FIRST + 8)
#1039

' GetWindow() Constants
Public Const GW_HWNDFIRST = 0
Public Const GW_HWNDLAST = 1
Public Const GW_HWNDNEXT = 2
Public Const GW_HWNDPREV = 3
Public Const GW_OWNER = 4
Public Const GW_CHILD = 5
Public Const GW_MAX = 5

Declare Function GetWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Declare Function UnhookWindowsHookEx Lib "user32" Alias "UnhookWindowsHookEx" (ByVal hHook As Long) As Long
Declare Function CallNextHookEx Lib "user32" Alias "CallNextHookEx" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long

' Menu flags for Add/Check/EnableMenuItem()
Public Const MF_INSERT = &H0&
Public Const MF_CHANGE = &H80&
Public Const MF_APPEND = &H100&
Public Const MF_DELETE = &H200&
Public Const MF_REMOVE = &H1000&

Public Const MF_BYCOMMAND = &H0&
Public Const MF_BYPOSITION = &H400&

Public Const MF_SEPARATOR = &H800&

Public Const MF_ENABLED = &H0&
Public Const MF_GRAYED = &H1&
Public Const MF_DISABLED = &H2&

Public Const MF_UNCHECKED = &H0&
Public Const MF_CHECKED = &H8&
Public Const MF_USECHECKBITMAPS = &H200&

Public Const MF_STRING = &H0&
Public Const MF_BITMAP = &H4&
Public Const MF_OWNERDRAW = &H100&

Public Const MF_POPUP = &H10&
Public Const MF_MENUBARBREAK = &H20&
Public Const MF_MENUBREAK = &H40&

Public Const MF_UNHILITE = &H0&
Public Const MF_HILITE = &H80&

Public Const MF_SYSMENU = &H2000&
Public Const MF_HELP = &H4000&
Public Const MF_MOUSESELECT = &H8000&

' Menu item resource format
Type MENUITEMTEMPLATEHEADER
        versionNumber As Integer
        offset As Integer
End Type

Type MENUITEMTEMPLATE
        mtOption As Integer
        mtID As Integer
        mtString As Byte
End Type

Public Const MF_END = &H80

' System Menu Command Values
Public Const SC_SIZE = &HF000
Public Const SC_MOVE = &HF010
Public Const SC_MINIMIZE = &HF020
Public Const SC_MAXIMIZE = &HF030
Public Const SC_NEXTWINDOW = &HF040
Public Const SC_PREVWINDOW = &HF050
Public Const SC_CLOSE = &HF060
Public Const SC_VSCROLL = &HF070
Public Const SC_HSCROLL = &HF080
Public Const SC_MOUSEMENU = &HF090
Public Const SC_KEYMENU = &HF100
Public Const SC_ARRANGE = &HF110
Public Const SC_RESTORE = &HF120
Public Const SC_TASKLIST = &HF130
Public Const SC_SCREENSAVE = &HF140
Public Const SC_HOTKEY = &HF150

' Obsolete names
Public Const SC_ICON = SC_MINIMIZE
Public Const SC_ZOOM = SC_MAXIMIZE

' Resource Loading Routines
Declare Function LoadBitmap Lib "user32" Alias "LoadBitmapA" (ByVal hInstance As Long, ByVal lpBitmapName As String) As Long
Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As String) As Long
Declare Function CreateCursor Lib "user32" Alias "CreateCursor" (ByVal hInstance As Long, ByVal nXhotspot As Long, ByVal nYhotspot As Long, ByVal nWidth As Long, ByVal nHeight As Long, lpANDbitPlane As Any, lpXORbitPlane As Any) As Long
Declare Function DestroyCursor Lib "user32" Alias "DestroyCursor" (ByVal hCursor As Long) As Long
Declare Function CopyCursor Lib "user32" Alias "CopyCursor" (ByVal hcur As Long) As Long

' Standard Cursor IDs
Public Const IDC_ARROW = 32512&
Public Const IDC_IBEAM = 32513&
Public Const IDC_WAIT = 32514&
Public Const IDC_CROSS = 32515&
Public Const IDC_UPARROW = 32516&
Public Const IDC_SIZE = 32640&
Public Const IDC_ICON = 32641&
Public Const IDC_SIZENWSE = 32642&
Public Const IDC_SIZENESW = 32643&
Public Const IDC_SIZEWE = 32644&
Public Const IDC_SIZENS = 32645&
Public Const IDC_SIZEALL = 32646&
Public Const IDC_NO = 32648&
Public Const IDC_APPSTARTING = 32650&

Type ICONINFO
        fIcon As Long
        xHotspot As Long
        yHotspot As Long
        hbmMask As Long
        hbmColor As Long
End Type

Declare Function LoadIcon Lib "user32" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As String) As Long
Declare Function CreateIcon Lib "user32" Alias "CreateIcon" (ByVal hInstance As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Byte, ByVal nBitsPixel As Byte, lpANDbits As Byte, lpXORbits As Byte) As Long
Declare Function DestroyIcon Lib "user32" Alias "DestroyIcon" (ByVal hIcon As Long) As Long
Declare Function LookupIconIdFromDirectory Lib "user32" Alias "LookupIconIdFromDirectory" (presbits As Byte, ByVal fIcon As Long) As Long
Declare Function CreateIconFromResource Lib "user32" Alias "CreateIconFromResource" (presbits As Byte, ByVal dwResSize As Long, ByVal fIcon As Long, ByVal dwVer As Long) As Long
Declare Function CreateIconIndirect Lib "user32" Alias "CreateIconIndirect" (piconinfo As ICONINFO) As Long
Declare Function CopyIcon Lib "user32" Alias "CopyIcon" (ByVal hIcon As Long) As Long
Declare Function GetIconInfo Lib "user32" Alias "GetIconInfo" (ByVal hIcon As Long, piconinfo As ICONINFO) As Long

' OEM Resource Ordinal Numbers
Public Const OBM_CLOSE = 32754
Public Const OBM_UPARROW = 32753
Public Const OBM_DNARROW = 32752
Public Const OBM_RGARROW = 32751
Public Const OBM_LFARROW = 32750
Public Const OBM_REDUCE = 32749
Public Const OBM_ZOOM = 32748
Public Const OBM_RESTORE = 32747
Public Const OBM_REDUCED = 32746
Public Const OBM_ZOOMD = 32745
Public Const OBM_RESTORED = 32744
Public Const OBM_UPARROWD = 32743
Public Const OBM_DNARROWD = 32742
Public Const OBM_RGARROWD = 32741
Public Const OBM_LFARROWD = 32740
Public Const OBM_MNARROW = 32739
Public Const OBM_COMBO = 32738
Public Const OBM_UPARROWI = 32737
Public Const OBM_DNARROWI = 32736
Public Const OBM_RGARROWI = 32735
Public Const OBM_LFARROWI = 32734

Public Const OBM_OLD_CLOSE = 32767
Public Const OBM_SIZE = 32766
Public Const OBM_OLD_UPARROW = 32765
Public Const OBM_OLD_DNARROW = 32764
Public Const OBM_OLD_RGARROW = 32763
Public Const OBM_OLD_LFARROW = 32762
Public Const OBM_BTSIZE = 32761
Public Const OBM_CHECK = 32760
Public Const OBM_CHECKBOXES = 32759
Public Const OBM_BTNCORNERS = 32758
Public Const OBM_OLD_REDUCE = 32757
Public Const OBM_OLD_ZOOM = 32756
Public Const OBM_OLD_RESTORE = 32755

Public Const OCR_NORMAL = 32512
Public Const OCR_IBEAM = 32513
Public Const OCR_WAIT = 32514
Public Const OCR_CROSS = 32515
Public Const OCR_UP = 32516
Public Const OCR_SIZE = 32640
Public Const OCR_ICON = 32641
Public Const OCR_SIZENWSE = 32642
Public Const OCR_SIZENESW = 32643
Public Const OCR_SIZEWE = 32644
Public Const OCR_SIZENS = 32645
Public Const OCR_SIZEALL = 32646
Public Const OCR_ICOCUR = 32647
Public Const OCR_NO = 32648 ' not in win3.1

Public Const OIC_SAMPLE = 32512
Public Const OIC_HAND = 32513
Public Const OIC_QUES = 32514
Public Const OIC_BANG = 32515
Public Const OIC_NOTE = 32516

Public Const ORD_LANGDRIVER = 1 '  The ordinal number for the entry point of
                                '  language drivers.

' Standard Icon IDs
Public Const IDI_APPLICATION = 32512&
Public Const IDI_HAND = 32513&
Public Const IDI_QUESTION = 32514&
Public Const IDI_EXCLAMATION = 32515&
Public Const IDI_ASTERISK = 32516&

Declare Function LoadString Lib "user32" Alias "LoadStringA" (ByVal hInstance As Long, ByVal wID As Long, ByVal lpBuffer As String, ByVal nBufferMax As Long) As Long

' Dialog Box Command IDs
Public Const IDOK = 1
Public Const IDCANCEL = 2
Public Const IDABORT = 3
Public Const IDRETRY = 4
Public Const IDIGNORE = 5
Public Const IDYES = 6
Public Const IDNO = 7

' Control Manager Structures and Definitions

' Edit Control Styles
Public Const ES_LEFT = &H0&
Public Const ES_CENTER = &H1&
Public Const ES_RIGHT = &H2&
Public Const ES_MULTILINE = &H4&
Public Const ES_UPPERCASE = &H8&
Public Const ES_LOWERCASE = &H10&
Public Const ES_PASSWORD = &H20&
Public Const ES_AUTOVSCROLL = &H40&
Public Const ES_AUTOHSCROLL = &H80&
Public Const ES_NOHIDESEL = &H100&
Public Const ES_OEMCONVERT = &H400&
Public Const ES_READONLY = &H800&
Public Const ES_WANTRETURN = &H1000&

' Edit Control Notification Codes
Public Const EN_SETFOCUS = &H100
Public Const EN_KILLFOCUS = &H200
Public Const EN_CHANGE = &H300
Public Const EN_UPDATE = &H400
Public Const EN_ERRSPACE = &H500
Public Const EN_MAXTEXT = &H501
Public Const EN_HSCROLL = &H601
Public Const EN_VSCROLL = &H602

' Edit Control Messages
Public Const EM_GETSEL = &HB0
Public Const EM_SETSEL = &HB1
Public Const EM_GETRECT = &HB2
Public Const EM_SETRECT = &HB3
Public Const EM_SETRECTNP = &HB4
Public Const EM_SCROLL = &HB5
Public Const EM_LINESCROLL = &HB6
Public Const EM_SCROLLCARET = &HB7
Public Const EM_GETMODIFY = &HB8
Public Const EM_SETMODIFY = &HB9
Public Const EM_GETLINECOUNT = &HBA
Public Const EM_LINEINDEX = &HBB
Public Const EM_SETHANDLE = &HBC
Public Const EM_GETHANDLE = &HBD
Public Const EM_GETTHUMB = &HBE
Public Const EM_LINELENGTH = &HC1
Public Const EM_REPLACESEL = &HC2
Public Const EM_GETLINE = &HC4
Public Const EM_LIMITTEXT = &HC5
Public Const EM_CANUNDO = &HC6
Public Const EM_UNDO = &HC7
Public Const EM_FMTLINES = &HC8
Public Const EM_LINEFROMCHAR = &HC9
Public Const EM_SETTABSTOPS = &HCB
Public Const EM_SETPASSWORDCHAR = &HCC
Public Const EM_EMPTYUNDOBUFFER = &HCD
Public Const EM_GETFIRSTVISIBLELINE = &HCE
Public Const EM_SETREADONLY = &HCF
Public Const EM_SETWORDBREAKPROC = &HD0
Public Const EM_GETWORDBREAKPROC = &HD1
Public Const EM_GETPASSWORDCHAR = &HD2

' EDITWORDBREAKPROC code values
Public Const WB_LEFT = 0
Public Const WB_RIGHT = 1
Public Const WB_ISDELIMITER = 2

' Button Control Styles
Public Const BS_PUSHBUTTON = &H0&
Public Const BS_DEFPUSHBUTTON = &H1&
Public Const BS_CHECKBOX = &H2&
Public Const BS_AUTOCHECKBOX = &H3&
Public Const BS_RADIOBUTTON = &H4&
Public Const BS_3STATE = &H5&
Public Const BS_AUTO3STATE = &H6&
Public Const BS_GROUPBOX = &H7&
Public Const BS_USERBUTTON = &H8&
Public Const BS_AUTORADIOBUTTON = &H9&
Public Const BS_OWNERDRAW = &HB&
Public Const BS_LEFTTEXT = &H20&

' User Button Notification Codes
Public Const BN_CLICKED = 0
Public Const BN_PAINT = 1
Public Const BN_HILITE = 2
Public Const BN_UNHILITE = 3
Public Const BN_DISABLE = 4
Public Const BN_DOUBLECLICKED = 5

' Button Control Messages
Public Const BM_GETCHECK = &HF0
Public Const BM_SETCHECK = &HF1
Public Const BM_GETSTATE = &HF2
Public Const BM_SETSTATE = &HF3
Public Const BM_SETSTYLE = &HF4

' Static Control Constants
Public Const SS_LEFT = &H0&
Public Const SS_CENTER = &H1&
Public Const SS_RIGHT = &H2&
Public Const SS_ICON = &H3&
Public Const SS_BLACKRECT = &H4&
Public Const SS_GRAYRECT = &H5&
Public Const SS_WHITERECT = &H6&
Public Const SS_BLACKFRAME = &H7&
Public Const SS_GRAYFRAME = &H8&
Public Const SS_WHITEFRAME = &H9&
Public Const SS_USERITEM = &HA&
Public Const SS_SIMPLE = &HB&
Public Const SS_LEFTNOWORDWRAP = &HC&
Public Const SS_NOPREFIX = &H80           '  Don't do "&" character translation

' Static Control Mesages
Public Const STM_SETICON = &H170
Public Const STM_GETICON = &H171
Public Const STM_MSGMAX = &H172

Public Const WC_DIALOG = 8002&

'  Get/SetWindowWord/Long offsets for use with WC_DIALOG windows
Public Const DWL_MSGRESULT = 0
Public Const DWL_DLGPROC = 4
Public Const DWL_USER = 8

' Dialog Manager Routines
Declare Function IsDialogMessage Lib "user32" Alias "IsDialogMessageA" (ByVal hDlg As Long, lpMsg As MSG) As Long
Declare Function MapDialogRect Lib "user32" Alias "MapDialogRect" (ByVal hDlg As Long, lpRect As RECT) As Long
Declare Function DlgDirList Lib "user32" Alias "DlgDirListA" (ByVal hDlg As Long, ByVal lpPathSpec As String, ByVal nIDListBox As Long, ByVal nIDStaticPath As Long, ByVal wFileType As Long) As Long

' DlgDirList, DlgDirListComboBox flags values
Public Const DDL_READWRITE = &H0
Public Const DDL_READONLY = &H1
Public Const DDL_HIDDEN = &H2
Public Const DDL_SYSTEM = &H4
Public Const DDL_DIRECTORY = &H10
Public Const DDL_ARCHIVE = &H20

Public Const DDL_POSTMSGS = &H2000
Public Const DDL_DRIVES = &H4000
Public Const DDL_EXCLUSIVE = &H8000

Declare Function DlgDirSelectEx Lib "user32" Alias "DlgDirSelectExA" (ByVal hWndDlg As Long, ByVal lpszPath As String, ByVal cbPath As Long, ByVal idListBox As Long) As Long
Declare Function DlgDirListComboBox Lib "user32" Alias "DlgDirListComboBoxA" (ByVal hDlg As Long, ByVal lpPathSpec As String, ByVal nIDComboBox As Long, ByVal nIDStaticPath As Long, ByVal wFileType As Long) As Long
Declare Function DlgDirSelectComboBoxEx Lib "user32" Alias "DlgDirSelectComboBoxExA" (ByVal hWndDlg As Long, ByVal lpszPath As String, ByVal cbPath As Long, ByVal idComboBox As Long) As Long

' Dialog Styles
Public Const DS_ABSALIGN = &H1&
Public Const DS_SYSMODAL = &H2&
Public Const DS_LOCALEDIT = &H20          '  Edit items get Local storage.
Public Const DS_SETFONT = &H40            '  User specified font for Dlg controls
Public Const DS_MODALFRAME = &H80         '  Can be combined with WS_CAPTION
Public Const DS_NOIDLEMSG = &H100         '  WM_ENTERIDLE message will not be sent
Public Const DS_SETFOREGROUND = &H200     '  not in win3.1

Public Const DM_GETDEFID = WM_USER + 0
Public Const DM_SETDEFID = WM_USER + 1
Public Const DC_HASDEFID = &H534      '0x534B

' Dialog Codes
Public Const DLGC_WANTARROWS = &H1              '  Control wants arrow keys
Public Const DLGC_WANTTAB = &H2                 '  Control wants tab keys
Public Const DLGC_WANTALLKEYS = &H4             '  Control wants all keys
Public Const DLGC_WANTMESSAGE = &H4             '  Pass message to control
Public Const DLGC_HASSETSEL = &H8               '  Understands EM_SETSEL message
Public Const DLGC_DEFPUSHBUTTON = &H10          '  Default pushbutton
Public Const DLGC_UNDEFPUSHBUTTON = &H20        '  Non-default pushbutton
Public Const DLGC_RADIOBUTTON = &H40            '  Radio button
Public Const DLGC_WANTCHARS = &H80              '  Want WM_CHAR messages
Public Const DLGC_STATIC = &H100                '  Static item: don't include
Public Const DLGC_BUTTON = &H2000               '  Button item: can be checked

Public Const LB_CTLCODE = 0&
#1040

Declare Function ExitWindows Lib "user32" Alias "ExitWindows" (ByVal dwReserved As Long, ByVal uReturnCode As Long) As Long
Declare Function ExitWindowsEx Lib "user32" Alias "ExitWindowsEx" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long

Declare Function SwapMouseButton Lib "user32" Alias "SwapMouseButton" (ByVal bSwap As Long) As Long
Declare Function GetMessagePos Lib "user32" Alias "GetMessagePos" () As Long
Declare Function GetMessageTime Lib "user32" Alias "GetMessageTime" () As Long
Declare Function GetMessageExtraInfo Lib "user32" Alias "GetMessageExtraInfo" () As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function SendMessageTimeout Lib "user32" Alias "SendMessageTimeoutA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal fuFlags As Long, ByVal uTimeout As Long, lpdwResult As Long) As Long
Declare Function SendNotifyMessage Lib "user32" Alias "SendNotifyMessageA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function SendMessageCallback Lib "user32" Alias "SendMessageCallbackA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal lpResultCallBack As Long, ByVal dwData As Long) As Long
Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function PostThreadMessage Lib "user32" Alias "PostThreadMessageA" (ByVal idThread As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

' Special HWND value for use with PostMessage and SendMessage
Public Const HWND_BROADCAST = &HFFFF&


Type WNDCLASS
    style As Long
    lpfnwndproc As Long
    cbClsextra As Long
    cbWndExtra2 As Long
    hInstance As Long
    hIcon As Long
    hCursor As Long
    hbrBackground As Long
    lpszMenuName As String
    lpszClassName As String
End Type

Declare Function AttachThreadInput Lib "user32" Alias "AttachThreadInput" (ByVal idAttach As Long, ByVal idAttachTo As Long, ByVal fAttach As Long) As Long
Declare Function ReplyMessage Lib "user32" Alias "ReplyMessage" (ByVal lReply As Long) As Long
Declare Function WaitMessage Lib "user32" Alias "WaitMessage" () As Long
Declare Function WaitForInputIdle Lib "user32" Alias "WaitForInputIdle" (ByVal hProcess As Long, ByVal dwMilliseconds As Long) As Long
Declare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Sub PostQuitMessage Lib "user32" Alias "PostQuitMessage" (ByVal nExitCode As Long)
Declare Function InSendMessage Lib "user32" Alias "InSendMessage" () As Long

Declare Function GetDoubleClickTime Lib "user32" Alias "GetDoubleClickTime" () As Long
Declare Function SetDoubleClickTime Lib "user32" Alias "SetDoubleClickTime" (ByVal wCount As Long) As Long
Declare Function RegisterClass Lib "user32" Alias "RegisterClassA" (Class As WNDCLASS) As Long
Declare Function UnregisterClass Lib "user32" Alias "UnregisterClassA" (ByVal lpClassName As String, ByVal hInstance As Long) As Long
Declare Function GetClassInfo Lib "user32" Alias "GetClassInfoA" (ByVal hInstance As Long, ByVal lpClassName As String, lpWndClass As WNDCLASS) As Long

Public Const CW_USEDEFAULT = &H80000000
Public Const HWND_DESKTOP = 0

Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Declare Function IsWindow Lib "user32" Alias "IsWindow" (ByVal hwnd As Long) As Long
Declare Function IsMenu Lib "user32" Alias "IsMenu" (ByVal hMenu As Long) As Long
Declare Function IsChild Lib "user32" Alias "IsChild" (ByVal hWndParent As Long, ByVal hwnd As Long) As Long
Declare Function DestroyWindow Lib "user32" Alias "DestroyWindow" (ByVal hwnd As Long) As Long

Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Declare Function FlashWindow Lib "user32" Alias "FlashWindow" (ByVal hwnd As Long, ByVal bInvert As Long) As Long
Declare Function ShowOwnedPopups Lib "user32" Alias "ShowOwnedPopups" (ByVal hwnd As Long, ByVal fShow As Long) As Long

Declare Function OpenIcon Lib "user32" Alias "OpenIcon" (ByVal hwnd As Long) As Long
Declare Function CloseWindow Lib "user32" Alias "CloseWindow" (ByVal hwnd As Long) As Long
Declare Function MoveWindow Lib "user32" Alias "MoveWindow" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Declare Function GetWindowPlacement Lib "user32" Alias "GetWindowPlacement" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
Declare Function SetWindowPlacement Lib "user32" Alias "SetWindowPlacement" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long

Declare Function BeginDeferWindowPos Lib "user32" Alias "BeginDeferWindowPos" (ByVal nNumWindows As Long) As Long
Declare Function DeferWindowPos Lib "user32" Alias "DeferWindowPos" (ByVal hWinPosInfo As Long, ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Declare Function EndDeferWindowPos Lib "user32" Alias "EndDeferWindowPos" (ByVal hWinPosInfo As Long) As Long

Declare Function IsWindowVisible Lib "user32" Alias "IsWindowVisible" (ByVal hwnd As Long) As Long
Declare Function IsIconic Lib "user32" Alias "IsIconic" (ByVal hwnd As Long) As Long
Declare Function AnyPopup Lib "user32" Alias "AnyPopup" () As Long
Declare Function BringWindowToTop Lib "user32" Alias "BringWindowToTop" (ByVal hwnd As Long) As Long
Declare Function IsZoomed Lib "user32" Alias "IsZoomed" (ByVal hwnd As Long) As Long

' SetWindowPos Flags
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOZORDER = &H4
Public Const SWP_NOREDRAW = &H8
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_FRAMECHANGED = &H20        '  The frame changed: send WM_NCCALCSIZE
Public Const SWP_SHOWWINDOW = &H40
Public Const SWP_HIDEWINDOW = &H80
Public Const SWP_NOCOPYBITS = &H100
Public Const SWP_NOOWNERZORDER = &H200      '  Don't do owner Z ordering

Public Const SWP_DRAWFRAME = SWP_FRAMECHANGED
Public Const SWP_NOREPOSITION = SWP_NOOWNERZORDER

' SetWindowPos() hwndInsertAfter values
Public Const HWND_TOP = 0
Public Const HWND_BOTTOM = 1
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2

Type DLGTEMPLATE
        style As Long
        dwExtendedStyle As Long
        cdit As Integer
        x As Integer
        y As Integer
        cx As Integer
        cy As Integer
End Type

Type DLGITEMTEMPLATE
        style As Long
        dwExtendedStyle As Long
        x As Integer
        y As Integer
        cx As Integer
        cy As Integer
        id As Integer
End Type

Declare Function EndDialog Lib "user32" Alias "EndDialog" (ByVal hDlg As Long, ByVal nResult As Long) As Long
Declare Function GetDlgItem Lib "user32" Alias "GetDlgItem" (ByVal hDlg As Long, ByVal nIDDlgItem As Long) As Long
Declare Function SetDlgItemInt Lib "user32" Alias "SetDlgItemInt" (ByVal hDlg As Long, ByVal nIDDlgItem As Long, ByVal wValue As Long, ByVal bSigned As Long) As Long
Declare Function GetDlgItemInt Lib "user32" Alias "GetDlgItemInt" (ByVal hDlg As Long, ByVal nIDDlgItem As Long, ByVal lpTranslated As Long, ByVal bSigned As Long) As Long
Declare Function SetDlgItemText Lib "user32" Alias "SetDlgItemTextA" (ByVal hDlg As Long, ByVal nIDDlgItem As Long, ByVal lpString As String) As Long
Declare Function GetDlgItemText Lib "user32" Alias "GetDlgItemTextA" (ByVal hDlg As Long, ByVal nIDDlgItem As Long, ByVal lpString As String, ByVal nMaxCount As Long) As Long
Declare Function CheckDlgButton Lib "user32" Alias "CheckDLGButtonA" (ByVal hDlg As Long, ByVal nIDButton As Long, ByVal wCheck As Long) As Long
Declare Function CheckRadioButton Lib "user32" Alias "CheckRadioButtonA" (ByVal hDlg As Long, ByVal nIDFirstButton As Long, ByVal nIDLastButton As Long, ByVal nIDCheckButton As Long) As Long
Declare Function IsDlgButtonChecked Lib "user32" Alias "IsDlgButtonChecked" (ByVal hDlg As Long, ByVal nIDButton As Long) As Long
Declare Function SendDlgItemMessage Lib "user32" Alias "SendDlgItemMessageA" (ByVal hDlg As Long, ByVal nIDDlgItem As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function GetNextDlgGroupItem Lib "user32" Alias "GetNextDlgGroupItem" (ByVal hDlg As Long, ByVal hCtl As Long, ByVal bPrevious As Long) As Long
Declare Function GetNextDlgTabItem Lib "user32" Alias "GetNextDlgTabItem" (ByVal hDlg As Long, ByVal hCtl As Long, ByVal bPrevious As Long) As Long
Declare Function GetDlgCtrlID Lib "user32" Alias "GetDlgCtrlID" (ByVal hwnd As Long) As Long
Declare Function GetDialogBaseUnits Lib "user32" Alias "GetDialogBaseUnits" () As Long
Declare Function DefDlgProc Lib "user32" Alias "DefDlgProcA" (ByVal hDlg As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Public Const DLGWINDOWEXTRA = 30        '  Window extra bytes needed for private dialog classes

Declare Function CallMsgFilter Lib "user32" Alias "CallMsgFilterA" (lpMsg As MSG, ByVal ncode As Long) As Long

' Clipboard Manager Functions
Declare Function OpenClipboard Lib "user32" Alias "OpenClipboard" (ByVal hwnd As Long) As Long
Declare Function CloseClipboard Lib "user32" Alias "CloseClipboard" () As Long
Declare Function GetClipboardOwner Lib "user32" Alias "GetClipboardOwner" () As Long
Declare Function SetClipboardViewer Lib "user32" Alias "SetClipboardViewer" (ByVal hwnd As Long) As Long
Declare Function GetClipboardViewer Lib "user32" Alias "GetClipboardViewer" () As Long
Declare Function ChangeClipboardChain Lib "user32" Alias "ChangeClipboardChain" (ByVal hwnd As Long, ByVal hWndNext As Long) As Long
Declare Function SetClipboardData Lib "user32" Alias "SetClipboardDataA" (ByVal wFormat As Long, ByVal hMem As Long) As Long
Declare Function GetClipboardData Lib "user32" Alias "GetClipboardDataA" (ByVal wFormat As Long) As Long
Declare Function RegisterClipboardFormat Lib "user32" Alias "RegisterClipboardFormatA" (ByVal lpString As String) As Long
Declare Function CountClipboardFormats Lib "user32" Alias "CountClipboardFormats" () As Long
Declare Function EnumClipboardFormats Lib "user32" Alias "EnumClipboardFormats" (ByVal wFormat As Long) As Long
Declare Function GetClipboardFormatName Lib "user32" Alias "GetClipboardFormatNameA" (ByVal wFormat As Long, ByVal lpString As String, ByVal nMaxCount As Long) As Long
Declare Function EmptyClipboard Lib "user32" Alias "EmptyClipboard" () As Long
Declare Function IsClipboardFormatAvailable Lib "user32" Alias "IsClipboardFormatAvailable" (ByVal wFormat As Long) As Long
Declare Function GetPriorityClipboardFormat Lib "user32" Alias "GetPriorityClipboardFormat" (lpPriorityList As Long, ByVal nCount As Long) As Long
Declare Function GetOpenClipboardWindow Lib "user32" Alias "GetOpenClipboardWindow" () As Long
Declare Function CharToOem Lib "user32" Alias "CharToOemA" (ByVal lpszSrc As String, ByVal lpszDst As String) As Long
Declare Function OemToChar Lib "user32" Alias "OemToCharA" (ByVal lpszSrc As String, ByVal lpszDst As String) As Long
Declare Function CharToOemBuff Lib "user32" Alias "CharToOemBuffA" (ByVal lpszSrc As String, ByVal lpszDst As String, ByVal cchDstLength As Long) As Long
Declare Function OemToCharBuff Lib "user32" Alias "OemToCharBuffA" (ByVal lpszSrc As String, ByVal lpszDst As String, ByVal cchDstLength As Long) As Long
Declare Function CharUpper Lib "user32" Alias "CharUpperA" (ByVal lpsz As String) As String
Declare Function CharUpperBuff Lib "user32" Alias "CharUpperBuffA" (ByVal lpsz As String, ByVal cchLength As Long) As Long
Declare Function CharLower Lib "user32" Alias "CharLowerA" (ByVal lpsz As String) As String
Declare Function CharLowerBuff Lib "user32" Alias "CharLowerBuffA" (ByVal lpsz As String, ByVal cchLength As Long) As Long
Declare Function CharNext Lib "user32" Alias "CharNextA" (ByVal lpsz As String) As String
Declare Function CharPrev Lib "user32" Alias "CharPrevA" (ByVal lpszStart As String, ByVal lpszCurrent As String) As String

' Language dependent Routines
Declare Function IsCharAlpha Lib "user32" Alias "IsCharAlphaA" (ByVal cChar As Byte) As Long
Declare Function IsCharAlphaNumeric Lib "user32" Alias "IsCharAlphaNumericA" (ByVal cChar As Byte) As Long
Declare Function IsCharUpper Lib "user32" Alias "IsCharUpperA" (ByVal cChar As Byte) As Long
Declare Function IsCharLower Lib "user32" Alias "IsCharLowerA" (ByVal cChar As Byte) As Long

Declare Function SetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
Declare Function GetFocus Lib "user32" Alias "GetFocus" () As Long
Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long

' Keyboard Information Routines
Declare Function GetKBCodePage Lib "user32" Alias "GetKBCodePage" () As Long
Declare Function GetKeyState Lib "user32" Alias "GetKeyState" (ByVal nVirtKey As Long) As Integer
Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer
Declare Function GetKeyboardState Lib "user32" Alias "GetKeyboardState" (pbKeyState As Byte) As Long
Declare Function SetKeyboardState Lib "user32" Alias "SetKeyboardState" (lppbKeyState As Byte) As Long
Declare Function GetKeyboardType Lib "user32" Alias "GetKeyboardType" (ByVal nTypeFlag As Long) As Long
Declare Function GetKeyNameText Lib "user32" Alias "GetKeyNameTextA" (ByVal lParam As Long, ByVal lpBuffer As String, ByVal nSize As Long) As Long

Declare Function ToAscii Lib "user32" Alias "ToAscii" (ByVal uVirtKey As Long, ByVal uScanCode As Long, lpbKeyState As Byte, lpwTransKey As Long, ByVal fuState As Long) As Long
Declare Function ToUnicode Lib "user32" Alias "ToUnicode" (ByVal wVirtKey As Long, ByVal wScanCode As Long, lpKeyState As Byte, ByVal pwszBuff As String, ByVal cchBuff As Long, ByVal wFlags As Long) As Long

Declare Function OemKeyScan Lib "user32" Alias "OemKeyScan" (ByVal wOemChar As Long) As Long
Declare Function VkKeyScan Lib "user32" Alias "VkKeyScanA" (ByVal cChar As Byte) As Integer

Public Const KEYEVENTF_EXTENDEDKEY = &H1
Public Const KEYEVENTF_KEYUP = &H2

Declare Sub keybd_event Lib "user32" Alias "keybd_event" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Public Const MOUSEEVENTF_MOVE = &H1 '  mouse move
Public Const MOUSEEVENTF_LEFTDOWN = &H2 '  left button down
Public Const MOUSEEVENTF_LEFTUP = &H4 '  left button up
Public Const MOUSEEVENTF_RIGHTDOWN = &H8 '  right button down
Public Const MOUSEEVENTF_RIGHTUP = &H10 '  right button up
Public Const MOUSEEVENTF_MIDDLEDOWN = &H20 '  middle button down
Public Const MOUSEEVENTF_MIDDLEUP = &H40 '  middle button up
Public Const MOUSEEVENTF_ABSOLUTE = &H8000 '  absolute move

Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long

Declare Function GetInputState Lib "user32" Alias "GetInputState" () As Long
Declare Function GetQueueStatus Lib "user32" Alias "GetQueueStatus" (ByVal fuFlags As Long) As Long
Declare Function GetCapture Lib "user32" Alias "GetCapture" () As Long
Declare Function SetCapture Lib "user32" Alias "SetCapture" (ByVal hwnd As Long) As Long
Declare Function ReleaseCapture Lib "user32" Alias "ReleaseCapture" () As Long

Declare Function MsgWaitForMultipleObjects Lib "user32" Alias "MsgWaitForMultipleObjects" (ByVal nCount As Long, pHandles As Long, ByVal fWaitAll As Long, ByVal dwMilliseconds As Long, ByVal dwWakeMask As Long) As Long

' GetQueueStatus flags
Public Const QS_KEY = &H1
Public Const QS_MOUSEMOVE = &H2
Public Const QS_MOUSEBUTTON = &H4
Public Const QS_POSTMESSAGE = &H8
Public Const QS_TIMER = &H10
Public Const QS_PAINT = &H20
Public Const QS_SENDMESSAGE = &H40
Public Const QS_HOTKEY = &H80

Public Const QS_MOUSE = (QS_MOUSEMOVE Or QS_MOUSEBUTTON)

Public Const QS_INPUT = (QS_MOUSE Or QS_KEY)

Public Const QS_ALLEVENTS = (QS_INPUT Or QS_POSTMESSAGE Or QS_TIMER Or QS_PAINT Or QS_HOTKEY)

Public Const QS_ALLINPUT = (QS_SENDMESSAGE Or QS_PAINT Or QS_TIMER Or QS_POSTMESSAGE Or QS_MOUSEBUTTON Or QS_MOUSEMOVE Or QS_HOTKEY Or QS_KEY)

' Windows Functions
Declare Function KillTimer Lib "user32" Alias "KillTimer" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long

Declare Function IsWindowUnicode Lib "user32" Alias "IsWindowUnicode" (ByVal hwnd As Long) As Long

Declare Function EnableWindow Lib "user32" Alias "EnableWindow" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Declare Function IsWindowEnabled Lib "user32" Alias "IsWindowEnabled" (ByVal hwnd As Long) As Long

Declare Function LoadAccelerators Lib "user32" Alias "LoadAcceleratorsA" (ByVal hInstance As Long, ByVal lpTableName As String) As Long
Declare Function CreateAcceleratorTable Lib "user32" Alias "CreateAcceleratorTableA" (lpaccl As ACCEL, ByVal cEntries As Long) As Long
Declare Function DestroyAcceleratorTable Lib "user32" Alias "DestroyAcceleratorTable" (ByVal haccel As Long) As Long
Declare Function CopyAcceleratorTable Lib "user32" Alias "CopyAcceleratorTableA" (ByVal hAccelSrc As Long, lpAccelDst As ACCEL, ByVal cAccelEntries As Long) As Long
Declare Function TranslateAccelerator Lib "user32" Alias "TranslateAcceleratorA" (ByVal hwnd As Long, ByVal hAccTable As Long, lpMsg As MSG) As Long

' GetSystemMetrics() codes
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
Public Const SM_CXVSCROLL = 2
Public Const SM_CYHSCROLL = 3
Public Const SM_CYCAPTION = 4
Public Const SM_CXBORDER = 5
Public Const SM_CYBORDER = 6
Public Const SM_CXDLGFRAME = 7
Public Const SM_CYDLGFRAME = 8
Public Const SM_CYVTHUMB = 9
Public Const SM_CXHTHUMB = 10
Public Const SM_CXICON = 11
Public Const SM_CYICON = 12
Public Const SM_CXCURSOR = 13
Public Const SM_CYCURSOR = 14
Public Const SM_CYMENU = 15
Public Const SM_CXFULLSCREEN = 16
Public Const SM_CYFULLSCREEN = 17
Public Const SM_CYKANJIWINDOW = 18
Public Const SM_MOUSEPRESENT = 19
Public Const SM_CYVSCROLL = 20
Public Const SM_CXHSCROLL = 21
Public Const SM_DEBUG = 22
Public Const SM_SWAPBUTTON = 23
Public Const SM_RESERVED1 = 24
Public Const SM_RESERVED2 = 25
Public Const SM_RESERVED3 = 26
Public Const SM_RESERVED4 = 27
Public Const SM_CXMIN = 28
Public Const SM_CYMIN = 29
Public Const SM_CXSIZE = 30
Public Const SM_CYSIZE = 31
Public Const SM_CXFRAME = 32
Public Const SM_CYFRAME = 33
Public Const SM_CXMINTRACK = 34
Public Const SM_CYMINTRACK = 35
Public Const SM_CXDOUBLECLK = 36
Public Const SM_CYDOUBLECLK = 37
Public Const SM_CXICONSPACING = 38
Public Const SM_CYICONSPACING = 39
Public Const SM_MENUDROPALIGNMENT = 40
Public Const SM_PENWINDOWS = 41
Public Const SM_DBCSENABLED = 42
Public Const SM_CMOUSEBUTTONS = 43
Public Const SM_CMETRICS = 44
Public Const SM_CXSIZEFRAME = SM_CXFRAME
Public Const SM_CYSIZEFRAME = SM_CYFRAME
Public Const SM_CXFIXEDFRAME = SM_CXDLGFRAME
Public Const SM_CYFIXEDFRAME = SM_CYDLGFRAME

Declare Function GetSystemMetrics Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long

Declare Function LoadMenu Lib "user32" Alias "LoadMenuA" (ByVal hInstance As Long, ByVal lpString As String) As Long
Declare Function LoadMenuIndirect Lib "user32" Alias "LoadMenuIndirectA" (ByVal lpMenuTemplate As Long) As Long
Declare Function GetMenu Lib "user32" Alias "GetMenu" (ByVal hwnd As Long) As Long
Declare Function SetMenu Lib "user32" Alias "SetMenu" (ByVal hwnd As Long, ByVal hMenu As Long) As Long
Declare Function HiliteMenuItem Lib "user32" Alias "HiliteMenuItem" (ByVal hwnd As Long, ByVal hMenu As Long, ByVal wIDHiliteItem As Long, ByVal wHilite As Long) As Long
Declare Function GetMenuString Lib "user32" Alias "GetMenuStringA" (ByVal hMenu As Long, ByVal wIDItem As Long, ByVal lpString As String, ByVal nMaxCount As Long, ByVal wFlag As Long) As Long
Declare Function GetMenuState Lib "user32" Alias "GetMenuState" (ByVal hMenu As Long, ByVal wID As Long, ByVal wFlags As Long) As Long
Declare Function DrawMenuBar Lib "user32" Alias "DrawMenuBar" (ByVal hwnd As Long) As Long
Declare Function GetSystemMenu Lib "user32" Alias "GetSystemMenu" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Declare Function CreateMenu Lib "user32" Alias "CreateMenu" () As Long
Declare Function CreatePopupMenu Lib "user32" Alias "CreatePopupMenu" () As Long
Declare Function DestroyMenu Lib "user32" Alias "DestroyMenu" (ByVal hMenu As Long) As Long
Declare Function CheckMenuItem Lib "user32" Alias "CheckMenuItem" (ByVal hMenu As Long, ByVal wIDCheckItem As Long, ByVal wCheck As Long) As Long
Declare Function EnableMenuItem Lib "user32" Alias "EnableMenuItem" (ByVal hMenu As Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long
Declare Function GetSubMenu Lib "user32" Alias "GetSubMenu" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Declare Function GetMenuItemID Lib "user32" Alias "GetMenuItemID" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Declare Function GetMenuItemCount Lib "user32" Alias "GetMenuItemCount" (ByVal hMenu As Long) As Long

Declare Function InsertMenu Lib "user32" Alias "InsertMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As Any) As Long
Declare Function RemoveMenu Lib "user32" Alias "RemoveMenu" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Declare Function DeleteMenu Lib "user32" Alias "DeleteMenu" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Declare Function SetMenuItemBitmaps Lib "user32" Alias "SetMenuItemBitmaps" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, ByVal hBitmapChecked As Long) As Long
Declare Function GetMenuCheckMarkDimensions Lib "user32" Alias "GetMenuCheckMarkDimensions" () As Long
Declare Function TrackPopupMenu Lib "user32" Alias "TrackPopupMenu" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, lprc As Rect) As Long

' Flags for TrackPopupMenu
Public Const TPM_LEFTBUTTON = &H0&
Public Const TPM_RIGHTBUTTON = &H2&
Public Const TPM_LEFTALIGN = &H0&
Public Const TPM_CENTERALIGN = &H4&
Public Const TPM_RIGHTALIGN = &H8&

Declare Function DrawIcon Lib "user32" Alias "DrawIcon" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long

' DrawText() Format Flags
Public Const DT_TOP = &H0
Public Const DT_LEFT = &H0
Public Const DT_CENTER = &H1
Public Const DT_RIGHT = &H2
Public Const DT_VCENTER = &H4
Public Const DT_BOTTOM = &H8
Public Const DT_WORDBREAK = &H10
Public Const DT_SINGLELINE = &H20
Public Const DT_EXPANDTABS = &H40
Public Const DT_TABSTOP = &H80
Public Const DT_NOCLIP = &H100
Public Const DT_EXTERNALLEADING = &H200
Public Const DT_CALCRECT = &H400
Public Const DT_NOPREFIX = &H800
Public Const DT_INTERNAL = &H1000

Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Declare Function TabbedTextOut Lib "user32" Alias "TabbedTextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long, ByVal nTabPositions As Long, lpnTabStopPositions As Long, ByVal nTabOrigin As Long) As Long
Declare Function GetTabbedTextExtent Lib "user32" Alias "GetTabbedTextExtentA" (ByVal hdc As Long, ByVal lpString As String, ByVal nCount As Long, ByVal nTabPositions As Long, lpnTabStopPositions As Long) As Long

Declare Function UpdateWindow Lib "user32" Alias "UpdateWindow" (ByVal hwnd As Long) As Long
Declare Function SetActiveWindow Lib "user32" Alias "SetActiveWindow" (ByVal hwnd As Long) As Long
Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As Long
Declare Function SetForegroundWindow Lib "user32" Alias "SetForegroundWindow" (ByVal hwnd As Long) As Long
Declare Function WindowFromDC Lib "user32" Alias "WindowFromDC" (ByVal hdc As Long) As Long

Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Long) As Long
Declare Function GetDCEx Lib "user32" Alias "GetDCEx" (ByVal hwnd As Long, ByVal hrgnclip As Long, ByVal fdwOptions As Long) As Long

Public Const DCX_WINDOW = &H1&
Public Const DCX_CACHE = &H2&
Public Const DCX_NORESETATTRS = &H4&
Public Const DCX_CLIPCHILDREN = &H8&
Public Const DCX_CLIPSIBLINGS = &H10&
Public Const DCX_PARENTCLIP = &H20&

Public Const DCX_EXCLUDERGN = &H40&
Public Const DCX_INTERSECTRGN = &H80&

Public Const DCX_EXCLUDEUPDATE = &H100&
Public Const DCX_INTERSECTUPDATE = &H200&

Public Const DCX_LOCKWINDOWUPDATE = &H400&

Public Const DCX_NORECOMPUTE = &H100000
Public Const DCX_VALIDATE = &H200000

Declare Function GetWindowDC Lib "user32" Alias "GetWindowDC" (ByVal hwnd As Long) As Long
Declare Function ReleaseDC Lib "user32" Alias "ReleaseDC" (ByVal hwnd As Long, ByVal hdc As Long) As Long

Declare Function BeginPaint Lib "user32" Alias "BeginPaint" (ByVal hwnd As Long, lpPaint As PAINTSTRUCT) As Long
Declare Function EndPaint Lib "user32" Alias "EndPaint" (ByVal hwnd As Long, lpPaint As PAINTSTRUCT) As Long
Declare Function GetUpdateRect Lib "user32" Alias "GetUpdateRect" (ByVal hwnd As Long, lpRect As RECT, ByVal bErase As Long) As Long
Declare Function GetUpdateRgn Lib "user32" Alias "GetUpdateRgn" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal fErase As Long) As Long
Declare Function ExcludeUpdateRgn Lib "user32" Alias "ExcludeUpdateRgn" (ByVal hdc As Long, ByVal hwnd As Long) As Long
Declare Function InvalidateRect Lib "user32" Alias "InvalidateRect" (ByVal hwnd As Long, lpRect As RECT, ByVal bErase As Long) As Long
Declare Function ValidateRect Lib "user32" Alias "ValidateRect" (ByVal hwnd As Long, lpRect As RECT) As Long
Declare Function InvalidateRgn Lib "user32" Alias "InvalidateRgn" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bErase As Long) As Long
Declare Function ValidateRgn Lib "user32" Alias "ValidateRgn" (ByVal hwnd As Long, ByVal hRgn As Long) As Long

Declare Function RedrawWindow Lib "user32" Alias "RedrawWindow" (ByVal hwnd As Long, lprcUpdate As RECT, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long

Public Const RDW_INVALIDATE = &H1
Public Const RDW_INTERNALPAINT = &H2
Public Const RDW_ERASE = &H4

Public Const RDW_VALIDATE = &H8
Public Const RDW_NOINTERNALPAINT = &H10
Public Const RDW_NOERASE = &H20

Public Const RDW_NOCHILDREN = &H40
Public Const RDW_ALLCHILDREN = &H80

Public Const RDW_UPDATENOW = &H100
Public Const RDW_ERASENOW = &H200

Public Const RDW_FRAME = &H400
Public Const RDW_NOFRAME = &H800

Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long

Declare Function ScrollWindow Lib "user32" Alias "ScrollWindow" (ByVal hWnd As Long, ByVal XAmount As Long, ByVal YAmount As Long, lpRect As RECT, lpClipRect As RECT) As Long
Declare Function ScrollDC Lib "user32" Alias "ScrollDC" (ByVal hdc As Long, ByVal dx As Long, ByVal dy As Long, lprcScroll As RECT, lprcClip As RECT, ByVal hrgnUpdate As Long, lprcUpdate As RECT) As Long
Declare Function ScrollWindowEx Lib "user32" Alias "ScrollWindowEx" (ByVal hwnd As Long, ByVal dx As Long, ByVal dy As Long, lprcScroll As RECT, lprcClip As RECT, ByVal hrgnUpdate As Long, lprcUpdate As RECT, ByVal fuScroll As Long) As Long

Public Const SW_SCROLLCHILDREN = &H1
Public Const SW_INVALIDATE = &H2
Public Const SW_ERASE = &H4

Declare Function SetScrollPos Lib "user32" Alias "SetScrollPos" (ByVal hwnd As Long, ByVal nBar As Long, ByVal nPos As Long, ByVal bRedraw As Long) As Long
Declare Function GetScrollPos Lib "user32" Alias "GetScrollPos" (ByVal hwnd As Long, ByVal nBar As Long) As Long
Declare Function SetScrollRange Lib "user32" Alias "SetScrollRange" (ByVal hwnd As Long, ByVal nBar As Long, ByVal nMinPos As Long, ByVal nMaxPos As Long, ByVal bRedraw As Long) As Long
Declare Function GetScrollRange Lib "user32" Alias "GetScrollRange" (ByVal hwnd As Long, ByVal nBar As Long, lpMinPos As Long, lpMaxPos As Long) As Long
Declare Function ShowScrollBar Lib "user32" Alias "ShowScrollBar" (ByVal hwnd As Long, ByVal wBar As Long, ByVal bShow As Long) As Long
Declare Function EnableScrollBar Lib "user32" Alias "EnableScrollBar" (ByVal hwnd As Long, ByVal wSBflags As Long, ByVal wArrows As Long) As Long

' EnableScrollBar() flags
Public Const ESB_ENABLE_BOTH = &H0
Public Const ESB_DISABLE_BOTH = &H3

Public Const ESB_DISABLE_LEFT = &H1
Public Const ESB_DISABLE_RIGHT = &H2

Public Const ESB_DISABLE_UP = &H1
Public Const ESB_DISABLE_DOWN = &H2

Public Const ESB_DISABLE_LTUP = ESB_DISABLE_LEFT
Public Const ESB_DISABLE_RTDN = ESB_DISABLE_RIGHT

Declare Function SetProp Lib "user32" Alias "SetPropA" (ByVal hwnd As Long, ByVal lpString As String, ByVal hData As Long) As Long
Declare Function GetProp Lib "user32" Alias "GetPropA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Declare Function RemoveProp Lib "user32" Alias "RemovePropA" (ByVal hwnd As Long, ByVal lpString As String) As Long

Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long

Declare Function GetClientRect Lib "user32" Alias "GetClientRect" (ByVal hwnd As Long, lpRect As RECT) As Long
Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long
Declare Function AdjustWindowRect Lib "user32" Alias "AdjustWindowRect" (lpRect As RECT, ByVal dwStyle As Long, ByVal bMenu As Long) As Long
Declare Function AdjustWindowRectEx Lib "user32" Alias "AdjustWindowRectEx" (lpRect As RECT, ByVal dsStyle As Long, ByVal bMenu As Long, ByVal dwEsStyle As Long) As Long

' MessageBox() Flags
Public Const MB_OK = &H0&
Public Const MB_OKCANCEL = &H1&
Public Const MB_ABORTRETRYIGNORE = &H2&
Public Const MB_YESNOCANCEL = &H3&
Public Const MB_YESNO = &H4&
Public Const MB_RETRYCANCEL = &H5&

Public Const MB_ICONHAND = &H10&
Public Const MB_ICONQUESTION = &H20&
Public Const MB_ICONEXCLAMATION = &H30&
Public Const MB_ICONASTERISK = &H40&

Public Const MB_ICONINFORMATION = MB_ICONASTERISK
Public Const MB_ICONSTOP = MB_ICONHAND

Public Const MB_DEFBUTTON1 = &H0&
Public Const MB_DEFBUTTON2 = &H100&
Public Const MB_DEFBUTTON3 = &H200&

Public Const MB_APPLMODAL = &H0&
Public Const MB_SYSTEMMODAL = &H1000&
Public Const MB_TASKMODAL = &H2000&

Public Const MB_NOFOCUS = &H8000&
Public Const MB_SETFOREGROUND = &H10000
Public Const MB_DEFAULT_DESKTOP_ONLY = &H20000

Public Const MB_TYPEMASK = &HF&
Public Const MB_ICONMASK = &HF0&
Public Const MB_DEFMASK = &HF00&
Public Const MB_MODEMASK = &H3000&
Public Const MB_MISCMASK = &HC000&

Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Declare Function MessageBoxEx Lib "user32" Alias "MessageBoxExA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal uType As Long, ByVal wLanguageId As Long) As Long
Declare Function MessageBeep Lib "user32" Alias "MessageBeep" (ByVal wType As Long) As Long

Declare Function ShowCursor Lib "user32" Alias "ShowCursor" (ByVal bShow As Long) As Long
Declare Function SetCursorPos Lib "user32" Alias "SetCursorPos" (ByVal x As Long, ByVal y As Long) As Long
Declare Function SetCursor Lib "user32" Alias "SetCursor" (ByVal hCursor As Long) As Long
Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
Declare Function ClipCursor Lib "user32" Alias "ClipCursor" (lpRect As Any) As Long
Declare Function GetCursor Lib "user32" Alias "GetCursor" () As Long
Declare Function GetClipCursor Lib "user32" Alias "GetClipCursor" (lprc As RECT) As Long

Declare Function CreateCaret Lib "user32" Alias "CreateCaret" (ByVal hwnd As Long, ByVal hBitmap As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Declare Function GetCaretBlinkTime Lib "user32" Alias "GetCaretBlinkTime" () As Long
Declare Function SetCaretBlinkTime Lib "user32" Alias "SetCaretBlinkTime" (ByVal wMSeconds As Long) As Long
Declare Function DestroyCaret Lib "user32" Alias "DestroyCaret" () As Long
Declare Function HideCaret Lib "user32" Alias "HideCaret" (ByVal hwnd As Long) As Long
Declare Function ShowCaret Lib "user32" Alias "ShowCaret" (ByVal hwnd As Long) As Long
Declare Function SetCaretPos Lib "user32" Alias "SetCaretPos" (ByVal x As Long, ByVal y As Long) As Long
Declare Function GetCaretPos Lib "user32" Alias "GetCaretPos" (lpPoint As POINTAPI) As Long

Declare Function ClientToScreen Lib "user32" Alias "ClientToScreen" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Declare Function ScreenToClient Lib "user32" Alias "ScreenToClient" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long

Declare Function MapWindowPoints Lib "user32" Alias "MapWindowPoints" (ByVal hwndFrom As Long, ByVal hwndTo As Long, lppt As Any, ByVal cPoints As Long) As Long
Declare Function WindowFromPoint Lib "user32" Alias "WindowFromPoint" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Declare Function ChildWindowFromPoint Lib "user32" Alias "ChildWindowFromPoint" (ByVal hWnd As Long, ByVal xPoint As Long, ByVal yPoint As Long) As Long

' Color Types
Public Const CTLCOLOR_MSGBOX = 0
Public Const CTLCOLOR_EDIT = 1
Public Const CTLCOLOR_LISTBOX = 2
Public Const CTLCOLOR_BTN = 3
Public Const CTLCOLOR_DLG = 4
Public Const CTLCOLOR_SCROLLBAR = 5
Public Const CTLCOLOR_STATIC = 6
Public Const CTLCOLOR_MAX = 8   '  three bits max

Public Const COLOR_SCROLLBAR = 0
Public Const COLOR_BACKGROUND = 1
Public Const COLOR_ACTIVECAPTION = 2
Public Const COLOR_INACTIVECAPTION = 3
Public Const COLOR_MENU = 4
Public Const COLOR_WINDOW = 5
Public Const COLOR_WINDOWFRAME = 6
Public Const COLOR_MENUTEXT = 7
Public Const COLOR_WINDOWTEXT = 8
Public Const COLOR_CAPTIONTEXT = 9
Public Const COLOR_ACTIVEBORDER = 10
Public Const COLOR_INACTIVEBORDER = 11
Public Const COLOR_APPWORKSPACE = 12
Public Const COLOR_HIGHLIGHT = 13
Public Const COLOR_HIGHLIGHTTEXT = 14
Public Const COLOR_BTNFACE = 15
Public Const COLOR_BTNSHADOW = 16
Public Const COLOR_GRAYTEXT = 17
Public Const COLOR_BTNTEXT = 18
Public Const COLOR_INACTIVECAPTIONTEXT = 19
Public Const COLOR_BTNHIGHLIGHT = 20

Declare Function GetSysColor Lib "user32" Alias "GetSysColor" (ByVal nIndex As Long) As Long
Declare Function SetSysColors Lib "user32" Alias "SetSysColors" (ByVal nChanges As Long, lpSysColor As Long, lpColorValues As Long) As Long

Declare Function DrawFocusRect Lib "user32" Alias "DrawFocusRect" (ByVal hdc As Long, lpRect As RECT) As Long
Declare Function FillRect Lib "user32" Alias "FillRect" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Declare Function FrameRect Lib "user32" Alias "FrameRect" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Declare Function InvertRect Lib "user32" Alias "InvertRect" (ByVal hdc As Long, lpRect As RECT) As Long
Declare Function SetRect Lib "user32" Alias "SetRect" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Declare Function SetRectEmpty Lib "user32" Alias "SetRectEmpty" (lpRect As RECT) As Long
Declare Function CopyRect Lib "user32" Alias "CopyRect" (lpDestRect As RECT, lpSourceRect As RECT) As Long
Declare Function InflateRect Lib "user32" Alias "InflateRect" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long
Declare Function IntersectRect Lib "user32" Alias "IntersectRect" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long
Declare Function UnionRect Lib "user32" Alias "UnionRect" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long
Declare Function SubtractRect Lib "user32" Alias "SubtractRect" (lprcDst As RECT, lprcSrc1 As RECT, lprcSrc2 As RECT) As Long
Declare Function OffsetRect Lib "user32" Alias "OffsetRect" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long
Declare Function IsRectEmpty Lib "user32" Alias "IsRectEmpty" (lpRect As RECT) As Long
Declare Function EqualRect Lib "user32" Alias "EqualRect" (lpRect1 As RECT, lpRect2 As RECT) As Long
Declare Function PtInRect Lib "user32" Alias "PtInRect" (lpRect As RECT, pt As POINTAPI) As Long

Declare Function GetWindowWord Lib "user32" Alias "GetWindowWord" (ByVal hwnd As Long, ByVal nIndex As Long) As Integer
Declare Function SetWindowWord Lib "user32" Alias "SetWindowWord" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal wNewWord As Long) As Long
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function GetClassWord Lib "user32" Alias "GetClassWord" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function SetClassWord Lib "user32" Alias "SetClassWord" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal wNewWord As Long) As Long
Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Long

Declare Function GetParent Lib "user32" Alias "GetParent" (ByVal hwnd As Long) As Long
Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Declare Function GetTopWindow Lib "user32" Alias "GetTopWindow" (ByVal hwnd As Long) As Long
Declare Function GetNextWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wFlag As Long) As Long

Declare Function GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (ByVal hwnd As Long, lpdwProcessId As Long) As Long

Declare Function GetLastActivePopup Lib "user32" Alias "GetLastActivePopup" (ByVal hwndOwnder As Long) As Long