Declaraciones api's Windows

Iniciado por programatrix, 22 Septiembre 2005, 16:48 PM

0 Miembros y 1 Visitante están viendo este tema.

programatrix


'  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


programatrix


'  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&

programatrix


Type MCI_GENERIC_PARMS
        dwCallback As Long
End Type

Type MCI_OPEN_PARMS
        dwCallback As Long
        wDeviceID As Long
        lpstrDeviceType As String
        lpstrElementName As String
        lpstrAlias As String
End Type

Type MCI_PLAY_PARMS
        dwCallback As Long
        dwFrom As Long
        dwTo As Long
End Type

Type MCI_SEEK_PARMS
        dwCallback As Long
        dwTo As Long
End Type

Type MCI_STATUS_PARMS
        dwCallback As Long
        dwReturn As Long
        dwItem As Long
        dwTrack As Integer
End Type

Type MCI_INFO_PARMS
        dwCallback As Long
        lpstrReturn As String
        dwRetSize As Long
End Type

Type MCI_GETDEVCAPS_PARMS
        dwCallback As Long
        dwReturn As Long
        dwIten As Long
End Type

Type MCI_SYSINFO_PARMS
        dwCallback As Long
        lpstrReturn As String
        dwRetSize As Long
        dwNumber As Long
        wDeviceType As Long
End Type

Type MCI_SET_PARMS
        dwCallback As Long
        dwTimeFormat As Long
        dwAudio As Long
End Type

Type MCI_BREAK_PARMS
        dwCallback As Long
        nVirtKey As Long
        hwndBreak As Long
End Type

Type MCI_SOUND_PARMS
        dwCallback As Long
        lpstrSoundName As String
End Type

Type MCI_SAVE_PARMS
        dwCallback As Long
        lpFileName As String
End Type

Type MCI_LOAD_PARMS
        dwCallback As Long
        lpFileName As String
End Type

Type MCI_RECORD_PARMS
        dwCallback As Long
        dwFrom As Long
        dwTo As Long
End Type

Public Const MCI_VD_MODE_PARK = (MCI_VD_OFFSET + 1)

'  return ID's for videodisc MCI_GETDEVCAPS command

'  flag for dwReturn field of MCI_STATUS_PARMS
'  MCI_STATUS command, (dwItem == MCI_VD_STATUS_MEDIA_TYPE)
Public Const MCI_VD_MEDIA_CLV = (MCI_VD_OFFSET + 2)
Public Const MCI_VD_MEDIA_CAV = (MCI_VD_OFFSET + 3)
Public Const MCI_VD_MEDIA_OTHER = (MCI_VD_OFFSET + 4)

Public Const MCI_VD_FORMAT_TRACK = &H4001

'  flags for dwFlags parameter of MCI_PLAY command message
Public Const MCI_VD_PLAY_REVERSE = &H10000
Public Const MCI_VD_PLAY_FAST = &H20000
Public Const MCI_VD_PLAY_SPEED = &H40000
Public Const MCI_VD_PLAY_SCAN = &H80000
Public Const MCI_VD_PLAY_SLOW = &H100000

'  flag for dwFlags parameter of MCI_SEEK command message
Public Const MCI_VD_SEEK_REVERSE = &H10000

'  flags for dwItem field of MCI_STATUS_PARMS parameter block
Public Const MCI_VD_STATUS_SPEED = &H4002&
Public Const MCI_VD_STATUS_FORWARD = &H4003&
Public Const MCI_VD_STATUS_MEDIA_TYPE = &H4004&
Public Const MCI_VD_STATUS_SIDE = &H4005&
Public Const MCI_VD_STATUS_DISC_SIZE = &H4006&

'  flags for dwFlags parameter of MCI_GETDEVCAPS command message
Public Const MCI_VD_GETDEVCAPS_CLV = &H10000
Public Const MCI_VD_GETDEVCAPS_CAV = &H20000

Public Const MCI_VD_SPIN_UP = &H10000
Public Const MCI_VD_SPIN_DOWN = &H20000

'  flags for dwItem field of MCI_GETDEVCAPS_PARMS parameter block
Public Const MCI_VD_GETDEVCAPS_CAN_REVERSE = &H4002&
Public Const MCI_VD_GETDEVCAPS_FAST_RATE = &H4003&
Public Const MCI_VD_GETDEVCAPS_SLOW_RATE = &H4004&
Public Const MCI_VD_GETDEVCAPS_NORMAL_RATE = &H4005&

'  flags for the dwFlags parameter of MCI_STEP command message
Public Const MCI_VD_STEP_FRAMES = &H10000
Public Const MCI_VD_STEP_REVERSE = &H20000

'  flag for the MCI_ESCAPE command message
Public Const MCI_VD_ESCAPE_STRING = &H100&

Type MCI_VD_PLAY_PARMS
        dwCallback As Long
        dwFrom As Long
        dwTo As Long
        dwSpeed As Long
End Type

Type MCI_VD_STEP_PARMS
        dwCallback As Long
        dwFrames As Long
End Type

Type MCI_VD_ESCAPE_PARMS
        dwCallback As Long
        lpstrCommand As String
End Type

Public Const MCI_WAVE_PCM = (MCI_WAVE_OFFSET + 0)
Public Const MCI_WAVE_MAPPER = (MCI_WAVE_OFFSET + 1)

'  flags for the dwFlags parameter of MCI_OPEN command message
Public Const MCI_WAVE_OPEN_BUFFER = &H10000

'  flags for the dwFlags parameter of MCI_SET command message
Public Const MCI_WAVE_SET_FORMATTAG = &H10000
Public Const MCI_WAVE_SET_CHANNELS = &H20000
Public Const MCI_WAVE_SET_SAMPLESPERSEC = &H40000
Public Const MCI_WAVE_SET_AVGBYTESPERSEC = &H80000
Public Const MCI_WAVE_SET_BLOCKALIGN = &H100000
Public Const MCI_WAVE_SET_BITSPERSAMPLE = &H200000

'  flags for the dwFlags parameter of MCI_STATUS, MCI_SET command messages
Public Const MCI_WAVE_INPUT = &H400000
Public Const MCI_WAVE_OUTPUT = &H800000

'  flags for the dwItem field of MCI_STATUS_PARMS parameter block
Public Const MCI_WAVE_STATUS_FORMATTAG = &H4001&
Public Const MCI_WAVE_STATUS_CHANNELS = &H4002&
Public Const MCI_WAVE_STATUS_SAMPLESPERSEC = &H4003&
Public Const MCI_WAVE_STATUS_AVGBYTESPERSEC = &H4004&
Public Const MCI_WAVE_STATUS_BLOCKALIGN = &H4005&
Public Const MCI_WAVE_STATUS_BITSPERSAMPLE = &H4006&
Public Const MCI_WAVE_STATUS_LEVEL = &H4007&

'  flags for the dwFlags parameter of MCI_SET command message
Public Const MCI_WAVE_SET_ANYINPUT = &H4000000
Public Const MCI_WAVE_SET_ANYOUTPUT = &H8000000

'  flags for the dwFlags parameter of MCI_GETDEVCAPS command message
Public Const MCI_WAVE_GETDEVCAPS_INPUTS = &H4001&
Public Const MCI_WAVE_GETDEVCAPS_OUTPUTS = &H4002&

Type MCI_WAVE_OPEN_PARMS
        dwCallback As Long
        wDeviceID As Long
        lpstrDeviceType As String
        lpstrElementName As String
        lpstrAlias As String
        dwBufferSeconds As Long
End Type

Type MCI_WAVE_DELETE_PARMS
        dwCallback As Long
        dwFrom As Long
        dwTo As Long
End Type

Type MCI_WAVE_SET_PARMS
        dwCallback As Long
        dwTimeFormat As Long
        dwAudio As Long
        wInput As Long
        wOutput As Long
        wFormatTag As Integer
        wReserved2 As Integer
        nChannels As Integer
        wReserved3 As Integer
        nSamplesPerSec As Long
        nAvgBytesPerSec As Long
        nBlockAlign As Integer
        wReserved4 As Integer
        wBitsPerSample As Integer
        wReserved5 As Integer
End Type

'  flags for the dwReturn field of MCI_STATUS_PARMS parameter block
'  MCI_STATUS command, (dwItem == MCI_SEQ_STATUS_DIVTYPE)
Public Const MCI_SEQ_DIV_PPQN = (0 + MCI_SEQ_OFFSET)
Public Const MCI_SEQ_DIV_SMPTE_24 = (1 + MCI_SEQ_OFFSET)
Public Const MCI_SEQ_DIV_SMPTE_25 = (2 + MCI_SEQ_OFFSET)
Public Const MCI_SEQ_DIV_SMPTE_30DROP = (3 + MCI_SEQ_OFFSET)
Public Const MCI_SEQ_DIV_SMPTE_30 = (4 + MCI_SEQ_OFFSET)

'  flags for the dwMaster field of MCI_SEQ_SET_PARMS parameter block
'  MCI_SET command, (dwFlags == MCI_SEQ_SET_MASTER)
Public Const MCI_SEQ_FORMAT_SONGPTR = &H4001
Public Const MCI_SEQ_FILE = &H4002
Public Const MCI_SEQ_MIDI = &H4003
Public Const MCI_SEQ_SMPTE = &H4004
Public Const MCI_SEQ_NONE = 65533

Public Const MCI_SEQ_MAPPER = 65535

'  flags for the dwItem field of MCI_STATUS_PARMS parameter block
Public Const MCI_SEQ_STATUS_TEMPO = &H4002&
Public Const MCI_SEQ_STATUS_PORT = &H4003&
Public Const MCI_SEQ_STATUS_SLAVE = &H4007&
Public Const MCI_SEQ_STATUS_MASTER = &H4008&
Public Const MCI_SEQ_STATUS_OFFSET = &H4009&
Public Const MCI_SEQ_STATUS_DIVTYPE = &H400A&

'  flags for the dwFlags parameter of MCI_SET command message
Public Const MCI_SEQ_SET_TEMPO = &H10000
Public Const MCI_SEQ_SET_PORT = &H20000
Public Const MCI_SEQ_SET_SLAVE = &H40000
Public Const MCI_SEQ_SET_MASTER = &H80000
Public Const MCI_SEQ_SET_OFFSET = &H1000000

Type MCI_SEQ_SET_PARMS
        dwCallback As Long
        dwTimeFormat As Long
        dwAudio As Long
        dwTempo As Long
        dwPort As Long
        dwSlave As Long
        dwMaster As Long
        dwOffset As Long
End Type

'  flags for dwFlags parameter of MCI_OPEN command message
Public Const MCI_ANIM_OPEN_WS = &H10000
Public Const MCI_ANIM_OPEN_PARENT = &H20000
Public Const MCI_ANIM_OPEN_NOSTATIC = &H40000

'  flags for dwFlags parameter of MCI_PLAY command message
Public Const MCI_ANIM_PLAY_SPEED = &H10000
Public Const MCI_ANIM_PLAY_REVERSE = &H20000
Public Const MCI_ANIM_PLAY_FAST = &H40000
Public Const MCI_ANIM_PLAY_SLOW = &H80000
Public Const MCI_ANIM_PLAY_SCAN = &H100000

'  flags for dwFlags parameter of MCI_STEP command message
Public Const MCI_ANIM_STEP_REVERSE = &H10000
Public Const MCI_ANIM_STEP_FRAMES = &H20000

'  flags for dwItem field of MCI_STATUS_PARMS parameter block
Public Const MCI_ANIM_STATUS_SPEED = &H4001&
Public Const MCI_ANIM_STATUS_FORWARD = &H4002&
Public Const MCI_ANIM_STATUS_HWND = &H4003&
Public Const MCI_ANIM_STATUS_HPAL = &H4004&
Public Const MCI_ANIM_STATUS_STRETCH = &H4005&

'  flags for the dwFlags parameter of MCI_INFO command message
Public Const MCI_ANIM_INFO_TEXT = &H10000

'  flags for dwItem field of MCI_GETDEVCAPS_PARMS parameter block
Public Const MCI_ANIM_GETDEVCAPS_CAN_REVERSE = &H4001&
Public Const MCI_ANIM_GETDEVCAPS_FAST_RATE = &H4002&
Public Const MCI_ANIM_GETDEVCAPS_SLOW_RATE = &H4003&
Public Const MCI_ANIM_GETDEVCAPS_NORMAL_RATE = &H4004&
Public Const MCI_ANIM_GETDEVCAPS_PALETTES = &H4006&
Public Const MCI_ANIM_GETDEVCAPS_CAN_STRETCH = &H4007&
Public Const MCI_ANIM_GETDEVCAPS_MAX_WINDOWS = &H4008&

'  flags for the MCI_REALIZE command message
Public Const MCI_ANIM_REALIZE_NORM = &H10000
Public Const MCI_ANIM_REALIZE_BKGD = &H20000

'  flags for dwFlags parameter of MCI_WINDOW command message
Public Const MCI_ANIM_WINDOW_HWND = &H10000
Public Const MCI_ANIM_WINDOW_STATE = &H40000
Public Const MCI_ANIM_WINDOW_TEXT = &H80000
Public Const MCI_ANIM_WINDOW_ENABLE_STRETCH = &H100000
Public Const MCI_ANIM_WINDOW_DISABLE_STRETCH = &H200000

'  flags for hWnd field of MCI_ANIM_WINDOW_PARMS parameter block
'  MCI_WINDOW command message, (dwFlags == MCI_ANIM_WINDOW_HWND)
Public Const MCI_ANIM_WINDOW_DEFAULT = &H0&

'  flags for dwFlags parameter of MCI_PUT command message
Public Const MCI_ANIM_RECT = &H10000
Public Const MCI_ANIM_PUT_SOURCE = &H20000      '  also  MCI_WHERE
Public Const MCI_ANIM_PUT_DESTINATION = &H40000      '  also  MCI_WHERE

'  flags for dwFlags parameter of MCI_WHERE command message
Public Const MCI_ANIM_WHERE_SOURCE = &H20000
Public Const MCI_ANIM_WHERE_DESTINATION = &H40000

'  flags for dwFlags parameter of MCI_UPDATE command message
Public Const MCI_ANIM_UPDATE_HDC = &H20000

Type MCI_ANIM_OPEN_PARMS
        dwCallback As Long
        wDeviceID As Long
        lpstrDeviceType As String
        lpstrElementName As String
        lpstrAlias As String
        dwStyle As Long
        hWndParent As Long
End Type

Type MCI_ANIM_PLAY_PARMS
        dwCallback As Long
        dwFrom As Long
        dwTo As Long
        dwSpeed As Long
End Type

Type MCI_ANIM_STEP_PARMS
        dwCallback As Long
        dwFrames As Long
End Type

Type MCI_ANIM_WINDOW_PARMS
        dwCallback As Long
        hwnd As Long
        nCmdShow As Long
        lpstrText As String
End Type

Type MCI_ANIM_RECT_PARMS
        dwCallback As Long
        rc As Rect
End Type

Type MCI_ANIM_UPDATE_PARMS
        dwCallback As Long
        rc As Rect
        hdc As Long
End Type

'  flags for dwFlags parameter of MCI_OPEN command message
Public Const MCI_OVLY_OPEN_WS = &H10000
Public Const MCI_OVLY_OPEN_PARENT = &H20000

'  flags for dwFlags parameter of MCI_STATUS command message
Public Const MCI_OVLY_STATUS_HWND = &H4001&
Public Const MCI_OVLY_STATUS_STRETCH = &H4002&

'  flags for dwFlags parameter of MCI_INFO command message
Public Const MCI_OVLY_INFO_TEXT = &H10000

'  flags for dwItem field of MCI_GETDEVCAPS_PARMS parameter block
Public Const MCI_OVLY_GETDEVCAPS_CAN_STRETCH = &H4001&
Public Const MCI_OVLY_GETDEVCAPS_CAN_FREEZE = &H4002&
Public Const MCI_OVLY_GETDEVCAPS_MAX_WINDOWS = &H4003&

'  flags for dwFlags parameter of MCI_WINDOW command message
Public Const MCI_OVLY_WINDOW_HWND = &H10000
Public Const MCI_OVLY_WINDOW_STATE = &H40000
Public Const MCI_OVLY_WINDOW_TEXT = &H80000
Public Const MCI_OVLY_WINDOW_ENABLE_STRETCH = &H100000
Public Const MCI_OVLY_WINDOW_DISABLE_STRETCH = &H200000

'  flags for hWnd parameter of MCI_OVLY_WINDOW_PARMS parameter block
Public Const MCI_OVLY_WINDOW_DEFAULT = &H0&

'  flags for dwFlags parameter of MCI_PUT command message
Public Const MCI_OVLY_RECT = &H10000
Public Const MCI_OVLY_PUT_SOURCE = &H20000
Public Const MCI_OVLY_PUT_DESTINATION = &H40000
Public Const MCI_OVLY_PUT_FRAME = &H80000
Public Const MCI_OVLY_PUT_VIDEO = &H100000

'  flags for dwFlags parameter of MCI_WHERE command message
Public Const MCI_OVLY_WHERE_SOURCE = &H20000
Public Const MCI_OVLY_WHERE_DESTINATION = &H40000
Public Const MCI_OVLY_WHERE_FRAME = &H80000
Public Const MCI_OVLY_WHERE_VIDEO = &H100000

Type MCI_OVLY_OPEN_PARMS
        dwCallback As Long
        wDeviceID As Long
        lpstrDeviceType As String
        lpstrElementName As String
        lpstrAlias As String
        dwStyle As Long
        hWndParent As Long
End Type

Type MCI_OVLY_WINDOW_PARMS
        dwCallback As Long
        hwnd As Long
        nCmdShow As Long
        lpstrText As String
End Type

Type MCI_OVLY_RECT_PARMS
        dwCallback As Long
        rc As Rect
End Type

Type MCI_OVLY_SAVE_PARMS
        dwCallback As Long
        lpFileName As String
        rc As Rect
End Type

Type MCI_OVLY_LOAD_PARMS
        dwCallback As Long
        lpFileName As String
        rc As Rect
End Type

Public Const CAPS1 = 94              '  other caps
Public Const C1_TRANSPARENT = &H1     '  new raster cap
Public Const NEWTRANSPARENT = 3  '  use with SetBkMode()

Public Const QUERYROPSUPPORT = 40  '  use to determine ROP support

Public Const SELECTDIB = 41  '  DIB.DRV select dib escape

' ----------------
' shell association database management functions
' -----------------

'  error values for ShellExecute() beyond the regular WinExec() codes
Public Const SE_ERR_SHARE = 26
Public Const SE_ERR_ASSOCINCOMPLETE = 27
Public Const SE_ERR_DDETIMEOUT = 28
Public Const SE_ERR_DDEFAIL = 29
Public Const SE_ERR_DDEBUSY = 30
Public Const SE_ERR_NOASSOC = 31

' -------------
' Print APIs
' -------------

Type PRINTER_INFO_1
        flags As Long
        pDescription As String
        pName As String
        pComment As String
End Type

Type PRINTER_INFO_2
        pServerName As String
        pPrinterName As String
        pShareName As String
        pPortName As String
        pDriverName As String
        pComment As String
        pLocation As String
        pDevMode As DEVMODE
        pSepFile As String
        pPrintProcessor As String
        pDatatype As String
        pParameters As String
        pSecurityDescriptor As SECURITY_DESCRIPTOR
        Attributes As Long
        Priority As Long
        DefaultPriority As Long
        StartTime As Long
        UntilTime As Long
        Status As Long
        cJobs As Long
        AveragePPM As Long
End Type

Type PRINTER_INFO_3
        pSecurityDescriptor As SECURITY_DESCRIPTOR
End Type

Public Const PRINTER_CONTROL_PAUSE = 1
Public Const PRINTER_CONTROL_RESUME = 2
Public Const PRINTER_CONTROL_PURGE = 3

Public Const PRINTER_STATUS_PAUSED = &H1
Public Const PRINTER_STATUS_ERROR = &H2
Public Const PRINTER_STATUS_PENDING_DELETION = &H4
Public Const PRINTER_STATUS_PAPER_JAM = &H8
Public Const PRINTER_STATUS_PAPER_OUT = &H10
Public Const PRINTER_STATUS_MANUAL_FEED = &H20
Public Const PRINTER_STATUS_PAPER_PROBLEM = &H40
Public Const PRINTER_STATUS_OFFLINE = &H80
Public Const PRINTER_STATUS_IO_ACTIVE = &H100
Public Const PRINTER_STATUS_BUSY = &H200
Public Const PRINTER_STATUS_PRINTING = &H400
Public Const PRINTER_STATUS_OUTPUT_BIN_FULL = &H800
Public Const PRINTER_STATUS_NOT_AVAILABLE = &H1000
Public Const PRINTER_STATUS_WAITING = &H2000
Public Const PRINTER_STATUS_PROCESSING = &H4000
Public Const PRINTER_STATUS_INITIALIZING = &H8000
Public Const PRINTER_STATUS_WARMING_UP = &H10000
Public Const PRINTER_STATUS_TONER_LOW = &H20000
Public Const PRINTER_STATUS_NO_TONER = &H40000
Public Const PRINTER_STATUS_PAGE_PUNT = &H80000
Public Const PRINTER_STATUS_USER_INTERVENTION = &H100000
Public Const PRINTER_STATUS_OUT_OF_MEMORY = &H200000
Public Const PRINTER_STATUS_DOOR_OPEN = &H400000

Public Const PRINTER_ATTRIBUTE_QUEUED = &H1
Public Const PRINTER_ATTRIBUTE_DIRECT = &H2
Public Const PRINTER_ATTRIBUTE_DEFAULT = &H4
Public Const PRINTER_ATTRIBUTE_SHARED = &H8
Public Const PRINTER_ATTRIBUTE_NETWORK = &H10
Public Const PRINTER_ATTRIBUTE_HIDDEN = &H20
Public Const PRINTER_ATTRIBUTE_LOCAL = &H40

Public Const NO_PRIORITY = 0
Public Const MAX_PRIORITY = 99
Public Const MIN_PRIORITY = 1
Public Const DEF_PRIORITY = 1

Type JOB_INFO_1
        JobId As Long
        pPrinterName As String
        pMachineName As String
        pUserName As String
        pDocument As String
        pDatatype As String
        pStatus As String
        Status As Long
        Priority As Long
        Position As Long
        TotalPages As Long
        PagesPrinted As Long
        Submitted As SYSTEMTIME
End Type

Type JOB_INFO_2
        JobId As Long
        pPrinterName As String
        pMachineName As String
        pUserName As String
        pDocument As String
        pNotifyName As String
        pDatatype As String
        pPrintProcessor As String
        pParameters As String
        pDriverName As String
        pDevMode As DEVMODE
        pStatus As String
        pSecurityDescriptor As SECURITY_DESCRIPTOR
        Status As Long
        Priority As Long
        Position As Long
        StartTime As Long
        UntilTime As Long
        TotalPages As Long
        Size As Long
        Submitted As SYSTEMTIME
        time As Long
        PagesPrinted As Long
End Type

Public Const JOB_CONTROL_PAUSE = 1
Public Const JOB_CONTROL_RESUME = 2
Public Const JOB_CONTROL_CANCEL = 3
Public Const JOB_CONTROL_RESTART = 4

Public Const JOB_STATUS_PAUSED = &H1
Public Const JOB_STATUS_ERROR = &H2
Public Const JOB_STATUS_DELETING = &H4
Public Const JOB_STATUS_SPOOLING = &H8
Public Const JOB_STATUS_PRINTING = &H10
Public Const JOB_STATUS_OFFLINE = &H20
Public Const JOB_STATUS_PAPEROUT = &H40
Public Const JOB_STATUS_PRINTED = &H80

Public Const JOB_POSITION_UNSPECIFIED = 0

Type ADDJOB_INFO_1
        Path As String
        JobId As Long
End Type

Type DRIVER_INFO_1
        pName As String
End Type

Type DRIVER_INFO_2
        cVersion As Long
        pName As String
        pEnvironment As String
        pDriverPath As String
        pDataFile As String
        pConfigFile As String
End Type

Type DOC_INFO_1
        pDocName As String
        pOutputFile As String
        pDatatype As String
End Type

Type FORM_INFO_1
        pName As String
        Size As SIZEL
        ImageableArea As RECTL
End Type

Public Const FORM_BUILTIN = &H1

Type PRINTPROCESSOR_INFO_1
        pName As String
End Type

Type PORT_INFO_1
        pName As String
End Type

Type MONITOR_INFO_1
        pName As String
End Type

Type MONITOR_INFO_2
        pName As String
        pEnvironment As String
        pDLLName As String
End Type

Type DATATYPES_INFO_1
        pName As String
End Type

Type PRINTER_DEFAULTS
        pDatatype As String
        pDevMode As DEVMODE
        DesiredAccess As Long
End Type

Type PRINTER_INFO_4
pPrinterName As String
pServerName As String
Attributes As Long
End Type

Type PRINTER_INFO_5
        pPrinterName As String
        pPortName As String
        Attributes As Long
        DeviceNotSelectedTimeout As Long
        TransmissionRetryTimeout As Long
End Type

Public Const PRINTER_CONTROL_SET_STATUS = 4
Public Const PRINTER_ATTRIBUTE_WORK_OFFLINE = &H400
Public Const PRINTER_ATTRIBUTE_ENABLE_BIDI = &H800
Public Const JOB_CONTROL_DELETE = 5
Public Const JOB_STATUS_USER_INTERVENTION = &H10000

Type DRIVER_INFO_3
        cVersion As Long
        pName As String                    '  QMS 810
        pEnvironment As String             '  Win32 x86
        pDriverPath As String              '  c:\drivers\pscript.dll
        pDataFile As String                '  c:\drivers\QMS810.PPD
        pConfigFile As String              '  c:\drivers\PSCRPTUI.DLL
        pHelpFile As String                '  c:\drivers\PSCRPTUI.HLP
        pDependentFiles As String          '
        pMonitorName As String             '  "PJL monitor"
        pDefaultDataType As String         '  "EMF"
End Type

Type DOC_INFO_2
        pDocName As String
        pOutputFile As String
        pDatatype As String
        dwMode As Long
        JobId As Long
End Type

Public Const DI_CHANNEL = 1                  '  start direct read/write channel,
Public Const DI_READ_SPOOL_JOB = 3

Type PORT_INFO_2
        pPortName As String
        pMonitorName As String
        pDescription As String
        fPortType As Long
        Reserved As Long
End Type

Public Const PORT_TYPE_WRITE = &H1
Public Const PORT_TYPE_READ = &H2
Public Const PORT_TYPE_REDIRECTED = &H4
Public Const PORT_TYPE_NET_ATTACHED = &H8

Declare Function EnumPrinters Lib "winspool.drv" Alias "EnumPrintersA" (ByVal flags As Long, ByVal name As String, ByVal Level As Long, pPrinterEnum As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long

Declare Function EnumPrinterPropertySheets Lib "winspool.drv" Alias "EnumPrinterPropertySheets" (hPrinter As Long, hwnd As Long, lpfnAdd As Long, ByVal lParam As Long) As Long

Public Const PRINTER_ENUM_DEFAULT = &H1
Public Const PRINTER_ENUM_LOCAL = &H2
Public Const PRINTER_ENUM_CONNECTIONS = &H4
Public Const PRINTER_ENUM_FAVORITE = &H4
Public Const PRINTER_ENUM_NAME = &H8
Public Const PRINTER_ENUM_REMOTE = &H10
Public Const PRINTER_ENUM_SHARED = &H20
Public Const PRINTER_ENUM_NETWORK = &H40

Public Const PRINTER_ENUM_EXPAND = &H4000
Public Const PRINTER_ENUM_CONTAINER = &H8000

Public Const PRINTER_ENUM_ICONMASK = &HFF0000
Public Const PRINTER_ENUM_ICON1 = &H10000
Public Const PRINTER_ENUM_ICON2 = &H20000
Public Const PRINTER_ENUM_ICON3 = &H40000
Public Const PRINTER_ENUM_ICON4 = &H80000
Public Const PRINTER_ENUM_ICON5 = &H100000
Public Const PRINTER_ENUM_ICON6 = &H200000
Public Const PRINTER_ENUM_ICON7 = &H400000
Public Const PRINTER_ENUM_ICON8 = &H800000

Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As PRINTER_DEFAULTS) As Long
Declare Function ResetPrinter Lib "winspool.drv" Alias "ResetPrinterA" (ByVal hPrinter As Long, pDefault As PRINTER_DEFAULTS) As Long
Declare Function SetJob Lib "winspool.drv" Alias "SetJobA" (ByVal hPrinter As Long, ByVal JobId As Long, ByVal Level As Long, pJob As Byte, ByVal Command As Long) As Long
Declare Function GetJob Lib "winspool.drv" Alias "GetJobA" (ByVal hPrinter As Long, ByVal JobId As Long, ByVal Level As Long, pJob As Byte, ByVal cdBuf As Long, pcbNeeded As Long) As Long
Declare Function EnumJobs Lib "winspool.drv" Alias "EnumJobsA" (ByVal hPrinter As Long, ByVal FirstJob As Long, ByVal NoJobs As Long, ByVal Level As Long, pJob As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
Declare Function AddPrinter Lib "winspool.drv" Alias "AddPrinterA" (ByVal pName As String, ByVal Level As Long, pPrinter As Any) As Long

Declare Function AddPrinterDriver Lib "winspool.drv" Alias "AddPrinterDriverA" (ByVal pName As String, ByVal Level As Long, pDriverInfo As Any) As Long

Declare Function EnumPrinterDrivers Lib "winspool.drv" Alias "EnumPrinterDriversA" (ByVal pName As String, ByVal pEnvironment As String, ByVal Level As Long, pDriverInfo As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcRetruned As Long) As Long
Declare Function GetPrinterDriver Lib "winspool.drv" Alias "GetPrinterDriverA" (ByVal hPrinter As Long, ByVal pEnvironment As String, ByVal Level As Long, pDriverInfo As Byte, ByVal cdBuf As Long, pcbNeeded As Long) As Long
Declare Function GetPrinterDriverDirectory Lib "winspool.drv" Alias "GetPrinterDriverDirectoryA" (ByVal pName As String, ByVal pEnvironment As String, ByVal Level As Long, pDriverDirectory As Byte, ByVal cdBuf As Long, pcbNeeded As Long) As Long
Declare Function DeletePrinterDriver Lib "winspool.drv" Alias "DeletePrinterDriverA" (ByVal pName As String, ByVal pEnvironment As String, ByVal pDriverName As String) As Long

Declare Function AddPrintProcessor Lib "winspool.drv" Alias "AddPrintProcessorA" (ByVal pName As String, ByVal pEnvironment As String, ByVal pPathName As String, ByVal pPrintProcessorName As String) As Long
Declare Function EnumPrintProcessors Lib "winspool.drv" Alias "EnumPrintProcessorsA" (ByVal pName As String, ByVal pEnvironment As String, ByVal Level As Long, pPrintProcessorInfo As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
Declare Function GetPrintProcessorDirectory Lib "winspool.drv" Alias "GetPrintProcessorDirectoryA" (ByVal pName As String, ByVal pEnvironment As String, ByVal Level As Long, ByVal pPrintProcessorInfo As String, ByVal cdBuf As Long, pcbNeeded As Long) As Long
Declare Function EnumPrintProcessorDatatypes Lib "winspool.drv" Alias "EnumPrintProcessorDatatypesA" (ByVal pName As String, ByVal pPrintProcessorName As String, ByVal Level As Long, pDatatypes As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcRetruned As Long) As Long
Declare Function DeletePrintProcessor Lib "winspool.drv" Alias "DeletePrintProcessorA" (ByVal pName As String, ByVal pEnvironment As String, ByVal pPrintProcessorName As String) As Long

Declare Function StartDocPrinter Lib "winspool.drv" Alias "StartDocPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pDocInfo As Byte) As Long
Declare Function StartPagePrinter Lib "winspool.drv" Alias "StartPagePrinter" (ByVal hPrinter As Long) As Long
Declare Function WritePrinter Lib "winspool.drv" Alias "WritePrinter" (ByVal hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, pcWritten As Long) As Long
Declare Function EndPagePrinter Lib "winspool.drv" Alias "EndPagePrinter" (ByVal hPrinter As Long) As Long
Declare Function AbortPrinter Lib "winspool.drv" Alias "AbortPrinter" (ByVal hPrinter As Long) As Long
Declare Function ReadPrinter Lib "winspool.drv" Alias "ReadPrinter" (ByVal hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, pNoBytesRead As Long) As Long
Declare Function EndDocPrinter Lib "winspool.drv" Alias "EndDocPrinter" (ByVal hPrinter As Long) As Long

Declare Function AddJob Lib "winspool.drv" Alias "AddJobA" (ByVal hPrinter As Long, ByVal Level As Long, pData As Byte, ByVal cdBuf As Long, pcbNeeded As Long) As Long
Declare Function ScheduleJob Lib "winspool.drv" Alias "ScheduleJob" (ByVal hPrinter As Long, ByVal JobId As Long) As Long
Declare Function PrinterProperties Lib "winspool.drv" Alias "PrinterProperties" (ByVal hwnd As Long, ByVal hPrinter As Long) As Long
Declare Function DocumentProperties Lib "winspool.drv" Alias "DocumentPropertiesA" (ByVal hwnd As Long, ByVal hPrinter As Long, ByVal pDeviceName As String, pDevModeOutput As DEVMODE, pDevModeInput As DEVMODE, ByVal fMode As Long) As Long
Declare Function AdvancedDocumentProperties Lib "winspool.drv" Alias "AdvancedDocumentPropertiesA" (ByVal hwnd As Long, ByVal hPrinter As Long, ByVal pDeviceName As String, pDevModeOutput As DEVMODE, pDevModeInput As DEVMODE) As Long

Declare Function GetPrinterData Lib "winspool.drv" Alias "GetPrinterDataA" (ByVal hPrinter As Long, ByVal pValueName As String, pType As Long, pData As Byte, ByVal nSize As Long, pcbNeeded As Long) As Long
Declare Function SetPrinterData Lib "winspool.drv" Alias "SetPrinterDataA" (ByVal hPrinter As Long, ByVal pValueName As String, ByVal dwType As Long, pData As Byte, ByVal cbData As Long) As Long
Declare Function WaitForPrinterChange Lib "winspool.drv" Alias "WaitForPrinterChange" (ByVal hPrinter As Long, ByVal flags As Long) As Long

Public Const PRINTER_CHANGE_ADD_PRINTER = &H1
Public Const PRINTER_CHANGE_SET_PRINTER = &H2
Public Const PRINTER_CHANGE_DELETE_PRINTER = &H4
Public Const PRINTER_CHANGE_PRINTER = &HFF
Public Const PRINTER_CHANGE_ADD_JOB = &H100
Public Const PRINTER_CHANGE_SET_JOB = &H200
Public Const PRINTER_CHANGE_DELETE_JOB = &H400
Public Const PRINTER_CHANGE_WRITE_JOB = &H800
Public Const PRINTER_CHANGE_JOB = &HFF00
Public Const PRINTER_CHANGE_ADD_FORM = &H10000
Public Const PRINTER_CHANGE_SET_FORM = &H20000
Public Const PRINTER_CHANGE_DELETE_FORM = &H40000
Public Const PRINTER_CHANGE_FORM = &H70000
Public Const PRINTER_CHANGE_ADD_PORT = &H100000
Public Const PRINTER_CHANGE_CONFIGURE_PORT = &H200000
Public Const PRINTER_CHANGE_DELETE_PORT = &H400000
Public Const PRINTER_CHANGE_PORT = &H700000
Public Const PRINTER_CHANGE_ADD_PRINT_PROCESSOR = &H1000000
Public Const PRINTER_CHANGE_DELETE_PRINT_PROCESSOR = &H4000000
Public Const PRINTER_CHANGE_PRINT_PROCESSOR = &H7000000
Public Const PRINTER_CHANGE_ADD_PRINTER_DRIVER = &H10000000
Public Const PRINTER_CHANGE_DELETE_PRINTER_DRIVER = &H40000000
Public Const PRINTER_CHANGE_PRINTER_DRIVER = &H70000000
Public Const PRINTER_CHANGE_TIMEOUT = &H80000000
Public Const PRINTER_CHANGE_ALL = &H7777FFFF

Declare Function PrinterMessageBox Lib "winspool.drv" Alias "PrinterMessageBoxA" (ByVal hPrinter As Long, ByVal error As Long, ByVal hwnd As Long, ByVal pText As String, ByVal pCaption As String, ByVal dwType As Long) As Long

Public Const PRINTER_ERROR_INFORMATION = &H80000000
Public Const PRINTER_ERROR_WARNING = &H40000000
Public Const PRINTER_ERROR_SEVERE = &H20000000

Public Const PRINTER_ERROR_OUTOFPAPER = &H1
Public Const PRINTER_ERROR_JAM = &H2
Public Const PRINTER_ERROR_OUTOFTONER = &H4

Declare Function ClosePrinter Lib "winspool.drv" Alias "ClosePrinter" (ByVal hPrinter As Long) As Long
Declare Function AddForm Lib "winspool.drv" Alias "AddFormA" (ByVal hPrinter As Long, ByVal Level As Long, pForm As Byte) As Long
Declare Function DeleteForm Lib "winspool.drv" Alias "DeleteFormA" (ByVal hPrinter As Long, ByVal pFormName As String) As Long
Declare Function GetForm Lib "winspool.drv" Alias "GetFormA" (ByVal hPrinter As Long, ByVal pFormName As String, ByVal Level As Long, pForm As Byte, ByVal cbBuf As Long, pcbNeeded As Long) As Long
Declare Function SetForm Lib "winspool.drv" Alias "SetFormA" (ByVal hPrinter As Long, ByVal pFormName As String, ByVal Level As Long, pForm As Byte) As Long
Declare Function EnumForms Lib "winspool.drv" Alias "EnumFormsA" (ByVal hPrinter As Long, ByVal Level As Long, pForm As Byte, ByVal cbBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long

Declare Function EnumMonitors Lib "winspool.drv" Alias "EnumMonitorsA" (ByVal pName As String, ByVal Level As Long, pMonitors As Byte, ByVal cbBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
Declare Function AddMonitor Lib "winspool.drv" Alias "AddMonitorA" (ByVal pName As String, ByVal Level As Long, pMonitors As Byte) As Long
Declare Function DeleteMonitor Lib "winspool.drv" Alias "DeleteMonitorA" (ByVal pName As String, ByVal pEnvironment As String, ByVal pMonitorName As String) As Long

Declare Function EnumPorts Lib "winspool.drv" Alias "EnumPortsA" (ByVal pName As String, ByVal Level As Long, ByVal lpbPorts As Long, ByVal cbBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
Declare Function AddPort Lib "winspool.drv" Alias "AddPortA" (ByVal pName As String, ByVal hwnd As Long, ByVal pMonitorName As String) As Long
Declare Function ConfigurePort Lib "winspool.drv" Alias "ConfigurePortA" (ByVal pName As String, ByVal hwnd As Long, ByVal pPortName As String) As Long
Declare Function DeletePort Lib "winspool.drv" Alias "DeletePortA" (ByVal pName As String, ByVal hwnd As Long, ByVal pPortName As String) As Long

Declare Function AddPrinterConnection Lib "winspool.drv" Alias "AddPrinterConnectionA" (ByVal pName As String) As Long

Declare Function DeletePrinterConnection Lib "winspool.drv" Alias "DeletePrinterConnectionA" (ByVal pName As String) As Long
Declare Function ConnectToPrinterDlg Lib "winspool.drv" Alias "ConnectToPrinterDlg" (ByVal hwnd As Long, ByVal flags As Long) As Long

Type PROVIDOR_INFO_1
        pName As String
        pEnvironment As String
        pDLLName As String
End Type

Declare Function AddPrintProvidor Lib "winspool.drv" Alias "AddPrintProvidorA" (ByVal pName As String, ByVal Level As Long, pProvidorInfo As Byte) As Long
Declare Function DeletePrintProvidor Lib "winspool.drv" Alias "DeletePrintProvidorA" (ByVal pName As String, ByVal pEnvironment As String, ByVal pPrintProvidorName As String) As Long

Public Const SERVER_ACCESS_ADMINISTER = &H1
Public Const SERVER_ACCESS_ENUMERATE = &H2

Public Const PRINTER_ACCESS_ADMINISTER = &H4
Public Const PRINTER_ACCESS_USE = &H8

Public Const JOB_ACCESS_ADMINISTER = &H10

' Access rights for print servers

Public Const SERVER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SERVER_ACCESS_ADMINISTER Or SERVER_ACCESS_ENUMERATE)
Public Const SERVER_READ = (STANDARD_RIGHTS_READ Or SERVER_ACCESS_ENUMERATE)
Public Const SERVER_WRITE = (STANDARD_RIGHTS_WRITE Or SERVER_ACCESS_ADMINISTER Or SERVER_ACCESS_ENUMERATE)
Public Const SERVER_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or SERVER_ACCESS_ENUMERATE)

' Access rights for printers
Public Const PRINTER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or PRINTER_ACCESS_ADMINISTER Or PRINTER_ACCESS_USE)
Public Const PRINTER_READ = (STANDARD_RIGHTS_READ Or PRINTER_ACCESS_USE)
Public Const PRINTER_WRITE = (STANDARD_RIGHTS_WRITE Or PRINTER_ACCESS_USE)
Public Const PRINTER_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or PRINTER_ACCESS_USE)

' Access rights for jobs
Public Const JOB_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or JOB_ACCESS_ADMINISTER)
Public Const JOB_READ = (STANDARD_RIGHTS_READ Or JOB_ACCESS_ADMINISTER)
Public Const JOB_WRITE = (STANDARD_RIGHTS_WRITE Or JOB_ACCESS_ADMINISTER)
Public Const JOB_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or JOB_ACCESS_ADMINISTER)

'  Windows Network support

'  RESOURCE ENUMERATION

Public Const RESOURCE_CONNECTED = &H1
Public Const RESOURCE_PUBLICNET = &H2
Public Const RESOURCE_REMEMBERED = &H3

Public Const RESOURCETYPE_ANY = &H0
Public Const RESOURCETYPE_DISK = &H1
Public Const RESOURCETYPE_PRINT = &H2
Public Const RESOURCETYPE_UNKNOWN = &HFFFF

Public Const RESOURCEUSAGE_CONNECTABLE = &H1
Public Const RESOURCEUSAGE_CONTAINER = &H2
Public Const RESOURCEUSAGE_RESERVED = &H80000000

Public Const RESOURCEDISPLAYTYPE_GENERIC = &H0
Public Const RESOURCEDISPLAYTYPE_DOMAIN = &H1
Public Const RESOURCEDISPLAYTYPE_SERVER = &H2
Public Const RESOURCEDISPLAYTYPE_SHARE = &H3
Public Const RESOURCEDISPLAYTYPE_FILE = &H4
Public Const RESOURCEDISPLAYTYPE_GROUP = &H5

Type NETRESOURCE
        dwScope As Long
        dwType As Long
        dwDisplayType As Long
        dwUsage As Long
        lpLocalName As String
        lpRemoteName As String
        lpComment As String
        lpProvider As String
End Type

Public Const CONNECT_UPDATE_PROFILE = &H1

Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" (lpNetResource As NETRESOURCE, ByVal lpPassword As String, ByVal lpUserName As String, ByVal dwFlags As Long) As Long
Declare Function WNetCancelConnection Lib "mpr.dll" Alias "WNetCancelConnectionA" (ByVal lpszName As String, ByVal bForce As Long) As Long
Declare Function WNetCancelConnection2 Lib "mpr.dll" Alias "WNetCancelConnection2A" (ByVal lpName As String, ByVal dwFlags As Long, ByVal fForce As Long) As Long
Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal lpszLocalName As String, ByVal lpszRemoteName As String, cbRemoteName As Long) As Long
Declare Function WNetOpenEnum Lib "mpr.dll" Alias "WNetOpenEnumA" (ByVal dwScope As Long, ByVal dwType As Long, ByVal dwUsage As Long, lpNetResource As NETRESOURCE, lphEnum As Long) As Long
Declare Function WNetEnumResource Lib "mpr.dll" Alias "WNetEnumResourceA" (ByVal hEnum As Long, lpcCount As Long, lpBuffer As Any, lpBufferSize As Long) As Long
Declare Function WNetCloseEnum Lib "mpr.dll" Alias "WNetCloseEnum" (ByVal hEnum As Long) As Long

Declare Function WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpName As String, ByVal lpUserName As String, lpnLength As Long) As Long

Declare Function WNetConnectionDialog Lib "mpr.dll" Alias "WNetConnectionDialog" (ByVal hwnd As Long, ByVal dwType As Long) As Long
Declare Function WNetDisconnectDialog Lib "mpr.dll" Alias "WNetDisconnectDialog" (ByVal hwnd As Long, ByVal dwType As Long) As Long

Declare Function WNetGetLastError Lib "mpr.dll" Alias "WNetGetLastErrorA" (lpError As Long, ByVal lpErrorBuf As String, ByVal nErrorBufSize As Long, ByVal lpNameBuf As String, ByVal nNameBufSize As Long) As Long

' Status Codes

' This section is provided for backward compatibility.  Use of the ERROR_
' codes is preferred.  The WN_ error codes may not be available in future
' releases.

' General

Public Const WN_SUCCESS = NO_ERROR
Public Const WN_NOT_SUPPORTED = ERROR_NOT_SUPPORTED
Public Const WN_NET_ERROR = ERROR_UNEXP_NET_ERR
Public Const WN_MORE_DATA = ERROR_MORE_DATA
Public Const WN_BAD_POINTER = ERROR_INVALID_ADDRESS
Public Const WN_BAD_VALUE = ERROR_INVALID_PARAMETER
Public Const WN_BAD_PASSWORD = ERROR_INVALID_PASSWORD
Public Const WN_ACCESS_DENIED = ERROR_ACCESS_DENIED
Public Const WN_FUNCTION_BUSY = ERROR_BUSY
Public Const WN_WINDOWS_ERROR = ERROR_UNEXP_NET_ERR
Public Const WN_BAD_USER = ERROR_BAD_USERNAME
Public Const WN_OUT_OF_MEMORY = ERROR_NOT_ENOUGH_MEMORY
Public Const WN_NO_NETWORK = ERROR_NO_NETWORK
Public Const WN_EXTENDED_ERROR = ERROR_EXTENDED_ERROR

' Connection

Public Const WN_NOT_CONNECTED = ERROR_NOT_CONNECTED
Public Const WN_OPEN_FILES = ERROR_OPEN_FILES
Public Const WN_DEVICE_IN_USE = ERROR_DEVICE_IN_USE
Public Const WN_BAD_NETNAME = ERROR_BAD_NET_NAME
Public Const WN_BAD_LOCALNAME = ERROR_BAD_DEVICE
Public Const WN_ALREADY_CONNECTED = ERROR_ALREADY_ASSIGNED
Public Const WN_DEVICE_ERROR = ERROR_GEN_FAILURE
Public Const WN_CONNECTION_CLOSED = ERROR_CONNECTION_UNAVAIL
Public Const WN_NO_NET_OR_BAD_PATH = ERROR_NO_NET_OR_BAD_PATH
Public Const WN_BAD_PROVIDER = ERROR_BAD_PROVIDER
Public Const WN_CANNOT_OPEN_PROFILE = ERROR_CANNOT_OPEN_PROFILE
Public Const WN_BAD_PROFILE = ERROR_BAD_PROFILE

' Enumeration

Public Const WN_BAD_HANDLE = ERROR_INVALID_HANDLE
Public Const WN_NO_MORE_ENTRIES = ERROR_NO_MORE_ITEMS
Public Const WN_NOT_CONTAINER = ERROR_NOT_CONTAINER

Public Const WN_NO_ERROR = NO_ERROR

' This section contains the definitions
' for portable NetBIOS 3.0 support.

Public Const NCBNAMSZ = 16  '  absolute length of a net name
Public Const MAX_LANA = 254  '  lana's in range 0 to MAX_LANA

Type NCB
        ncb_command As Integer
        ncb_retcode As Integer
        ncb_lsn As Integer
        ncb_num As Integer
        ncb_buffer As String
        ncb_length As Integer
        ncb_callname As String * NCBNAMSZ
        ncb_name As String * NCBNAMSZ
        ncb_rto As Integer
        ncb_sto As Integer
        ncb_post As Long
        ncb_lana_num As Integer
        ncb_cmd_cplt As Integer
        ncb_reserve(10) As Byte ' Reserved, must be 0
        ncb_event As Long
End Type

Type ADAPTER_STATUS
        adapter_address As String * 6
        rev_major As Integer
        reserved0 As Integer
        adapter_type As Integer
        rev_minor As Integer
        duration As Integer
        frmr_recv As Integer
        frmr_xmit As Integer
        iframe_recv_err As Integer
        xmit_aborts As Integer
        xmit_success As Long
        recv_success As Long
        iframe_xmit_err As Integer
        recv_buff_unavail As Integer
        t1_timeouts As Integer
        ti_timeouts As Integer
        Reserved1 As Long
        free_ncbs As Integer
        max_cfg_ncbs As Integer
        max_ncbs As Integer
        xmit_buf_unavail As Integer
        max_dgram_size As Integer
        pending_sess As Integer
        max_cfg_sess As Integer
        max_sess As Integer
        max_sess_pkt_size As Integer
        name_count As Integer
End Type

Type NAME_BUFFER
        name  As String * NCBNAMSZ
        name_num As Integer
        name_flags As Integer
End Type

programatrix

[code]
' values for name_flags bits.

Public Const NAME_FLAGS_MASK = &H87

Public Const GROUP_NAME = &H80
Public Const UNIQUE_NAME = &H0

Public Const REGISTERING = &H0
Public Const REGISTERED = &H4
Public Const DEREGISTERED = &H5
Public Const DUPLICATE = &H6
Public Const DUPLICATE_DEREG = &H7

Type SESSION_HEADER
        sess_name As Integer
        num_sess As Integer
        rcv_dg_outstanding As Integer
        rcv_any_outstanding As Integer
End Type

Type SESSION_BUFFER
        lsn As Integer
        State As Integer
        local_name As String * NCBNAMSZ
        remote_name As String * NCBNAMSZ
        rcvs_outstanding As Integer
        sends_outstanding As Integer
End Type

' Values for state
Public Const LISTEN_OUTSTANDING = &H1
Public Const CALL_PENDING = &H2
Public Const SESSION_ESTABLISHED = &H3
Public Const HANGUP_PENDING = &H4
Public Const HANGUP_COMPLETE = &H5
Public Const SESSION_ABORTED = &H6

Type LANA_ENUM
        Length As Integer
        lana(MAX_LANA) As Integer
End Type

Type FIND_NAME_HEADER
        node_count As Integer
        Reserved As Integer
        unique_group As Integer
End Type

Type FIND_NAME_BUFFER
        Length As Integer
        access_control As Integer
        frame_control As Integer
        destination_addr(6) As Integer
        source_addr(6) As Integer
        routing_info(18) As Integer
End Type

Type ACTION_HEADER
        transport_id As Long
        action_code As Integer
        Reserved As Integer
End Type

' Values for transport_id
Public Const ALL_TRANSPORTS = "M\0\0\0"
Public Const MS_NBF = "MNBF"

' NCB Command codes
Public Const NCBCALL = &H10  '  NCB CALL
Public Const NCBLISTEN = &H11  '  NCB LISTEN
Public Const NCBHANGUP = &H12  '  NCB HANG UP
Public Const NCBSEND = &H14  '  NCB SEND
Public Const NCBRECV = &H15  '  NCB RECEIVE
Public Const NCBRECVANY = &H16  '  NCB RECEIVE ANY
Public Const NCBCHAINSEND = &H17  '  NCB CHAIN SEND
Public Const NCBDGSEND = &H20  '  NCB SEND DATAGRAM
Public Const NCBDGRECV = &H21  '  NCB RECEIVE DATAGRAM
Public Const NCBDGSENDBC = &H22  '  NCB SEND BROADCAST DATAGRAM
Public Const NCBDGRECVBC = &H23  '  NCB RECEIVE BROADCAST DATAGRAM
Public Const NCBADDNAME = &H30  '  NCB ADD NAME
Public Const NCBDELNAME = &H31  '  NCB DELETE NAME
Public Const NCBRESET = &H32  '  NCB RESET
Public Const NCBASTAT = &H33  '  NCB ADAPTER STATUS
Public Const NCBSSTAT = &H34  '  NCB SESSION STATUS
Public Const NCBCANCEL = &H35  '  NCB CANCEL
Public Const NCBADDGRNAME = &H36  '  NCB ADD GROUP NAME
Public Const NCBENUM = &H37  '  NCB ENUMERATE LANA NUMBERS
Public Const NCBUNLINK = &H70  '  NCB UNLINK
Public Const NCBSENDNA = &H71  '  NCB SEND NO ACK
Public Const NCBCHAINSENDNA = &H72  '  NCB CHAIN SEND NO ACK
Public Const NCBLANSTALERT = &H73  '  NCB LAN STATUS ALERT
Public Const NCBACTION = &H77  '  NCB ACTION
Public Const NCBFINDNAME = &H78  '  NCB FIND NAME
Public Const NCBTRACE = &H79  '  NCB TRACE

Public Const ASYNCH = &H80  '  high bit set == asynchronous

' NCB Return codes
Public Const NRC_GOODRET = &H0   '  good return
                                '  also returned when ASYNCH request accepted
Public Const NRC_BUFLEN = &H1   '  illegal buffer length
Public Const NRC_ILLCMD = &H3   '  illegal command
Public Const NRC_CMDTMO = &H5   '  command timed out
Public Const NRC_INCOMP = &H6   '  message incomplete, issue another command
Public Const NRC_BADDR = &H7   '  illegal buffer address
Public Const NRC_SNUMOUT = &H8   '  session number out of range
Public Const NRC_NORES = &H9   '  no resource available
Public Const NRC_SCLOSED = &HA   '  session closed
Public Const NRC_CMDCAN = &HB   '  command cancelled
Public Const NRC_DUPNAME = &HD   '  duplicate name
Public Const NRC_NAMTFUL = &HE   '  name table full
Public Const NRC_ACTSES = &HF   '  no deletions, name has active sessions
Public Const NRC_LOCTFUL = &H11  '  local session table full
Public Const NRC_REMTFUL = &H12  '  remote session table full
Public Const NRC_ILLNN = &H13  '  illegal name number
Public Const NRC_NOCALL = &H14  '  no callname
Public Const NRC_NOWILD = &H15  '  cannot put  in NCB_NAME
Public Const NRC_INUSE = &H16  '  name in use on remote adapter
Public Const NRC_NAMERR = &H17  '  name deleted
Public Const NRC_SABORT = &H18  '  session ended abnormally
Public Const NRC_NAMCONF = &H19  '  name conflict detected
Public Const NRC_IFBUSY = &H21  '  interface busy, IRET before retrying
Public Const NRC_TOOMANY = &H22  '  too many commands outstanding, retry later
Public Const NRC_BRIDGE = &H23  '  ncb_lana_num field invalid
Public Const NRC_CANOCCR = &H24  '  command completed while cancel occurring
Public Const NRC_CANCEL = &H26  '  command not valid to cancel
Public Const NRC_DUPENV = &H30  '  name defined by anther local process
Public Const NRC_ENVNOTDEF = &H34  '  environment undefined. RESET required
Public Const NRC_OSRESNOTAV = &H35  '  required OS resources exhausted
Public Const NRC_MAXAPPS = &H36  '  max number of applications exceeded
Public Const NRC_NOSAPS = &H37  '  no saps available for netbios
Public Const NRC_NORESOURCES = &H38  '  requested resources are not available
Public Const NRC_INVADDRESS = &H39  '  invalid ncb address or length > segment
Public Const NRC_INVDDID = &H3B  '  invalid NCB DDID
Public Const NRC_LOCKFAIL = &H3C  '  lock of user area failed
Public Const NRC_OPENERR = &H3F  '  NETBIOS not loaded
Public Const NRC_SYSTEM = &H40  '  system error

Public Const NRC_PENDING = &HFF  '  asynchronous command is not yet finished

Declare Function Netbios Lib "netapi32.dll" Alias "Netbios" (pncb As NCB) As Byte

' Legal values for expression in except().
Public Const EXCEPTION_EXECUTE_HANDLER = 1
Public Const EXCEPTION_CONTINUE_SEARCH = 0
Public Const EXCEPTION_CONTINUE_EXECUTION = -1

' UI dialog constants and types

' ----Constants--------------------------------------------------------------
Public Const ctlFirst = &H400
Public Const ctlLast = &H4FF
    '  Push buttons
Public Const psh1 = &H400
Public Const psh2 = &H401
Public Const psh3 = &H402
Public Const psh4 = &H403
Public Const psh5 = &H404
Public Const psh6 = &H405
Public Const psh7 = &H406
Public Const psh8 = &H407
Public Const psh9 = &H408
Public Const psh10 = &H409
Public Const psh11 = &H40A
Public Const psh12 = &H40B
Public Const psh13 = &H40C
Public Const psh14 = &H40D
Public Const psh15 = &H40E
Public Const pshHelp = psh15
Public Const psh16 = &H40F
    '  Checkboxes
Public Const chx1 = &H410
Public Const chx2 = &H411
Public Const chx3 = &H412
Public Const chx4 = &H413
Public Const chx5 = &H414
Public Const chx6 = &H415
Public Const chx7 = &H416
Public Const chx8 = &H417
Public Const chx9 = &H418
Public Const chx10 = &H419
Public Const chx11 = &H41A
Public Const chx12 = &H41B
Public Const chx13 = &H41C
Public Const chx14 = &H41D
Public Const chx15 = &H41E
Public Const chx16 = &H41D
    '  Radio buttons
Public Const rad1 = &H420
Public Const rad2 = &H421
Public Const rad3 = &H422
Public Const rad4 = &H423
Public Const rad5 = &H424
Public Const rad6 = &H425
Public Const rad7 = &H426
Public Const rad8 = &H427
Public Const rad9 = &H428
Public Const rad10 = &H429
Public Const rad11 = &H42A
Public Const rad12 = &H42B
Public Const rad13 = &H42C
Public Const rad14 = &H42D
Public Const rad15 = &H42E
Public Const rad16 = &H42F
    '  Groups, frames, rectangles, and icons
Public Const grp1 = &H430
Public Const grp2 = &H431
Public Const grp3 = &H432
Public Const grp4 = &H433
Public Const frm1 = &H434
Public Const frm2 = &H435
Public Const frm3 = &H436
Public Const frm4 = &H437
Public Const rct1 = &H438
Public Const rct2 = &H439
Public Const rct3 = &H43A
Public Const rct4 = &H43B
Public Const ico1 = &H43C
Public Const ico2 = &H43D
Public Const ico3 = &H43E
Public Const ico4 = &H43F
    '  Static text
Public Const stc1 = &H440
Public Const stc2 = &H441
Public Const stc3 = &H442
Public Const stc4 = &H443
Public Const stc5 = &H444
Public Const stc6 = &H445
Public Const stc7 = &H446
Public Const stc8 = &H447
Public Const stc9 = &H448
Public Const stc10 = &H449
Public Const stc11 = &H44A
Public Const stc12 = &H44B
Public Const stc13 = &H44C
Public Const stc14 = &H44D
Public Const stc15 = &H44E
Public Const stc16 = &H44F
Public Const stc17 = &H450
Public Const stc18 = &H451
Public Const stc19 = &H452
Public Const stc20 = &H453
Public Const stc21 = &H454
Public Const stc22 = &H455
Public Const stc23 = &H456
Public Const stc24 = &H457
Public Const stc25 = &H458
Public Const stc26 = &H459
Public Const stc27 = &H45A
Public Const stc28 = &H45B
Public Const stc29 = &H45C
Public Const stc30 = &H45D
Public Const stc31 = &H45E
Public Const stc32 = &H45F
    '  Listboxes
Public Const lst1 = &H460
Public Const lst2 = &H461
Public Const lst3 = &H462
Public Const lst4 = &H463
Public Const lst5 = &H464
Public Const lst6 = &H465
Public Const lst7 = &H466
Public Const lst8 = &H467
Public Const lst9 = &H468
Public Const lst10 = &H469
Public Const lst11 = &H46A
Public Const lst12 = &H46B
Public Const lst13 = &H46C
Public Const lst14 = &H46D
Public Const lst15 = &H46E
Public Const lst16 = &H46F
    '  Combo boxes
Public Const cmb1 = &H470
Public Const cmb2 = &H471
Public Const cmb3 = &H472
Public Const cmb4 = &H473
Public Const cmb5 = &H474
Public Const cmb6 = &H475
Public Const cmb7 = &H476
Public Const cmb8 = &H477
Public Const cmb9 = &H478
Public Const cmb10 = &H479
Public Const cmb11 = &H47A
Public Const cmb12 = &H47B
Public Const cmb13 = &H47C
Public Const cmb14 = &H47D
Public Const cmb15 = &H47E
Public Const cmb16 = &H47F
    '  Edit controls
Public Const edt1 = &H480
Public Const edt2 = &H481
Public Const edt3 = &H482
Public Const edt4 = &H483
Public Const edt5 = &H484
Public Const edt6 = &H485
Public Const edt7 = &H486
Public Const edt8 = &H487
Public Const edt9 = &H488
Public Const edt10 = &H489
Public Const edt11 = &H48A
Public Const edt12 = &H48B
Public Const edt13 = &H48C
Public Const edt14 = &H48D
Public Const edt15 = &H48E
Public Const edt16 = &H48F
    '  Scroll bars
Public Const scr1 = &H490
Public Const scr2 = &H491
Public Const scr3 = &H492
Public Const scr4 = &H493
Public Const scr5 = &H494
Public Const scr6 = &H495
Public Const scr7 = &H496
Public Const scr8 = &H497

Public Const FILEOPENORD = 1536
Public Const MULTIFILEOPENORD = 1537
Public Const PRINTDLGORD = 1538
Public Const PRNSETUPDLGORD = 1539
Public Const FINDDLGORD = 1540
Public Const REPLACEDLGORD = 1541
Public Const FONTDLGORD = 1542
Public Const FORMATDLGORD31 = 1543
Public Const FORMATDLGORD30 = 1544

Type CRGB
        bRed As Byte
        bGreen As Byte
        bBlue As Byte
        bExtra As Byte
End Type

' -----------------
' ADVAPI32
' -----------------

' function prototypes, constants, and type definitions
' for Windows 32-bit Registry API

Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const HKEY_USERS = &H80000003
Public Const HKEY_PERFORMANCE_DATA = &H80000004
Public Const HKEY_CURRENT_CONFIG = &H80000005
Public Const HKEY_DYN_DATA = &H80000006

' Registry API prototypes

Declare Function RegCloseKey Lib "advapi32.dll" Alias "RegCloseKey" (ByVal hKey As Long) As Long
Declare Function RegConnectRegistry Lib "advapi32.dll" Alias "RegConnectRegistryA" (ByVal lpMachineName As String, ByVal hKey As Long, phkResult As Long) As Long
Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition As Long) As Long
Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, ByVal cbName As Long) As Long
Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As FILETIME) As Long
Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As Byte, lpcbData As Long) As Long
Declare Function RegFlushKey Lib "advapi32.dll" Alias "RegFlushKey" (ByVal hKey As Long) As Long
Declare Function RegGetKeySecurity Lib "advapi32.dll" Alias "RegGetKeySecurity" (ByVal hKey As Long, ByVal SecurityInformation As Long, pSecurityDescriptor As SECURITY_DESCRIPTOR, lpcbSecurityDescriptor As Long) As Long
Declare Function RegLoadKey Lib "advapi32.dll" Alias "RegLoadKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal lpFile As String) As Long
Declare Function RegNotifyChangeKeyValue Lib "advapi32.dll" Alias "RegNotifyChangeKeyValue" (ByVal hKey As Long, ByVal bWatchSubtree As Long, ByVal dwNotifyFilter As Long, ByVal hEvent As Long, ByVal fAsynchronus As Long) As Long
Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegQueryInfoKey Lib "advapi32.dll" Alias "RegQueryInfoKeyA" (ByVal hKey As Long, ByVal lpClass As String, lpcbClass As Long, ByVal lpReserved As Long, lpcSubKeys As Long, lpcbMaxSubKeyLen As Long, lpcbMaxClassLen As Long, lpcValues As Long, lpcbMaxValueNameLen As Long, lpcbMaxValueLen As Long, lpcbSecurityDescriptor As Long, lpftLastWriteTime As FILETIME) As Long
Declare Function RegQueryValue Lib "advapi32.dll" Alias "RegQueryValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal lpValue As String, lpcbValue As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long         ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Declare Function RegReplaceKey Lib "advapi32.dll" Alias "RegReplaceKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal lpNewFile As String, ByVal lpOldFile As String) As Long
Declare Function RegRestoreKey Lib "advapi32.dll" Alias "RegRestoreKeyA" (ByVal hKey As Long, ByVal lpFile As String, ByVal dwFlags As Long) As Long
Declare Function RegSaveKey Lib "advapi32.dll" Alias "RegSaveKeyA" (ByVal hKey As Long, ByVal lpFile As String, lpSecurityAttributes As SECURITY_ATTRIBUTES) As Long
Declare Function RegSetKeySecurity Lib "advapi32.dll" Alias "RegSetKeySecurity" (ByVal hKey As Long, ByVal SecurityInformation As Long, pSecurityDescriptor As SECURITY_DESCRIPTOR) As Long
Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long         ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Declare Function RegUnLoadKey Lib "advapi32.dll" Alias "RegUnLoadKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage As String, ByVal dwTimeout As Long, ByVal bForceAppsClosed As Long, ByVal bRebootAfterShutdown As Long) As Long
Declare Function AbortSystemShutdown Lib "advapi32.dll" Alias "AbortSystemShutdownA" (ByVal lpMachineName As String) As Long

' Service database names
Public Const SERVICES_ACTIVE_DATABASE = "ServicesActive"
Public Const SERVICES_FAILED_DATABASE = "ServicesFailed"

' Value to indicate no change to an optional parameter
Public Const SERVICE_NO_CHANGE = &HFFFF

' Service State -- for Enum Requests (Bit Mask)
Public Const SERVICE_ACTIVE = &H1
Public Const SERVICE_INACTIVE = &H2
Public Const SERVICE_STATE_ALL = (SERVICE_ACTIVE Or SERVICE_INACTIVE)

' Controls
Public Const SERVICE_CONTROL_STOP = &H1
Public Const SERVICE_CONTROL_PAUSE = &H2
Public Const SERVICE_CONTROL_CONTINUE = &H3
Public Const SERVICE_CONTROL_INTERROGATE = &H4
Public Const SERVICE_CONTROL_SHUTDOWN = &H5

' Service State -- for CurrentState
Public Const SERVICE_STOPPED = &H1
Public Const SERVICE_START_PENDING = &H2
Public Const SERVICE_STOP_PENDING = &H3
Public Const SERVICE_RUNNING = &H4
Public Const SERVICE_CONTINUE_PENDING = &H5
Public Const SERVICE_PAUSE_PENDING = &H6
Public Const SERVICE_PAUSED = &H7

' Controls Accepted  (Bit Mask)
Public Const SERVICE_ACCEPT_STOP = &H1
Public Const SERVICE_ACCEPT_PAUSE_CONTINUE = &H2
Public Const SERVICE_ACCEPT_SHUTDOWN = &H4

' Service Control Manager object specific access types
Public Const SC_MANAGER_CONNECT = &H1
Public Const SC_MANAGER_CREATE_SERVICE = &H2
Public Const SC_MANAGER_ENUMERATE_SERVICE = &H4
Public Const SC_MANAGER_LOCK = &H8
Public Const SC_MANAGER_QUERY_LOCK_STATUS = &H10
Public Const SC_MANAGER_MODIFY_BOOT_CONFIG = &H20

Public Const SC_MANAGER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SC_MANAGER_CONNECT Or SC_MANAGER_CREATE_SERVICE Or SC_MANAGER_ENUMERATE_SERVICE Or SC_MANAGER_LOCK Or SC_MANAGER_QUERY_LOCK_STATUS Or SC_MANAGER_MODIFY_BOOT_CONFIG)

' Service object specific access type
Public Const SERVICE_QUERY_CONFIG = &H1
Public Const SERVICE_CHANGE_CONFIG = &H2
Public Const SERVICE_QUERY_STATUS = &H4
Public Const SERVICE_ENUMERATE_DEPENDENTS = &H8
Public Const SERVICE_START = &H10
Public Const SERVICE_STOP = &H20
Public Const SERVICE_PAUSE_CONTINUE = &H40
Public Const SERVICE_INTERROGATE = &H80
Public Const SERVICE_USER_DEFINED_CONTROL = &H100

Public Const SERVICE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SERVICE_QUERY_CONFIG Or SERVICE_CHANGE_CONFIG Or SERVICE_QUERY_STATUS Or SERVICE_ENUMERATE_DEPENDENTS Or SERVICE_START Or SERVICE_STOP Or SERVICE_PAUSE_CONTINUE Or SERVICE_INTERROGATE Or SERVICE_USER_DEFINED_CONTROL)


Type SERVICE_STATUS
        dwServiceType As Long
        dwCurrentState As Long
        dwControlsAccepted As Long
        dwWin32ExitCode As Long
        dwServiceSpecificExitCode As Long
        dwCheckPoint As Long
        dwWaitHint As Long
End Type

Type ENUM_SERVICE_STATUS
        lpServiceName As String
        lpDisplayName As String
        ServiceStatus As SERVICE_STATUS
End Type

Type QUERY_SERVICE_LOCK_STATUS
        fIsLocked As Long
        lpLockOwner As String
        dwLockDuration As Long
End Type

Type QUERY_SERVICE_CONFIG
        dwServiceType As Long
        dwStartType As Long
        dwErrorControl As Long
        lpBinaryPathName As String
        lpLoadOrderGroup As String
        dwTagId As Long
        lpDependencies As String
        lpServiceStartName As String
        lpDisplayName As String
End Type

Type SERVICE_TABLE_ENTRY
        lpServiceName As String
        lpServiceProc As Long
End Type


' ++ BUILD Version: 0010    '  Increment this if a change has global effects
' Copyright (c) 1995  Microsoft Corporation
' Module Name:
'     winsvc.h
' Abstract:
'     Header file for the Service Control Manager
' Environment:
'     User Mode - Win32
' --*/
'
'  Constants

'  Character to designate that a name is a group
'
Public Const SC_GROUP_IDENTIFIER = "+"

'  Prototype for the Service Control Handler Function

' /////////////////////////////////////////////////////////////////////////
'  API Function Prototypes
' /////////////////////////////////////////////////////////////////////////

Declare Function ChangeServiceConfig Lib "advapi32.dll" Alias "ChangeServiceConfigA" (ByVal hService As Long, ByVal dwServiceType As Long, ByVal dwStartType As Long, ByVal dwErrorControl As Long, ByVal lpBinaryPathName As String, ByVal lpLoadOrderGroup As String, lpdwTagId As Long, ByVal lpDependencies As String, ByVal lpServiceStartName As String, ByVal lpPassword As String, ByVal lpDisplayName As String) As Long
Declare Function CloseServiceHandle Lib "advapi32.dll" Alias "CloseServiceHandle" (ByVal hSCObject As Long) As Long
Declare Function ControlService Lib "advapi32.dll" Alias "ControlService" (ByVal hService As Long, ByVal dwControl As Long, lpServiceStatus As SERVICE_STATUS) As Long
Declare Function CreateService Lib "advapi32.dll" Alias "CreateServiceA" (ByVal hSCManager As Long, ByVal lpServiceName As String, ByVal lpDisplayName As String, ByVal dwDesiredAccess As Long, ByVal dwServiceType As Long, ByVal dwStartType As Long, ByVal dwErrorControl As Long, ByVal lpBinaryPathName As String, ByVal lpLoadOrderGroup As String, lpdwTagId As Long, ByVal lpDependencies As String, ByVal lp As String, ByVal lpPassword As String) As Long
Declare Function DeleteService Lib "advapi32.dll" Alias "DeleteService" (ByVal hService As Long) As Long
Declare Function EnumDependentServices Lib "advapi32.dll" Alias "EnumDependentServicesA" (ByVal hService As Long, ByVal dwServiceState As Long, lpServices As ENUM_SERVICE_STATUS, ByVal cbBufSize As Long, pcbBytesNeeded As Long, lpServicesReturned As Long) As Long
Declare Function EnumServicesStatus Lib "advapi32.dll" Alias "EnumServicesStatusA" (ByVal hSCManager As Long, ByVal dwServiceType As Long, ByVal dwServiceState As Long, lpServices As ENUM_SERVICE_STATUS, ByVal cbBufSize As Long, pcbBytesNeeded As Long, lpServicesReturned As Long, lpResumeHandle As Long) As Long
Declare Function GetServiceKeyName Lib "advapi32.dll" Alias "GetServiceKeyNameA" (ByVal hSCManager As Long, ByVal lpDisplayName As String, ByVal lpServiceName As String, lpcchBuffer As Long) As Long
Declare Function GetServiceDisplayName Lib "advapi32.dll" Alias "GetServiceDisplayNameA" (ByVal hSCManager As Long, ByVal lpServiceName As String, ByVal lpDisplayName As String, lpcchBuffer As Long) As Long
Declare Function LockServiceDatabase Lib "advapi32.dll" Alias "LockServiceDatabase" (ByVal hSCManager As Long) As Long
Declare Function NotifyBootConfigStatus Lib "advapi32.dll" Alias "NotifyBootConfigStatus" (ByVal BootAcceptable As Long) As Long
Declare Function OpenSCManager Lib "advapi32.dll" Alias "OpenSCManagerA" (ByVal lpMachineName As String, ByVal lpDatabaseName As String, ByVal dwDesiredAccess As Long) As Long
Declare Function OpenService Lib "advapi32.dll" Alias "OpenServiceA" (ByVal hSCManager As Long, ByVal lpServiceName As String, ByVal dwDesiredAccess As Long) As Long
Declare Function QueryServiceConfig Lib "advapi32.dll" Alias "QueryServiceConfigA" (ByVal hService As Long, lpServiceConfig As QUERY_SERVICE_CONFIG, ByVal cbBufSize As Long, pcbBytesNeeded As Long) As Long
Declare Function QueryServiceLockStatus Lib "advapi32.dll" Alias "QueryServiceLockStatusA" (ByVal hSCManager As Long, lpLockStatus As QUERY_SERVICE_LOCK_STATUS, ByVal cbBufSize As Long, pcbBytesNeeded As Long) As Long
Declare Function QueryServiceObjectSecurity Lib "advapi32.dll" Alias "QueryServiceObjectSecurity" (ByVal hService As Long, ByVal dwSecurityInformation As Long, lpSecurityDescriptor As Any, ByVal cbBufSize As Long, pcbBytesNeeded As Long) As Long
Declare Function QueryServiceStatus Lib "advapi32.dll" Alias "QueryServiceStatus" (ByVal hService As Long, lpServiceStatus As SERVICE_STATUS) As Long
Declare Function RegisterServiceCtrlHandler Lib "advapi32.dll" Alias "RegisterServiceCtrlHandlerA" (ByVal lpServiceName As String, ByVal lpHandlerProc As Long) As Long
Declare Function SetServiceObjectSecurity Lib "advapi32.dll" Alias "SetServiceObjectSecurity" (ByVal hService As Long, ByVal dwSecurityInformation As Long, lpSecurityDescriptor As Any) As Long
Declare Function SetServiceStatus Lib "advapi32.dll" Alias "SetServiceStatus" (ByVal hServiceStatus As Long, lpServiceStatus As SERVICE_STATUS) As Long
Declare Function StartServiceCtrlDispatcher Lib "advapi32.dll" Alias "StartServiceCtrlDispatcherA" (lpServiceStartTable As SERVICE_TABLE_ENTRY) As Long
Declare Function StartService Lib "advapi32.dll" Alias "StartServiceA" (ByVal hService As Long, ByVal dwNumServiceArgs As Long, ByVal lpServiceArgVectors As Long) As Long
Declare Function UnlockServiceDatabase Lib "advapi32.dll" Alias "UnlockServiceDatabase" (ScLock As Any) As Long

Type LARGE_INTEGER
    lowpart As Long
    highpart As Long
End Type


' Section for Performance Monitor data

Public Const PERF_DATA_VERSION = 1
Public Const PERF_DATA_REVISION = 1

Type PERF_DATA_BLOCK
        Signature As String * 4
        LittleEndian As Long
        Version As Long
        Revision As Long
        TotalByteLength As Long
        HeaderLength As Long
        NumObjectTypes As Long
        DefaultObject As Long
        SystemTime As SYSTEMTIME
        PerfTime As LARGE_INTEGER
        PerfFreq As LARGE_INTEGER
        PerTime100nSec As LARGE_INTEGER
        SystemNameLength As Long
        SystemNameOffset As Long
End Type

Type PERF_OBJECT_TYPE
        TotalByteLength As Long
        DefinitionLength As Long
        HeaderLength As Long
        ObjectNameTitleIndex As Long
        ObjectNameTitle As String
        ObjectHelpTitleIndex As Long
        ObjectHelpTitle As String
        DetailLevel As Long
        NumCounters As Long
        DefaultCounter As Long
        NumInstances As Long
        CodePage As Long
        PerfTime As LARGE_INTEGER
        PerfFreq As LARGE_INTEGER
End Type

Public Const PERF_NO_INSTANCES = -1  '  no instances

' The counter type is the "or" of the following values as described below
'
' select one of the following to indicate the counter's data size
Public Const PERF_SIZE_DWORD = &H0
Public Const PERF_SIZE_LARGE = &H100
Public Const PERF_SIZE_ZERO = &H200       '  for Zero Length fields
Public Const PERF_SIZE_VARIABLE_LEN = &H300       '  length is in CounterLength field of Counter Definition struct

' select one of the following values to indicate the counter field usage
Public Const PERF_TYPE_NUMBER = &H0         '  a number (not a counter)
Public Const PERF_TYPE_COUNTER = &H400       '  an increasing numeric value
Public Const PERF_TYPE_TEXT = &H800       '  a text field
Public Const PERF_TYPE_ZERO = &HC00       '  displays a zero

' If the PERF_TYPE_NUMBER field was selected, then select one of the
' following to describe the Number
Public Const PERF_NUMBER_HEX = &H0         '  display as HEX value
Public Const PERF_NUMBER_DECIMAL = &H10000     '  display as a decimal integer
Public Const PERF_NUMBER_DEC_1000 = &H20000     '  display as a decimal/1000
'
' If the PERF_TYPE_COUNTER value was selected then select one of the
' following to indicate the type of counter
Public Const PERF_COUNTER_VALUE = &H0         '  display counter value
Public Const PERF_COUNTER_RATE = &H10000     '  divide ctr / delta time
Public Const PERF_COUNTER_FRACTION = &H20000     '  divide ctr / base
Public Const PERF_COUNTER_BASE = &H30000     '  base value used in fractions
Public Const PERF_COUNTER_ELAPSED = &H40000     '  subtract counter from current time
Public Const PERF_COUNTER_QUEUELEN = &H50000     '  Use Queuelen processing func.
Public Const PERF_COUNTER_HISTOGRAM = &H60000     '  Counter begins or ends a histogram

' If the PERF_TYPE_TEXT value was selected, then select one of the
' following to indicate the type of TEXT data.
Public Const PERF_TEXT_UNICODE = &H0         '  type of text in text field
Public Const PERF_TEXT_ASCII = &H10000     '  ASCII using the CodePage field

' Timer SubTypes
Public Const PERF_TIMER_TICK = &H0         '  use system perf. freq for base
Public Const PERF_TIMER_100NS = &H100000    '  use 100 NS timer time base units
Public Const PERF_OBJECT_TIMER = &H200000    '  use the object timer freq

' Any types that have calculations performed can use one or more of
' the following calculation modification flags listed here
Public Const PERF_DELTA_COUNTER = &H400000    '  compute difference first
Public Const PERF_DELTA_BASE = &H800000    '  compute base diff as well
Public Const PERF_INVERSE_COUNTER = &H1000000   '  show as 1.00-value (assumes:
Public Const PERF_MULTI_COUNTER = &H2000000   '  sum of multiple instances

' Select one of the following values to indicate the display suffix (if any)
Public Const PERF_DISPLAY_NO_SUFFIX = &H0         '  no suffix
Public Const PERF_DISPLAY_PER_SEC = &H10000000  '  "/sec"
Public Const PERF_DISPLAY_PERCENT = &H20000000  '  "%"
Public Const PERF_DISPLAY_SECONDS = &H30000000  '  "secs"
Public Const PERF_DISPLAY_NOSHOW = &H40000000  '  value is not displayed

' Predefined counter types

' 32-bit Counter.  Divide delta by delta time.  Display suffix: "/sec"
Public Const PERF_COUNTER_COUNTER = (PERF_SIZE_DWORD Or PERF_TYPE_COUNTER Or PERF_COUNTER_RATE Or PERF_TIMER_TICK Or PERF_DELTA_COUNTER Or PERF_DISPLAY_PER_SEC)

' 64-bit Timer.  Divide delta by delta time.  Display suffix: "%"
Public Const PERF_COUNTER_TIMER = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_COUNTER_RATE Or PERF_TIMER_TICK Or PERF_DELTA_COUNTER Or PERF_DISPLAY_PERCENT)

' Queue Length Space-Time Product. Divide delta by delta time. No Display Suffix.
Public Const PERF_COUNTER_QUEUELEN_TYPE = (PERF_SIZE_DWORD Or PERF_TYPE_COUNTER Or PERF_COUNTER_QUEUELEN Or PERF_TIMER_TICK Or PERF_DELTA_COUNTER Or PERF_DISPLAY_NO_SUFFIX)

' 64-bit Counter.  Divide delta by delta time. Display Suffix: "/sec"
Public Const PERF_COUNTER_BULK_COUNT = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_COUNTER_RATE Or PERF_TIMER_TICK Or PERF_DELTA_COUNTER Or PERF_DISPLAY_PER_SEC)

' Indicates the counter is not a  counter but rather Unicode text Display as text.
Public Const PERF_COUNTER_TEXT = (PERF_SIZE_VARIABLE_LEN Or PERF_TYPE_TEXT Or PERF_TEXT_UNICODE Or PERF_DISPLAY_NO_SUFFIX)

' Indicates the data is a counter  which should not be
' time averaged on display (such as an error counter on a serial line)
' Display as is.  No Display Suffix.
Public Const PERF_COUNTER_RAWCOUNT = (PERF_SIZE_DWORD Or PERF_TYPE_NUMBER Or PERF_NUMBER_DECIMAL Or PERF_DISPLAY_NO_SUFFIX)

' A count which is either 1 or 0 on each sampling interrupt (% busy)
' Divide delta by delta base. Display Suffix: "%"
Public Const PERF_SAMPLE_FRACTION = (PERF_SIZE_DWORD Or PERF_TYPE_COUNTER Or PERF_COUNTER_FRACTION Or PERF_DELTA_COUNTER Or PERF_DELTA_BASE Or PERF_DISPLAY_PERCENT)

' A count which is sampled on each sampling interrupt (queue length)
' Divide delta by delta time. No Display Suffix.
Public Const PERF_SAMPLE_COUNTER = (PERF_SIZE_DWORD Or PERF_TYPE_COUNTER Or PERF_COUNTER_RATE Or PERF_TIMER_TICK Or PERF_DELTA_COUNTER Or PERF_DISPLAY_NO_SUFFIX)

' A label: no data is associated with this counter (it has 0 length)
' Do not display.
Public Const PERF_COUNTER_NODATA = (PERF_SIZE_ZERO Or PERF_DISPLAY_NOSHOW)

' 64-bit Timer inverse (e.g., idle is measured, but display busy  As Integer)
' Display 100 - delta divided by delta time.  Display suffix: "%"
Public Const PERF_COUNTER_TIMER_INV = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_COUNTER_RATE Or PERF_TIMER_TICK Or PERF_DELTA_COUNTER Or PERF_INVERSE_COUNTER Or PERF_DISPLAY_PERCENT)

' The divisor for a sample, used with the previous counter to form a
' sampled %.  You must check for >0 before dividing by this!  This
' counter will directly follow the  numerator counter.  It should not
' be displayed to the user.
Public Const PERF_SAMPLE_BASE = (PERF_SIZE_DWORD Or PERF_TYPE_COUNTER Or PERF_COUNTER_BASE Or PERF_DISPLAY_NOSHOW Or &H1)         '  for compatibility with pre-beta versions

' A timer which, when divided by an average base, produces a time
' in seconds which is the average time of some operation.  This
' timer times total operations, and  the base is the number of opera-
' tions.  Display Suffix: "sec"
Public Const PERF_AVERAGE_TIMER = (PERF_SIZE_DWORD Or PERF_TYPE_COUNTER Or PERF_COUNTER_FRACTION Or PERF_DISPLAY_SECONDS)

' Used as the denominator in the computation of time or count
' averages.  Must directly follow the numerator counter.  Not dis-
' played to the user.
Public Const PERF_AVERAGE_BASE = (PERF_SIZE_DWORD Or PERF_TYPE_COUNTER Or PERF_COUNTER_BASE Or PERF_DISPLAY_NOSHOW Or &H2)         '  for compatibility with pre-beta versions

' A bulk count which, when divided (typically) by the number of
' operations, gives (typically) the number of bytes per operation.
' No Display Suffix.
Public Const PERF_AVERAGE_BULK = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_COUNTER_FRACTION Or PERF_DISPLAY_NOSHOW)

' 64-bit Timer in 100 nsec units. Display delta divided by
' delta time.  Display suffix: "%"
Public Const PERF_100NSEC_TIMER = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_COUNTER_RATE Or PERF_TIMER_100NS Or PERF_DELTA_COUNTER Or PERF_DISPLAY_PERCENT)

' 64-bit Timer inverse (e.g., idle is measured, but display busy  As Integer)
' Display 100 - delta divided by delta time.  Display suffix: "%"
Public Const PERF_100NSEC_TIMER_INV = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_COUNTER_RATE Or PERF_TIMER_100NS Or PERF_DELTA_COUNTER Or PERF_INVERSE_COUNTER Or PERF_DISPLAY_PERCENT)

' 64-bit Timer.  Divide delta by delta time.  Display suffix: "%"
' Timer for multiple instances, so result can exceed 100%.
Public Const PERF_COUNTER_MULTI_TIMER = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_COUNTER_RATE Or PERF_DELTA_COUNTER Or PERF_TIMER_TICK Or PERF_MULTI_COUNTER Or PERF_DISPLAY_PERCENT)

' 64-bit Timer inverse (e.g., idle is measured, but display busy  As Integer)
' Display 100  _MULTI_BASE - delta divided by delta time.
' Display suffix: "%" Timer for multiple instances, so result
' can exceed 100%.  Followed by a counter of type _MULTI_BASE.
Public Const PERF_COUNTER_MULTI_TIMER_INV = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_COUNTER_RATE Or PERF_DELTA_COUNTER Or PERF_MULTI_COUNTER Or PERF_TIMER_TICK Or PERF_INVERSE_COUNTER Or PERF_DISPLAY_PERCENT)

' Number of instances to which the preceding _MULTI_..._INV counter
' applies.  Used as a factor to get the percentage.
Public Const PERF_COUNTER_MULTI_BASE = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_COUNTER_BASE Or PERF_MULTI_COUNTER Or PERF_DISPLAY_NOSHOW)

' 64-bit Timer in 100 nsec units. Display delta divided by delta time.
' Display suffix: "%" Timer for multiple instances, so result can exceed 100%.
Public Const PERF_100NSEC_MULTI_TIMER = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_DELTA_COUNTER Or PERF_COUNTER_RATE Or PERF_TIMER_100NS Or PERF_MULTI_COUNTER Or PERF_DISPLAY_PERCENT)

' 64-bit Timer inverse (e.g., idle is measured, but display busy  As Integer)
' Display 100  _MULTI_BASE - delta divided by delta time.
' Display suffix: "%" Timer for multiple instances, so result
' can exceed 100%.  Followed by a counter of type _MULTI_BASE.
Public Const PERF_100NSEC_MULTI_TIMER_INV = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_DELTA_COUNTER Or PERF_COUNTER_RATE Or PERF_TIMER_100NS Or PERF_MULTI_COUNTER Or PERF_INVERSE_COUNTER Or PERF_DISPLAY_PERCENT)

' Indicates the data is a fraction of the following counter  which
' should not be time averaged on display (such as free space over
' total space.) Display as is.  Display the quotient as "%".
Public Const PERF_RAW_FRACTION = (PERF_SIZE_DWORD Or PERF_TYPE_COUNTER Or PERF_COUNTER_FRACTION Or PERF_DISPLAY_PERCENT)

' Indicates the data is a base for the preceding counter which should
' not be time averaged on display (such as free space over total space.)
Public Const PERF_RAW_BASE = (PERF_SIZE_DWORD Or PERF_TYPE_COUNTER Or PERF_COUNTER_BASE Or PERF_DISPLAY_NOSHOW Or &H3)         '  for compatibility with pre-beta versions

' The data collected in this counter is actually the start time of the
' item being measured. For display, this data is subtracted from the
' sample time to yield the elapsed time as the difference between the two.
' In the definition below, the PerfTime field of the Object contains
' the sample time as indicated by the PERF_OBJECT_TIMER bit and the
' difference is scaled by the PerfFreq of the Object to convert the time
' units into seconds.
Public Const PERF_ELAPSED_TIME = (PERF_SIZE_LARGE Or PERF_TYPE_COUNTER Or PERF_COUNTER_ELAPSED Or PERF_OBJECT_TIMER Or PERF_DISPLAY_SECONDS)

' The following counter type can be used with the preceding types to
' define a range of values to be displayed in a histogram.
Public Const PERF_COUNTER_HISTOGRAM_TYPE = &H80000000  ' Counter begins or ends a histogram

' The following are used to determine the level of detail associated
' with the counter.  The user will be setting the level of detail
' that should be displayed at any given time.
Public Const PERF_DETAIL_NOVICE = 100 '  The uninformed can understand it
Public Const PERF_DETAIL_ADVANCED = 200 '  For the advanced user
Public Const PERF_DETAIL_EXPERT = 300 '  For the expert user
Public Const PERF_DETAIL_WIZARD = 400 '  For the system designer

Type PERF_COUNTER_DEFINITION
        ByteLength As Long
        CounterNameTitleIndex As Long
        CounterNameTitle As String
        CounterHelpTitleIndex As Long
        CounterHelpTitle As String
        DefaultScale As Long
        DetailLevel As Long
        CounterType As Long
        CounterSize As Long
        CounterOffset As Long
End Type

Public Const PERF_NO_UNIQUE_ID = -1

Type PERF_INSTANCE_DEFINITION
        ByteLength As Long
        ParentObjectTitleIndex As Long
        ParentObjectInstance As Long
        UniqueID As Long
        NameOffset As Long
        NameLength As Long
End Type

Type PERF_COUNTER_BLOCK
        ByteLength As Long
End Type

Public Const CDERR_DIALOGFAILURE = &HFFFF

Public Const CDERR_GENERALCODES = &H0
Public Const CDERR_STRUCTSIZE = &H1
Public Const CDERR_INITIALIZATION = &H2
Public Const CDERR_NOTEMPLATE = &H3
Public Const CDERR_NOHINSTANCE = &H4
Public Const CDERR_LOADSTRFAILURE = &H5
Public Const CDERR_FINDRESFAILURE = &H6
Public Const CDERR_LOADRESFAILURE = &H7
Public Const CDERR_LOCKRESFAILURE = &H8
Public Const CDERR_MEMALLOCFAILURE = &H9
Public Const CDERR_MEMLOCKFAILURE = &HA
Public Const CDERR_NOHOOK = &HB
Public Const CDERR_REGISTERMSGFAIL = &HC

Public Const PDERR_PRINTERCODES = &H1000
Public Const PDERR_SETUPFAILURE = &H1001
Public Const PDERR_PARSEFAILURE = &H1002
Public Const PDERR_RETDEFFAILURE = &H1003
Public Const PDERR_LOADDRVFAILURE = &H1004
Public Const PDERR_GETDEVMODEFAIL = &H1005
Public Const PDERR_INITFAILURE = &H1006
Public Const PDERR_NODEVICES = &H1007
Public Const PDERR_NODEFAULTPRN = &H1008
Public Const PDERR_DNDMMISMATCH = &H1009
Public Const PDERR_CREATEICFAILURE = &H100A
Public Const PDERR_PRINTERNOTFOUND = &H100B
Public Const PDERR_DEFAULTDIFFERENT = &H100C

Public Const CFERR_CHOOSEFONTCODES = &H2000
Public Const CFERR_NOFONTS = &H2001
Public Const CFERR_MAXLESSTHANMIN = &H2002

Public Const FNERR_FILENAMECODES = &H3000
Public Const FNERR_SUBCLASSFAILURE = &H3001
Public Const FNERR_INVALIDFILENAME = &H3002
Public Const FNERR_BUFFERTOOSMALL = &H3003

Public Const FRERR_FINDREPLACECODES = &H4000
Public Const FRERR_BUFFERLENGTHZERO = &H4001

Public Const CCERR_CHOOSECOLORCODES = &H5000


' public interface to LZEXP?.LIB

'  LZEXPAND error return codes
Public Const LZERROR_BADINHANDLE = (-1)  '  invalid input handle
Public Const LZERROR_BADOUTHANDLE = (-2) '  invalid output handle
Public Const LZERROR_READ = (-3)         '  corrupt compressed file format
Public Const LZERROR_WRITE = (-4)        '  out of space for output file
Public Const LZERROR_PUBLICLOC = (-5)    '  insufficient memory for LZFile struct
Public Const LZERROR_GLOBLOCK = (-6)     '  bad Global handle
Public Const LZERROR_BADVALUE = (-7)     '  input parameter out of range
Public Const LZERROR_UNKNOWNALG = (-8)   '  compression algorithm not recognized

Declare Function LZCopy Lib "lz32.dll" Alias "LZCopy" (ByVal hfSource As Long, ByVal hfDest As Long) As Long
Declare Function LZInit Lib "lz32.dll" Alias "LZInit" (ByVal hfSrc As Long) As Long
Declare Function GetExpandedName Lib "lz32.dll" Alias "GetExpandedNameA" (ByVal lpszSource As String, ByVal lpszBuffer As String) As Long
Declare Function LZOpenFile Lib "lz32.dll" Alias "LZOpenFileA" (ByVal lpszFile As String, lpOf As OFSTRUCT, ByVal style As Long) As Long
Declare Function LZSeek Lib "lz32.dll" Alias "LZSeek" (ByVal hfFile As Long, ByVal lOffset As Long, ByVal nOrigin As Long) As Long
Declare Function LZRead Lib "lz32.dll" Alias "LZRead" (ByVal hfFile As Long, ByVal lpvBuf As String, ByVal cbread As Long) As Long
Declare Sub LZClose Lib "lz32.dll" Alias "LZClose" (ByVal hfFile As Long)

' ********************************************************************
'       IMM.H - Input Method Manager definitions
'
'       Copyright (c) 1993-1995  Microsoft Corporation
' ********************************************************************

Public Const VK_PROCESSKEY = &HE5

Type COMPOSITIONFORM
        dwStyle As Long
        ptCurrentPos As POINTAPI
        rcArea As Rect
End Type

Type CANDIDATEFORM
        dwIndex As Long
        dwStyle As Long
        ptCurrentPos As POINTAPI
        rcArea As Rect
End Type

Type CANDIDATELIST
        dwSize As Long
        dwStyle As Long
        dwCount As Long
        dwSelection As Long
        dwPageStart As Long
        dwPageSize As Long
        dwOffset(1) As Long
End Type

Public Const STYLE_DESCRIPTION_SIZE = 32

Type STYLEBUF
        dwStyle As Long
        szDescription As String * STYLE_DESCRIPTION_SIZE
End Type
'  prototype of IMM API

Declare Function ImmInstallIME Lib "imm32.dll" Alias "ImmInstallIMEA" (ByVal lpszIMEFileName As String, ByVal lpszLayoutText As String) As Long
Declare Function ImmGetDefaultIMEWnd Lib "imm32.dll" Alias "ImmGetDefaultIMEWnd" (ByVal hwnd As Long) As Long
Declare Function ImmGetDescription Lib "imm32.dll" Alias "ImmGetDescriptionA" (ByVal hkl As Long, ByVal lpsz As String, ByVal uBufLen As Long) As Long
Declare Function ImmGetIMEFileName Lib "imm32.dll" Alias "ImmGetIMEFileNameA" (ByVal hkl As Long, ByVal lpStr As String, ByVal uBufLen As Long) As Long
Declare Function ImmGetProperty Lib "imm32.dll" Alias "ImmGetProperty" (ByVal hkl As Long, ByVal dw As Long) As Long
Declare Function ImmIsIME Lib "imm32.dll" Alias "ImmIsIME" (ByVal hkl As Long) As Long
Declare Function ImmSimulateHotKey Lib "imm32.dll" Alias "ImmSimulateHotKey" (ByVal hwnd As Long, ByVal dw As Long) As Long
Declare Function ImmCreateContext Lib "imm32.dll" Alias "ImmCreateContext" () As Long
Declare Function ImmDestroyContext Lib "imm32.dll" Alias "ImmDestroyContext" (ByVal himc As Long) As Long
Declare Function ImmGetContext Lib "imm32.dll" Alias "ImmGetContext" (ByVal hwnd As Long) As Long
Declare Function ImmReleaseContext Lib "imm32.dll" Alias "ImmReleaseContext" (ByVal hwnd As Long, ByVal himc As Long) As Long
Declare Function ImmAssociateContext Lib "imm32.dll" Alias "ImmAssociateContext" (ByVal hwnd As Long, ByVal himc As Long) As Long
Declare Function ImmGetCompositionString Lib "imm32.dll" Alias "ImmGetCompositionStringA" (ByVal himc As Long, ByVal dw As Long, lpv As Any, ByVal dw2 As Long) As Long
Declare Function ImmSetCompositionString Lib "imm32.dll" Alias "ImmSetCompositionStringA" (ByVal himc As Long, ByVal dwIndex As Long, lpComp As Any, ByVal dw As Long, lpRead As Any, ByVal dw2 As Long) As Long
Declare Function ImmGetCandidateListCount Lib "imm32.dll" Alias "ImmGetCandidateListCountA" (ByVal himc As Long, lpdwListCount As Long) As Long
Declare Function ImmGetCandidateList Lib "imm32.dll" Alias "ImmGetCandidateListA" (ByVal himc As Long, ByVal deIndex As Long, lpCandidateList As CANDIDATELIST, ByVal dwBufLen As Long) As Long
Declare Function ImmGetGuideLine Lib "imm32.dll" Alias " ImmGetGuideLineA" (ByVal himc As Long, ByVal dwIndex As Long, ByVal lpStr As String, ByVal dwBufLen As Long) As Long
Declare Function ImmGetConversionStatus Lib "imm32.dll" Alias "ImmGetConversionStatus" (ByVal himc As Long, lpdw As Long, lpdw2 As Long) As Long
Declare Function ImmSetConversionStatus Lib "imm32.dll" Alias "ImmSetConversionStatus" (ByVal himc As Long, ByVal dw1 As Long, ByVal dw2 As Long) As Long
Declare Function ImmGetOpenStatus Lib "imm32.dll" Alias "ImmGetOpenStatus" (ByVal himc As Long) As Long
Declare Function ImmSetOpenStatus Lib "imm32.dll" Alias "ImmSetOpenStatus" (ByVal himc As Long, ByVal b As Long) As Long
Declare Function ImmGetCompositionFont Lib "imm32.dll" Alias "ImmGetCompositionFontA" (ByVal himc As Long, lpLogFont As LOGFONT) As Long
Declare Function ImmSetCompositionFont Lib "imm32.dll" Alias "ImmSetCompositionFontA" (ByVal himc As Long, lpLogFont As LOGFONT) As Long
Declare Function ImmConfigureIME Lib "imm32.dll" Alias "ImmConfigureIME" (ByVal hkl As Long, ByVal hwnd As Long, ByVal dw As Long) As Long
Declare Function ImmEscape Lib "imm32.dll" Alias "ImmEscapeA" (ByVal hkl As Long, ByVal himc As Long, ByVal un As Long, lpv As Any) As Long
Declare Function ImmGetConversionList Lib "imm32.dll" Alias "ImmGetConversionListA" (ByVal hkl As Long, ByVal himc As Long, ByVal lpsz As String, lpCandidateList As CANDIDATELIST, ByVal dwBufLen As Long, ByVal uFlag As Long) As Long
Declare Function ImmNotifyIME Lib "imm32.dll" Alias "ImmNotifyIME" (ByVal himc As Long, ByVal dwAction As Long, ByVal dwIndex As Long, ByVal dwValue As Long) As Long
Declare Function ImmGetStatusWindowPos Lib "imm32.dll" Alias "ImmGetStatusWindowPos" (ByVal himc As Long, lpPoint As POINTAPI) As Long
Declare Function ImmSetStatusWindowPos Lib "imm32.dll" Alias "ImmSetStatusWindowPos" (ByVal himc As Long, lpPoint As POINTAPI) As Long
Declare Function ImmGetCompositionWindow Lib "imm32.dll" Alias "ImmGetCompositionWindow" (ByVal himc As Long, lpCompositionForm As COMPOSITIONFORM) As Long
Declare Function ImmSetCompositionWindow Lib "imm32.dll" Alias "ImmSetCompositionWindow" (ByVal himc As Long, lpCompositionForm As COMPOSITIONFORM) As Long
Declare Function ImmGetCandidateWindow Lib "imm32.dll" Alias "ImmGetCandidateWindow" (ByVal himc As Long, ByVal dw As Long, lpCandidateForm As CANDIDATEFORM) As Long
Declare Function ImmSetCandidateWindow Lib "imm32.dll" Alias "ImmSetCandidateWindow" (ByVal himc As Long, lpCandidateForm As CANDIDATEFORM) As Long
Declare Function ImmIsUIMessage Lib "imm32.dll" Alias "ImmIsUIMessageA" (ByVal hwnd As Long, ByVal un As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function ImmGetVirtualKey Lib "imm32.dll" Alias "ImmGetVirtualKey" (ByVal hwnd As Long) As Long
Declare Function ImmRegisterWord Lib "imm32.dll" Alias "ImmRegisterWordA" (ByVal hkl As Long, ByVal lpszReading As String, ByVal dw As Long, ByVal lpszRegister As String) As Long
Declare Function ImmUnregisterWord Lib "imm32.dll" Alias "ImmUnregisterWordA" (ByVal hkl As Long, ByVal lpszReading As String, ByVal dw As Long, ByVal lpszUnregister As String) As Long
Declare Function ImmGetRegisterWordStyle Lib "imm32.dll" Alias " ImmGetRegisterWordStyleA" (ByVal hkl As Long, ByVal nItem As Long, lpStyleBuf As STYLEBUF) As Long
Declare Function ImmEnumRegisterWord Lib "imm32.dll" Alias "ImmEnumRegisterWordA" (ByVal hkl As Long, ByVal RegisterWordEnumProc As Long, ByVal lpszReading As String, ByVal dw As Long, ByVal lpszRegister As String, lpv As Any) As Long
'  the IME related messages
Public Const WM_CONVERTREQUESTEX = &H108
Public Const WM_IME_STARTCOMPOSITION = &H10D
Public Const WM_IME_ENDCOMPOSITION = &H10E
Public Const WM_IME_COMPOSITION = &H10F
Public Const WM_IME_KEYLAST = &H10F

Public Const WM_IME_SETCONTEXT = &H281
Public Const WM_IME_NOTIFY = &H282
Public Const WM_IME_CONTROL = &H283
Public Const WM_IME_COMPOSITIONFULL = &H284
Public Const WM_IME_SELECT = &H285
Public Const WM_IME_CHAR = &H286

Public Const WM_IME_KEYDOWN = &H290
Public Const WM_IME_KEYUP = &H291

'  wParam for WM_IME_CONTROL
Public Const IMC_GETCANDIDATEPOS = &H7
Public Const IMC_SETCANDIDATEPOS = &H8
Public Const IMC_GETCOMPOSITIONFONT = &H9
Public Const IMC_SETCOMPOSITIONFONT = &HA
Public Const IMC_GETCOMPOSITIONWINDOW = &HB
Public Const IMC_SETCOMPOSITIONWINDOW = &HC
Public Const IMC_GETSTATUSWINDOWPOS = &HF
Public Const IMC_SETSTATUSWINDOWPOS = &H10
Public Const IMC_CLOSESTATUSWINDOW = &H21
Public Const IMC_OPENSTATUSWINDOW = &H22


'  wParam for WM_IME_CONTROL to the soft keyboard
'  dwAction for ImmNotifyIME
Public Const NI_OPENCANDIDATE = &H10
Public Const NI_CLOSECANDIDATE = &H11
Public Const NI_SELECTCANDIDATESTR = &H12
Public Const NI_CHANGECANDIDATELIST = &H13
Public Const NI_FINALIZECONVERSIONRESULT = &H14
Public Const NI_COMPOSITIONSTR = &H15
Public Const NI_SETCANDIDATE_PAGESTART = &H16
Public Const NI_SETCANDIDATE_PAGESIZE = &H17

'  lParam for WM_IME_SETCONTEXT
Public Const ISC_SHOWUICANDIDATEWINDOW = &H1
Public Const ISC_SHOWUICOMPOSITIONWINDOW = &H80000000
Public Const ISC_SHOWUIGUIDELINE = &H40000000
Public Const ISC_SHOWUIALLCANDIDATEWINDOW = &HF
Public Const ISC_SHOWUIALL = &HC000000F

'  dwIndex for ImmNotifyIME/NI_COMPOSITIONSTR
Public Const CPS_COMPLETE = &H1
Public Const CPS_CONVERT = &H2
Public Const CPS_REVERT = &H3
Public Const CPS_CANCEL = &H4

'  Windows for Simplified Chinese Edition hot key ID from 0x10 - 0x2F
Public Const IME_CHOTKEY_IME_NONIME_TOGGLE = &H10
Public Const IME_CHOTKEY_SHAPE_TOGGLE = &H11
Public Const IME_CHOTKEY_SYMBOL_TOGGLE = &H12

'  Windows for Japanese Edition hot key ID from 0x30 - 0x4F
Public Const IME_JHOTKEY_CLOSE_OPEN = &H30

'  Windows for Korean Edition hot key ID from 0x50 - 0x6F
Public Const IME_KHOTKEY_SHAPE_TOGGLE = &H50
Public Const IME_KHOTKEY_HANJACONVERT = &H51
Public Const IME_KHOTKEY_ENGLISH = &H52

'  Windows for Tranditional Chinese Edition hot key ID from 0x70 - 0x8F
Public Const IME_THOTKEY_IME_NONIME_TOGGLE = &H70
Public Const IME_THOTKEY_SHAPE_TOGGLE = &H71
Public Const IME_THOTKEY_SYMBOL_TOGGLE = &H72

'  direct switch hot key ID from 0x100 - 0x11F
Public Const IME_HOTKEY_DSWITCH_FIRST = &H100
Public Const IME_HOTKEY_DSWITCH_LAST = &H11F

'  IME private hot key from 0x200 - 0x21F
Public Const IME_ITHOTKEY_RESEND_RESULTSTR = &H200
Public Const IME_ITHOTKEY_PREVIOUS_COMPOSITION = &H201
Public Const IME_ITHOTKEY_UISTYLE_TOGGLE = &H202

'  parameter of ImmGetCompositionString
Public Const GCS_COMPREADSTR = &H1
Public Const GCS_COMPREADATTR = &H2
Public Const GCS_COMPREADCLAUSE = &H4
Public Const GCS_COMPSTR = &H8
Public Const GCS_COMPATTR = &H10
Public Const GCS_COMPCLAUSE = &H20
Public Const GCS_CURSORPOS = &H80
Public Const GCS_DELTASTART = &H100
Public Const GCS_RESULTREADSTR = &H200
Public Const GCS_RESULTREADCLAUSE = &H400
Public Const GCS_RESULTSTR = &H800
Public Const GCS_RESULTCLAUSE = &H1000

'  style bit flags for WM_IME_COMPOSITION
Public Const CS_INSERTCHA

programatrix

Public Const PROCESS_HEAP_REGION = &H1
Public Const PROCESS_HEAP_UNCOMMITTED_RANGE = &H2
Public Const PROCESS_HEAP_ENTRY_BUSY = &H4
Public Const PROCESS_HEAP_ENTRY_MOVEABLE = &H10
Public Const PROCESS_HEAP_ENTRY_DDESHARE = &H20

Declare Function HeapLock Lib "kernel32" Alias "HeapLock" (ByVal hHeap As Long) As Long
Declare Function HeapUnlock Lib "kernel32" Alias "HeapUnlock" (ByVal hHeap As Long) As Long

'  GetBinaryType return values.

Public Const SCS_32BIT_BINARY = 0
Public Const SCS_DOS_BINARY = 1
Public Const SCS_WOW_BINARY = 2
Public Const SCS_PIF_BINARY = 3
Public Const SCS_POSIX_BINARY = 4
Public Const SCS_OS216_BINARY = 5

Declare Function GetBinaryType Lib "kernel32" Alias "GetBinaryTypeA" (ByVal lpApplicationName As String, lpBinaryType As Long) As Long

Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathName" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Declare Function GetProcessAffinityMask Lib "kernel32" Alias "GetProcessAffinityMask" (ByVal hProcess As Long, lpProcessAffinityMask As Long, SystemAffinityMask As Long) As Long

'  Logon Support APIs

Public Const LOGON32_LOGON_INTERACTIVE = 2
Public Const LOGON32_LOGON_BATCH = 4
Public Const LOGON32_LOGON_SERVICE = 5

Public Const LOGON32_PROVIDER_DEFAULT = 0
Public Const LOGON32_PROVIDER_WINNT35 = 1

Declare Function LogonUser Lib "ADVAPI32.DLL" Alias "LogonUserA" (ByVal lpszUsername As String, ByVal lpszDomain As String, ByVal lpszPassword As String, ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, phToken As Long) As Long

Declare Function ImpersonateLoggedOnUser Lib "kernel32" Alias "ImpersonateLoggedOnUser" (ByVal hToken As Long) As Long
Declare Function CreateProcessAsUser Lib "kernel32" Alias "CreateProcessAsUserA" (ByVal hToken As Long, ByVal lpApplicationName As String, ByVal lpCommandLine As String, ByVal lpProcessAttributes As SECURITY_ATTRIBUTES, ByVal lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As String, ByVal lpCurrentDirectory As String, ByVal lpStartupInfo As STARTUPINFO, ByVal lpProcessInformation As PROCESS_INFORMATION) As Long

'  Performance counter API's

Type OSVERSIONINFO
        dwOSVersionInfoSize As Long
        dwMajorVersion As Long
        dwMinorVersion As Long
        dwBuildNumber As Long
        dwPlatformId As Long
        szCSDVersion As String * 128      '  Maintenance string for PSS usage
End Type

'  dwPlatformId defines:
'
Public Const VER_PLATFORM_WIN32s = 0
Public Const VER_PLATFORM_WIN32_WINDOWS = 1
Public Const VER_PLATFORM_WIN32_NT = 2

Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (ByVal lpVersionInformation As OSVERSIONINFO) As Long

'  Power Management APIs

Public Const AC_LINE_OFFLINE = &H0
Public Const AC_LINE_ONLINE = &H1
Public Const AC_LINE_BACKUP_POWER = &H2
Public Const AC_LINE_UNKNOWN = &HFF
Public Const BATTERY_FLAG_HIGH = &H1
Public Const BATTERY_FLAG_LOW = &H2
Public Const BATTERY_FLAG_CRITICAL = &H4
Public Const BATTERY_FLAG_CHARGING = &H8
Public Const BATTERY_FLAG_NO_BATTERY = &H80
Public Const BATTERY_FLAG_UNKNOWN = &HFF
Public Const BATTERY_PERCENTAGE_UNKNOWN = &HFF
Public Const BATTERY_LIFE_UNKNOWN = &HFFFF

Type SYSTEM_POWER_STATUS
        ACLineStatus As Byte
        BatteryFlag As Byte
        BatteryLifePercent As Byte
        Reserved1 As Byte
        BatteryLifeTime As Long
        BatteryFullLifeTime As Long
End Type

Declare Function GetSystemPowerStatus Lib "kernel32" Alias "GetSystemPowerStatus" (lpSystemPowerStatus As SYSTEM_POWER_STATUS) As Long
Declare Function SetSystemPowerState Lib "kernel32" Alias "SetSystemPowerState" (ByVal fSuspend As Long, ByVal fForce As Long) As Long

' *   commdlg.h -- This module defines the 32-Bit Common Dialog APIs      *

Type OPENFILENAME
        lStructSize As Long
        hwndOwner As Long
        hInstance As Long
        lpstrFilter As String
        lpstrCustomFilter As String
        nMaxCustFilter As Long
        nFilterIndex As Long
        lpstrFile As String
        nMaxFile As Long
        lpstrFileTitle As String
        nMaxFileTitle As Long
        lpstrInitialDir As String
        lpstrTitle As String
        flags As Long
        nFileOffset As Integer
        nFileExtension As Integer
        lpstrDefExt As String
        lCustData As Long
        lpfnHook As Long
        lpTemplateName As String
End Type

Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long

Declare Function GetFileTitle Lib "comdlg32.dll" Alias "GetFileTitleA" (ByVal lpszFile As String, ByVal lpszTitle As String, ByVal cbBuf As Integer) As Integer

Public Const OFN_READONLY = &H1
Public Const OFN_OVERWRITEPROMPT = &H2
Public Const OFN_HIDEREADONLY = &H4
Public Const OFN_NOCHANGEDIR = &H8
Public Const OFN_SHOWHELP = &H10
Public Const OFN_ENABLEHOOK = &H20
Public Const OFN_ENABLETEMPLATE = &H40
Public Const OFN_ENABLETEMPLATEHANDLE = &H80
Public Const OFN_NOVALIDATE = &H100
Public Const OFN_ALLOWMULTISELECT = &H200
Public Const OFN_EXTENSIONDIFFERENT = &H400
Public Const OFN_PATHMUSTEXIST = &H800
Public Const OFN_FILEMUSTEXIST = &H1000
Public Const OFN_CREATEPROMPT = &H2000
Public Const OFN_SHAREAWARE = &H4000
Public Const OFN_NOREADONLYRETURN = &H8000
Public Const OFN_NOTESTFILECREATE = &H10000
Public Const OFN_NONETWORKBUTTON = &H20000
Public Const OFN_NOLONGNAMES = &H40000                      '  force no long names for 4.x modules
Public Const OFN_EXPLORER = &H80000                         '  new look commdlg
Public Const OFN_NODEREFERENCELINKS = &H100000
Public Const OFN_LONGNAMES = &H200000                       '  force long names for 3.x modules

Public Const OFN_SHAREFALLTHROUGH = 2
Public Const OFN_SHARENOWARN = 1
Public Const OFN_SHAREWARN = 0

Type NMHDR
    hwndFrom As Long
    idfrom As Long
    code As Long
End Type

Type OFNOTIFY
        hdr As NMHDR
        lpOFN As OPENFILENAME
        pszFile As String        '  May be NULL
End Type

Public Const CDM_FIRST = (WM_USER + 100)
Public Const CDM_LAST = (WM_USER + 200)
Public Const CDM_GETSPEC = (CDM_FIRST + &H0)
Public Const CDM_GETFILEPATH = (CDM_FIRST + &H1)
Public Const CDM_GETFOLDERPATH = (CDM_FIRST + &H2)
Public Const CDM_GETFOLDERIDLIST = (CDM_FIRST + &H3)
Public Const CDM_SETCONTROLTEXT = (CDM_FIRST + &H4)
Public Const CDM_HIDECONTROL = (CDM_FIRST + &H5)
Public Const CDM_SETDEFEXT = (CDM_FIRST + &H6)

Type CHOOSECOLOR
        lStructSize As Long
        hwndOwner As Long
        hInstance As Long
        rgbResult As Long
        lpCustColors As Long
        flags As Long
        lCustData As Long
        lpfnHook As Long
        lpTemplateName As String
End Type

Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As CHOOSECOLOR) As Long

Public Const CC_RGBINIT = &H1
Public Const CC_FULLOPEN = &H2
Public Const CC_PREVENTFULLOPEN = &H4
Public Const CC_SHOWHELP = &H8
Public Const CC_ENABLEHOOK = &H10
Public Const CC_ENABLETEMPLATE = &H20
Public Const CC_ENABLETEMPLATEHANDLE = &H40
Public Const CC_SOLIDCOLOR = &H80
Public Const CC_ANYCOLOR = &H100

Type FINDREPLACE
        lStructSize As Long        '  size of this struct 0x20
        hwndOwner As Long          '  handle to owner's window
        hInstance As Long          '  instance handle of.EXE that
                                    '    contains cust. dlg. template
        flags As Long              '  one or more of the FR_??
        lpstrFindWhat As String      '  ptr. to search string
        lpstrReplaceWith As String   '  ptr. to replace string
        wFindWhatLen As Integer       '  size of find buffer
        wReplaceWithLen As Integer    '  size of replace buffer
        lCustData As Long          '  data passed to hook fn.
        lpfnHook As Long            '  ptr. to hook fn. or NULL
        lpTemplateName As String     '  custom template name
End Type

Public Const FR_DOWN = &H1
Public Const FR_WHOLEWORD = &H2
Public Const FR_MATCHCASE = &H4
Public Const FR_FINDNEXT = &H8
Public Const FR_REPLACE = &H10
Public Const FR_REPLACEALL = &H20
Public Const FR_DIALOGTERM = &H40
Public Const FR_SHOWHELP = &H80
Public Const FR_ENABLEHOOK = &H100
Public Const FR_ENABLETEMPLATE = &H200
Public Const FR_NOUPDOWN = &H400
Public Const FR_NOMATCHCASE = &H800
Public Const FR_NOWHOLEWORD = &H1000
Public Const FR_ENABLETEMPLATEHANDLE = &H2000
Public Const FR_HIDEUPDOWN = &H4000
Public Const FR_HIDEMATCHCASE = &H8000
Public Const FR_HIDEWHOLEWORD = &H10000

Declare Function FindText Lib "comdlg32.dll" Alias "FindTextA " (pFindreplace As FINDREPLACE) As Long

Declare Function ReplaceText Lib "comdlg32.dll" Alias "ReplaceTextA" (pFindreplace As FINDREPLACE) As Long

Type CHOOSEFONT
        lStructSize As Long
        hwndOwner As Long          '  caller's window handle
        hdc As Long                '  printer DC/IC or NULL
        lpLogFont As LOGFONT          '  ptr. to a LOGFONT struct
        iPointSize As Long         '  10 * size in points of selected font
        flags As Long              '  enum. type flags
        rgbColors As Long          '  returned text color
        lCustData As Long          '  data passed to hook fn.
        lpfnHook As Long           '  ptr. to hook function
        lpTemplateName As String     '  custom template name
        hInstance As Long          '  instance handle of.EXE that
                                       '    contains cust. dlg. template
        lpszStyle As String          '  return the style field here
                                       '  must be LF_FACESIZE or bigger
        nFontType As Integer          '  same value reported to the EnumFonts
                                       '    call back with the extra FONTTYPE_
                                       '    bits added
        MISSING_ALIGNMENT As Integer
        nSizeMin As Long           '  minimum pt size allowed &
        nSizeMax As Long           '  max pt size allowed if
                                       '    CF_LIMITSIZE is used
End Type

Declare Function ChooseFont Lib "comdlg32.dll" Alias "ChooseFontA" (pChoosefont As CHOOSEFONT) As Long

Public Const CF_SCREENFONTS = &H1
Public Const CF_PRINTERFONTS = &H2
Public Const CF_BOTH = (CF_SCREENFONTS Or CF_PRINTERFONTS)
Public Const CF_SHOWHELP = &H4&
Public Const CF_ENABLEHOOK = &H8&
Public Const CF_ENABLETEMPLATE = &H10&
Public Const CF_ENABLETEMPLATEHANDLE = &H20&
Public Const CF_INITTOLOGFONTSTRUCT = &H40&
Public Const CF_USESTYLE = &H80&
Public Const CF_EFFECTS = &H100&
Public Const CF_APPLY = &H200&
Public Const CF_ANSIONLY = &H400&
Public Const CF_SCRIPTSONLY = CF_ANSIONLY
Public Const CF_NOVECTORFONTS = &H800&
Public Const CF_NOOEMFONTS = CF_NOVECTORFONTS
Public Const CF_NOSIMULATIONS = &H1000&
Public Const CF_LIMITSIZE = &H2000&
Public Const CF_FIXEDPITCHONLY = &H4000&
Public Const CF_WYSIWYG = &H8000 '  must also have CF_SCREENFONTS CF_PRINTERFONTS
Public Const CF_FORCEFONTEXIST = &H10000
Public Const CF_SCALABLEONLY = &H20000
Public Const CF_TTONLY = &H40000
Public Const CF_NOFACESEL = &H80000
Public Const CF_NOSTYLESEL = &H100000
Public Const CF_NOSIZESEL = &H200000
Public Const CF_SELECTSCRIPT = &H400000
Public Const CF_NOSCRIPTSEL = &H800000
Public Const CF_NOVERTFONTS = &H1000000

Public Const SIMULATED_FONTTYPE = &H8000
Public Const PRINTER_FONTTYPE = &H4000
Public Const SCREEN_FONTTYPE = &H2000
Public Const BOLD_FONTTYPE = &H100
Public Const ITALIC_FONTTYPE = &H200
Public Const REGULAR_FONTTYPE = &H400

Public Const WM_CHOOSEFONT_GETLOGFONT = (WM_USER + 1)
Public Const WM_CHOOSEFONT_SETLOGFONT = (WM_USER + 101)
Public Const WM_CHOOSEFONT_SETFLAGS = (WM_USER + 102)

Public Const LBSELCHSTRING = "commdlg_LBSelChangedNotify"
Public Const SHAREVISTRING = "commdlg_ShareViolation"
Public Const FILEOKSTRING = "commdlg_FileNameOK"
Public Const COLOROKSTRING = "commdlg_ColorOK"
Public Const SETRGBSTRING = "commdlg_SetRGBColor"
Public Const HELPMSGSTRING = "commdlg_help"
Public Const FINDMSGSTRING = "commdlg_FindReplace"

Public Const CD_LBSELNOITEMS = -1
Public Const CD_LBSELCHANGE = 0
Public Const CD_LBSELSUB = 1
Public Const CD_LBSELADD = 2

Type PRINTDLG
        lStructSize As Long
        hwndOwner As Long
        hDevMode As Long
        hDevNames As Long
        hdc As Long
        flags As Long
        nFromPage As Integer
        nToPage As Integer
        nMinPage As Integer
        nMaxPage As Integer
        nCopies As Integer
        hInstance As Long
        lCustData As Long
        lpfnPrintHook As Long
        lpfnSetupHook As Long
        lpPrintTemplateName As String
        lpSetupTemplateName As String
        hPrintTemplate As Long
        hSetupTemplate As Long
End Type

Declare Function PrintDlg Lib "comdlg32.dll" Alias "PrintDlgA" (pPrintdlg As PRINTDLG) As Long

Public Const PD_ALLPAGES = &H0
Public Const PD_SELECTION = &H1
Public Const PD_PAGENUMS = &H2
Public Const PD_NOSELECTION = &H4
Public Const PD_NOPAGENUMS = &H8
Public Const PD_COLLATE = &H10
Public Const PD_PRINTTOFILE = &H20
Public Const PD_PRINTSETUP = &H40
Public Const PD_NOWARNING = &H80
Public Const PD_RETURNDC = &H100
Public Const PD_RETURNIC = &H200
Public Const PD_RETURNDEFAULT = &H400
Public Const PD_SHOWHELP = &H800
Public Const PD_ENABLEPRINTHOOK = &H1000
Public Const PD_ENABLESETUPHOOK = &H2000
Public Const PD_ENABLEPRINTTEMPLATE = &H4000
Public Const PD_ENABLESETUPTEMPLATE = &H8000
Public Const PD_ENABLEPRINTTEMPLATEHANDLE = &H10000
Public Const PD_ENABLESETUPTEMPLATEHANDLE = &H20000
Public Const PD_USEDEVMODECOPIES = &H40000
Public Const PD_USEDEVMODECOPIESANDCOLLATE = &H40000
Public Const PD_DISABLEPRINTTOFILE = &H80000
Public Const PD_HIDEPRINTTOFILE = &H100000
Public Const PD_NONETWORKBUTTON = &H200000

Type DEVNAMES
        wDriverOffset As Integer
        wDeviceOffset As Integer
        wOutputOffset As Integer
        wDefault As Integer
End Type

Public Const DN_DEFAULTPRN = &H1

Declare Function CommDlgExtendedError Lib "comdlg32.dll" Alias "CommDlgExtendedError" () As Long

Public Const WM_PSD_PAGESETUPDLG = (WM_USER)
Public Const WM_PSD_FULLPAGERECT = (WM_USER + 1)
Public Const WM_PSD_MINMARGINRECT = (WM_USER + 2)
Public Const WM_PSD_MARGINRECT = (WM_USER + 3)
Public Const WM_PSD_GREEKTEXTRECT = (WM_USER + 4)
Public Const WM_PSD_ENVSTAMPRECT = (WM_USER + 5)
Public Const WM_PSD_YAFULLPAGERECT = (WM_USER + 6)

Type PAGESETUPDLG
        lStructSize As Long
        hwndOwner As Long
        hDevMode As Long
        hDevNames As Long
        flags As Long
        ptPaperSize As POINTAPI
        rtMinMargin As Rect
        rtMargin As Rect
        hInstance As Long
        lCustData As Long
        lpfnPageSetupHook As Long
        lpfnPagePaintHook As Long
        lpPageSetupTemplateName As String
        hPageSetupTemplate As Long
End Type

Declare Function PageSetupDlg Lib "comdlg32.dll" Alias "PageSetupDlgA" (pPagesetupdlg As PAGESETUPDLG) As Long

Public Const PSD_DEFAULTMINMARGINS = &H0 '  default (printer's)
Public Const PSD_INWININIINTLMEASURE = &H0 '  1st of 4 possible

Public Const PSD_MINMARGINS = &H1 '  use caller's
Public Const PSD_MARGINS = &H2 '  use caller's
Public Const PSD_INTHOUSANDTHSOFINCHES = &H4 '  2nd of 4 possible
Public Const PSD_INHUNDREDTHSOFMILLIMETERS = &H8 '  3rd of 4 possible
Public Const PSD_DISABLEMARGINS = &H10
Public Const PSD_DISABLEPRINTER = &H20
Public Const PSD_NOWARNING = &H80 '  must be same as PD_*
Public Const PSD_DISABLEORIENTATION = &H100
Public Const PSD_RETURNDEFAULT = &H400 '  must be same as PD_*
Public Const PSD_DISABLEPAPER = &H200
Public Const PSD_SHOWHELP = &H800 '  must be same as PD_*
Public Const PSD_ENABLEPAGESETUPHOOK = &H2000 '  must be same as PD_*
Public Const PSD_ENABLEPAGESETUPTEMPLATE = &H8000 '  must be same as PD_*
Public Const PSD_ENABLEPAGESETUPTEMPLATEHANDLE = &H20000 '  must be same as PD_*
Public Const PSD_ENABLEPAGEPAINTHOOK = &H40000
Public Const PSD_DISABLEPAGEPAINTING = &H80000

Declare Function DdeInitialize Lib "user32" Alias "DdeInitializeA" (pidInst As Long, ByVal pfnCallback As Long, ByVal afCmd As Long, ByVal ulRes As Long) As Integer
Declare Function SetServiceBits Lib "advapi32" Alias "SetServiceBits" (ByVal hServiceStatus As Long, ByVal dwServiceBits As Long, ByVal bSetBitsOn As Boolean, ByVal bUpdateImmediately As Boolean) As Long
Declare Function CopyLZFile Lib "lz32" Alias "CopyLZFile" (ByVal n1 As Long, ByVal n2 As Long) As Long
Declare Function LZStart Lib "lz32" Alias "LZStart" () As Long
Declare Sub LZDone Lib "lz32" Alias "LZDone" ()
Declare Function mciGetYieldProc Lib "winmm" Alias "mciGetYieldProc" (ByVal mciId As Long, pdwYieldData As Long) As Long
Declare Function mciSetYieldProc Lib "winmm" Alias "mciSetYieldProc" (ByVal mciId As Long, ByVal fpYieldProc As Long, ByVal dwYieldData As Long) As Long
Declare Function midiOutGetNumDevs Lib "winmm" Alias "midiOutGetNumDevs" () As Integer
Declare Function mmioInstallIOProcA Lib "winmm" Alias "mmioInstallIOProcA" (ByVal fccIOProc As String * 4, ByVal pIOProc As Long, ByVal dwFlags As Long) As Long
Declare Function CommandLineToArgv Lib "shell32" Alias "CommandLineToArgvW" (ByVal lpCmdLine As String, pNumArgs As Integer) As Long
Declare Function IsTextUnicode Lib "advapi32" Alias "IsTextUnicode" (lpBuffer As Any, ByVal cb As Long, lpi As Long) As Long
Declare Function NotifyChangeEventLog Lib "advapi32" Alias "NotifyChangeEventLog" (ByVal hEventLog As Long, ByVal hEvent As Long) As Long
Declare Function ObjectOpenAuditAlarm Lib "advapi32" Alias "ObjectOpenAuditAlarmA" (ByVal SubsystemName As String, HandleId As Any, ByVal ObjectTypeName As String, ByVal ObjectName As String, pSecurityDescriptor As SECURITY_DESCRIPTOR, ByVal ClientToken As Long, ByVal DesiredAccess As Long, ByVal GrantedAccess As Long, Privileges As PRIVILEGE_SET, ByVal ObjectCreation As Boolean, ByVal AccessGranted As Boolean, GenerateOnClose As Boolean) As Long
Declare Function SetThreadToken Lib "advapi32" Alias "SetThreadToken" (Thread As Long, ByVal Token As Long) As Long

Type COMMCONFIG
    dwSize As Long
    wVersion As Integer
    wReserved As Integer
    dcbx As DCB
    dwProviderSubType As Long
    dwProviderOffset As Long
    dwProviderSize As Long
    wcProviderData As Byte
End Type

Declare Function CommConfigDialog Lib "kernel32" Alias "CommConfigDialogA" (ByVal lpszName As String, ByVal hWnd As Long, lpCC As COMMCONFIG) As Long
Declare Function CreateIoCompletionPort Lib "kernel32" Alias "CreateIoCompletionPort" (ByVal FileHandle As Long, ByVal ExistingCompletionPort As Long, ByVal CompletionKey As Long, ByVal NumberOfConcurrentThreads As Long) As Long
Declare Function DisableThreadLibraryCalls Lib "kernel32" Alias "DisableThreadLibraryCalls" (ByVal hLibModule As Long) As Long
Declare Function EnumResourceLanguages Lib "kernel32" Alias "EnumResourceLanguagesA" (ByVal hModule As Long, ByVal lpType As String, ByVal lpName As String, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function EnumResourceNames Lib "kernel32" Alias "EnumResourceNamesA" (ByVal hModule As Long, ByVal lpType As String, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function EnumResourceTypes Lib "kernel32" Alias "EnumResourceTypesA" (ByVal hModule As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function FreeEnvironmentStrings Lib "kernel32" Alias "FreeEnvironmentStringsA" (ByVal lpsz As String) As Long

Declare Sub FreeLibraryAndExitThread Lib "kernel32" Alias "FreeLibraryAndExitThread" (ByVal hLibModule As Long, ByVal dwExitCode As Long)
Declare Function FreeResource Lib "kernel32" Alias "FreeResource" (ByVal hResData As Long) As Long
Declare Function GetCommConfig Lib "kernel32" Alias "GetCommConfig" (ByVal hCommDev As Long, lpCC As COMMCONFIG, lpdwSize As Long) As Long
Declare Function GetCompressedFileSize Lib "kernel32" Alias "GetCompressedFileSizeA" (ByVal lpFileName As String, lpFileSizeHigh As Long) As Long
Declare Function GetDefaultCommConfig Lib "kernel32" Alias "GetDefaultCommConfigA" (ByVal lpszName As String, lpCC As COMMCONFIG, lpdwSize As Long) As Long
Declare Function GetHandleInformation Lib "kernel32" Alias "GetHandleInformation" (ByVal hObject As Long, lpdwFlags As Long) As Long
Declare Function GetProcessHeaps Lib "kernel32" Alias "GetProcessHeaps" (ByVal NumberOfHeaps As Long, ProcessHeaps As Long) As Long
Declare Function GetProcessWorkingSetSize Lib "kernel32" Alias "GetProcessWorkingSetSize" (ByVal hProcess As Long, lpMinimumWorkingSetSize As Long, lpMaximumWorkingSetSize As Long) As Long
Declare Function GetQueuedCompletionStatus Lib "kernel32" Alias "GetQueuedCompletionStatus" (ByVal CompletionPort As Long, lpNumberOfBytesTransferred As Long, lpCompletionKey As Long, lpOverlapped As Long, ByVal dwMilliseconds As Long) As Long
Declare Function GetSystemTimeAdjustment Lib "kernel32" Alias "GetSystemTimeAdjustment" (lpTimeAdjustment As Long, lpTimeIncrement As Long, lpTimeAdjustmentDisabled As Boolean) As Long

Declare Function GlobalCompact Lib "kernel32" Alias "GlobalCompact" (ByVal dwMinFree As Long) As Long
Declare Sub GlobalFix Lib "kernel32" Alias "GlobalFix" (ByVal hMem As Long)
Declare Sub GlobalUnfix Lib "kernel32" Alias "GlobalUnfix" (ByVal hMem As Long)
Declare Function GlobalWire Lib "kernel32" Alias "GlobalWire" (ByVal hMem As Long) As Long
Declare Function GlobalUnWire Lib "kernel32" Alias "GlobalUnWire" (ByVal hMem As Long) As Long

Declare Function IsBadCodePtr Lib "kernel32" Alias "IsBadCodePtr" (ByVal lpfn As Long) As Long
Declare Function LocalCompact Lib "kernel32" Alias "LocalCompact" (ByVal uMinFree As Long) As Long
Declare Function LocalShrink Lib "kernel32" Alias "LocalShrink" (ByVal hMem As Long, ByVal cbNewSize As Long) As Long
Declare Function MapViewOfFile Lib "kernel32" Alias "MapViewOfFile" (ByVal hFileMappingObject As Long, ByVal dwDesiredAccess As Long, ByVal dwFileOffsetHigh As Long, ByVal dwFileOffsetLow As Long, ByVal dwNumberOfBytesToMap As Long) As Long
Declare Function ReadFileEx Lib "kernel32" Alias "ReadFileEx" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpOverlapped As OVERLAPPED, ByVal lpCompletionRoutine As Long) As Long

Declare Function SetCommConfig Lib "kernel32" Alias "SetCommConfig" (ByVal hCommDev As Long, lpCC As COMMCONFIG, ByVal dwSize As Long) As Long
Declare Function SetDefaultCommConfig Lib "kernel32" Alias "SetDefaultCommConfigA" (ByVal lpszName As String, lpCC As COMMCONFIG, ByVal dwSize As Long) As Long
Declare Sub SetFileApisToANSI Lib "kernel32" Alias "SetFileApisToANSI" ()
Declare Function SetHandleInformation Lib "kernel32" Alias "SetHandleInformation" (ByVal hObject As Long, ByVal dwMask As Long, ByVal dwFlags As Long) As Long
Declare Function SetProcessWorkingSetSize Lib "kernel32" Alias "SetProcessWorkingSetSize" (ByVal hProcess As Long, ByVal dwMinimumWorkingSetSize As Long, ByVal dwMaximumWorkingSetSize As Long) As Long

Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Declare Function lstrcpyn Lib "kernel32" Alias "lstrcpynA" (ByVal lpString1 As String, ByVal lpString2 As String, ByVal iMaxLength As Long) As Long
Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Declare Function SetSystemTimeAdjustment Lib "kernel32" Alias "SetSystemTimeAdjustment" (ByVal dwTimeAdjustment As Long, ByVal bTimeAdjustmentDisabled As Boolean) As Long
Declare Function SetThreadAffinityMask Lib "kernel32" Alias "SetThreadAffinityMask" (ByVal hThread As Long, ByVal dwThreadAffinityMask As Long) As Long
Declare Function SetUnhandledExceptionFilter Lib "kernel32" Alias "SetUnhandledExceptionFilter" (ByVal lpTopLevelExceptionFilter As Long) As Long
Declare Function SystemTimeToTzSpecificLocalTime Lib "kernel32" Alias "SystemTimeToTzSpecificLocalTime" (lpTimeZoneInformation As TIME_ZONE_INFORMATION, lpUniversalTime As SYSTEMTIME, lpLocalTime As SYSTEMTIME) As Long
Declare Function WriteFileEx Lib "kernel32" Alias "WriteFileEx" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpOverlapped As OVERLAPPED, ByVal lpCompletionRoutine As Long) As Long

Type PIXELFORMATDESCRIPTOR
    nSize As Integer
    nVersion As Integer
    dwFlags As Long
    iPixelType As Byte
    cColorBits As Byte
    cRedBits As Byte
    cRedShift As Byte
    cGreenBits As Byte
    cGreenShift As Byte
    cBlueBits As Byte
    cBlueShift As Byte
    cAlphaBits As Byte
    cAlphaShift As Byte
    cAccumBits As Byte
    cAccumRedBits As Byte
    cAccumGreenBits As Byte
    cAccumBlueBits As Byte
    cAccumAlphaBits As Byte
    cDepthBits As Byte
    cStencilBits As Byte
    cAuxBuffers As Byte
    iLayerType As Byte
    bReserved As Byte
    dwLayerMask As Long
    dwVisibleMask As Long
    dwDamageMask As Long
End Type

Declare Function ChoosePixelFormat Lib "gdi32" Alias "ChoosePixelFormat" (ByVal hDC As Long, pPixelFormatDescriptor As PIXELFORMATDESCRIPTOR) As Long
Declare Function CreateDIBSection Lib "gdi32" Alias "CreateDIBSection" (ByVal hDC As Long, pBitmapInfo As BITMAPINFO, ByVal un As Long, ByVal lplpVoid As Long, ByVal handle As Long, ByVal dw As Long) As Long
Declare Function DescribePixelFormat Lib "gdi32" Alias "DescribePixelFormat" (ByVal hDC As Long, ByVal n As Long, ByVal un As Long, lpPixelFormatDescriptor As PIXELFORMATDESCRIPTOR) As Long
Declare Function EndDoc Lib "gdi32" Alias "EndDoc" (ByVal hDC As Long) As Long
Declare Function EnumFonts Lib "gdi32" Alias "EnumFontsA" (ByVal hDC As Long, ByVal lpsz As String, ByVal lpFontEnumProc As Long, ByVal lParam As Long) As Long
Declare Function EnumMetaFile Lib "gdi32" Alias "EnumMetaFile" (ByVal hDC As Long, ByVal hMetafile As Long, ByVal lpMFEnumProc As Long, ByVal lParam As Long) As Long
Declare Function EnumObjects Lib "gdi32" Alias "EnumObjects" (ByVal hDC As Long, ByVal n As Long, ByVal lpGOBJEnumProc As Long, lpVoid As Any) As Long

Declare Function FixBrushOrgEx Lib "gdi32" Alias "FixBrushOrgEx" (ByVal hDC As Long, ByVal n1 As Long, ByVal n2 As Long, lpPoint As POINTAPI) As Long
Declare Function GetBrushOrgEx Lib "gdi32" Alias "GetBrushOrgEx" (ByVal hDC As Long, lpPoint As POINTAPI) As Long
Declare Function GetCharWidth Lib "gdi32" Alias "GetCharWidthA" (ByVal hDC As Long, ByVal un1 As Long, ByVal un2 As Long, lpn As Long) As Long
Declare Function GetDIBColorTable Lib "gdi32" Alias "GetDIBColorTable" (ByVal hDC As Long, ByVal un1 As Long, ByVal un2 As Long, pRGBQuad As RGBQUAD) As Long
Declare Function GetPixelFormat Lib "gdi32" Alias "GetPixelFormat" (ByVal hDC As Long) As Long
Declare Function LineDDA Lib "gdi32" Alias "LineDDA" (ByVal n1 As Long, ByVal n2 As Long, ByVal n3 As Long, ByVal n4 As Long, ByVal lpLineDDAProc As Long, ByVal lParam As Long) As Long

Declare Function SetAbortProc Lib "gdi32" Alias "SetAbortProc" (ByVal hDC As Long, ByVal lpAbortProc As Long) As Long
Declare Function SetDIBColorTable Lib "gdi32" Alias "SetDIBColorTable" (ByVal hDC As Long, ByVal un1 As Long, ByVal un2 As Long, pcRGBQuad As RGBQUAD) As Long
Declare Function SetPixelFormat Lib "gdi32" Alias "SetPixelFormat" (ByVal hDC As Long, ByVal n As Long, pcPixelFormatDescriptor As PIXELFORMATDESCRIPTOR) As Long
Declare Function SwapBuffers Lib "gdi32" Alias "SwapBuffers" (ByVal hDC As Long) As Long
Declare Function EnumCalendarInfo Lib "kernel32" Alias "EnumCalendarInfoA" (ByVal lpCalInfoEnumProc As Long, ByVal Locale As Long, ByVal Calendar As Long, ByVal CalType As Long) As Long
Declare Function GetCurrencyFormat Lib "kernel32" Alias "GetCurrencyFormatA" (ByVal Locale As Long, ByVal dwFlags As Long, ByVal lpValue As String, lpFormat As CURRENCYFMT, ByVal lpCurrencyStr As String, ByVal cchCurrency As Long) As Long
Declare Function GetNumberFormat Lib "kernel32" Alias "GetNumberFormatA" (ByVal Locale As Long, ByVal dwFlags As Long, ByVal lpValue As String, lpFormat As NUMBERFMT, ByVal lpNumberStr As String, ByVal cchNumber As Long) As Long
Declare Function GetStringTypeEx Lib "kernel32" Alias "GetStringTypeExA" (ByVal Locale As Long, ByVal dwInfoType As Long, ByVal lpSrcStr As String, ByVal cchSrc As Long, lpCharType As Integer) As Long
Declare Function GetStringTypeW Lib "kernel32" Alias "GetStringTypeW" (ByVal dwInfoType As Long, ByVal lpSrcStr As String, ByVal cchSrc As Long, lpCharType As Integer) As Long
Declare Function IsDBCSLeadByte Lib "kernel32" Alias "IsDBCSLeadByte" (ByVal TestChar As Byte) As Long
Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String) As Long

Declare Function DeletePrinter Lib "winspool.drv" Alias "DeletePrinter" (ByVal hPrinter As Long) As Long

Declare Function FindClosePrinterChangeNotification Lib "winspool.drv" Alias "FindClosePrinterChangeNotification" (ByVal hChange As Long) As Long
Declare Function FindFirstPrinterChangeNotification Lib "winspool.drv" Alias "FindFirstPrinterChangeNotification" (ByVal hPrinter As Long, ByVal fdwFlags As Long, ByVal fdwOptions As Long, ByVal pPrinterNotifyOptions As String) As Long
Declare Function FindNextPrinterChangeNotification Lib "winspool.drv" Alias "FindNextPrinterChangeNotification" (ByVal hChange As Long, pdwChange As Long, ByVal pvReserved As String, ByVal ppPrinterNotifyInfo As Long) As Long
Declare Function GetPrinter Lib "winspool.drv" Alias "GetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pPrinter As Any, ByVal cbBuf As Long, pcbNeeded As Long) As Long
Declare Function SetPrinter Lib "winspool.drv" Alias "SetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pPrinter As Byte, ByVal Command As Long) As Long

Declare Function BroadcastSystemMessage Lib "user32" Alias "BroadcastSystemMessage" (ByVal dw As Long, pdw As Long, ByVal un As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function CascadeWindows Lib "user32" Alias "CascadeWindows" (ByVal hwndParent As Long, ByVal wHow As Long, ByVal lpRect As RECT, ByVal cKids As Long, lpkids As Long) As Integer
Declare Function ChangeMenu Lib "user32" Alias "ChangeMenuA" (ByVal hMenu As Long, ByVal cmd As Long, ByVal lpszNewItem As String, ByVal cmdInsert As Long, ByVal flags As Long) As Long
Declare Function CheckMenuRadioItem Lib "user32" Alias "CheckMenuRadioItem" (ByVal hMenu As Long, ByVal un1 As Long, ByVal un2 As Long, ByVal un3 As Long, ByVal un4 As Long) As Long
Declare Function ChildWindowFromPoint Lib "user32" Alias "ChildWindowFromPoint" (ByVal hWndParent As Long, ByVal pt As POINTAPI) As Long
Declare Function ChildWindowFromPointEx Lib "user32" Alias "ChildWindowFromPointEx" (ByVal hWnd As Long, ByVal pt As POINTAPI, ByVal un As Long) As Long
Declare Function CloseDesktop Lib "user32" Alias "CloseDesktop" (ByVal hDesktop As Long) As Long
Declare Function CloseWindowStation Lib "user32" Alias "CloseWindowStation" (ByVal hWinSta As Long) As Long

Declare Function CopyImage Lib "user32" Alias "CopyImage" (ByVal handle As Long, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long
Declare Function CreateDesktop Lib "user32" Alias "CreateDesktopA" (ByVal lpszDesktop As String, ByVal lpszDevice As String, pDevmode As DEVMODE, ByVal dwFlags As Long, ByVal dwDesiredAccess As Long, lpsa As SECURITY_ATTRIBUTES) As Long
Declare Function CreateDialogIndirectParam Lib "user32" Alias "CreateDialogIndirectParamA" (ByVal hInstance As Long, lpTemplate As DLGTEMPLATE, ByVal hWndParent As Long, ByVal lpDialogFunc As Long, ByVal dwInitParam As Long) As Long
Declare Function CreateDialogParam Lib "user32" Alias "CreateDialogParamA" (ByVal hInstance As Long, ByVal lpName As String, ByVal hWndParent As Long, ByVal lpDialogFunc As Long, ByVal lParamInit As Long) As Long
Declare Function CreateIconFromResource Lib "user32" Alias "CreateIconFromResource" (presbits As Byte, ByVal dwResSize As Long, ByVal fIcon As Boolean, ByVal dwVer As Long) As Long
Declare Function DialogBoxIndirectParam Lib "user32" Alias "DialogBoxIndirectParamA" (ByVal hInstance As Long, hDialogTemplate As DLGTEMPLATE, ByVal hWndParent As Long, ByVal lpDialogFunc As Long, ByVal dwInitParam As Long) As Long

Declare Function DragDetect Lib "user32" Alias "DragDetect" (ByVal hWnd As Long, ByVal pt As POINTAPI) As Long
Declare Function DragObject Lib "user32" Alias "DragObject" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal un As Long, ByVal dw As Long, ByVal hCursor As Long) As Long
Declare Function DrawAnimatedRects Lib "user32" Alias "DrawAnimatedRects" (ByVal hwnd As Long, ByVal idAni As Long, lprcFrom As Rect, lprcTo As Rect) As Long
Declare Function DrawCaption Lib "user32" Alias "DrawCaption" (ByVal hWnd As Long, ByVal hDC As Long, pcRect As Rect, ByVal un As Long) As Long
Declare Function DrawEdge Lib "user32" Alias "DrawEdge" (ByVal hdc As Long, qrc As RECT, ByVal edge As Long, ByVal grfFlags As Long) As Long
Declare Function DrawFrameControl Lib "user32" Alias "DrawFrameControl" (ByVal hDC As Long, lpRect As RECT, ByVal un1 As Long, ByVal un2 As Long) As Long
Declare Function DrawIconEx Lib "user32" Alias "DrawIconEx" (ByVal hdc As Long, ByVal xLeft As Long, ByVal yTop As Long, ByVal hIcon As Long, ByVal cxWidth As Long, ByVal cyWidth As Long, ByVal istepIfAniCur As Long, ByVal hbrFlickerFreeDraw As Long, ByVal diFlags As Long) As Long
Declare Function DrawState Lib "user32" Alias "DrawStateA" (ByVal hDC As Long, ByVal hBrush As Long, ByVal lpDrawStateProc As Long, ByVal lParam As Long, ByVal wParam As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal n3 As Long, ByVal n4 As Long, ByVal un As Long) As Long

Type DRAWTEXTPARAMS
   cbSize As Long
   iTabLength As Long
   iLeftMargin As Long
   iRightMargin As Long
   uiLengthDrawn As Long
End Type

Declare Function DrawTextEx Lib "user32" Alias "DrawTextExA" (ByVal hDC As Long, ByVal lpsz As String, ByVal n As Long, lpRect As RECT, ByVal un As Long, lpDrawTextParams As DRAWTEXTPARAMS) As Long
Declare Function EnumChildWindows Lib "user32" Alias "EnumChildWindows" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function EnumDesktops Lib "user32" Alias "EnumDesktopsA" (ByVal hwinsta As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function EnumDesktopWindows Lib "user32" Alias "EnumDesktopWindows" (ByVal hDesktop As Long, ByVal lpfn As Long, ByVal lParam As Long) As Long
Declare Function EnumPropsEx Lib "user32" Alias "EnumPropsExA" (ByVal hWnd As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function EnumProps Lib "user32" Alias "EnumPropsA" (ByVal hWnd As Long, ByVal lpEnumFunc As Long) As Long
Declare Function EnumThreadWindows Lib "user32" Alias "EnumThreadWindows" (ByVal dwThreadId As Long, ByVal lpfn As Long, ByVal lParam As Long) As Long
Declare Function EnumWindowStations Lib "user32" Alias "EnumWindowStationsA" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Declare Function GetKeyboardLayoutList Lib "user32" Alias "GetKeyboardLayoutList" (ByVal nBuff As Long, lpList As Long) As Long
Declare Function GetKeyboardLayout Lib "user32" Alias "GetKeyboardLayout" (ByVal dwLayout As Long) As Long
Declare Function GetMenuContextHelpId Lib "user32" Alias "GetMenuContextHelpId" (ByVal hMenu As Long) As Long
Declare Function GetMenuDefaultItem Lib "user32" Alias "GetMenuDefaultItem" (ByVal hMenu As Long, ByVal fByPos As Long, ByVal gmdiFlags As Long) As Long

Type MENUITEMINFO
    cbSize As Long
    fMask As Long
    fType As Long
    fState As Long
    wID As Long
    hSubMenu As Long
    hbmpChecked As Long
    hbmpUnchecked As Long
    dwItemData As Long
    dwTypeData As String
    cch As Long
End Type

Declare Function GetMenuItemInfo Lib "user32" Alias "GetMenuItemInfoA" (ByVal hMenu As Long, ByVal un As Long, ByVal b As Boolean, lpMenuItemInfo As MENUITEMINFO) As Long
Declare Function GetMenuItemRect Lib "user32" Alias "GetMenuItemRect" (ByVal hWnd As Long, ByVal hMenu As Long, ByVal uItem As Long, lprcItem As RECT) As Long

Type SCROLLINFO
   cbSize As Long
   fMask As Long
   nMin As Long
   nMax As Long
   nPage As Long
   nPos As Long
   nTrackPos As Long
End Type

Declare Function GetScrollInfo Lib "user32" Alias "GetScrollInfo" (ByVal hWnd As Long, ByVal n As Long, lpScrollInfo As SCROLLINFO) As Long
Declare Function GetSysColorBrush Lib "user32" Alias "GetSysColorBrush" (ByVal nIndex As Long) As Long
Declare Function GetUserObjectInformation Lib "user32" Alias "GetUserObjectInformationA" (ByVal hObj As Long, ByVal nIndex As Long, pvInfo As Any, ByVal nLength As Long, lpnLengthNeeded As Long) As Long
Declare Function GetWindowContextHelpId Lib "user32" Alias "GetWindowContextHelpId" (ByVal hWnd As Long) As Long
Declare Function GetWindowRgn Lib "user32" Alias "GetWindowRgn" (ByVal hWnd As Long, ByVal hRgn As Long) As Long
Declare Function GrayString Lib "user32" Alias "GrayStringA" (ByVal hDC As Long, ByVal hBrush As Long, ByVal lpOutputFunc As Long, ByVal lpData As Long, ByVal nCount As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Declare Function InsertMenuItem Lib "user32" Alias "InsertMenuItemA" (ByVal hMenu As Long, ByVal un As Long, ByVal bool As Boolean, ByVal lpcMenuItemInfo As MENUITEMINFO) As Long
Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long
Declare Function LookupIconIdFromDirectoryEx Lib "user32" Alias "LookupIconIdFromDirectoryEx" (presbits As Byte, ByVal fIcon As Boolean, ByVal cxDesired As Long, ByVal cyDesired As Long, ByVal Flags As Long) As Long
Declare Function MapVirtualKeyEx Lib "user32" Alias "MapVirtualKeyExA" (ByVal uCode As Long, ByVal uMapType As Long, ByVal dwhkl As Long) As Long
Declare Function MenuItemFromPoint Lib "user32" Alias "MenuItemFromPoint" (ByVal hWnd As Long, ByVal hMenu As Long, ByVal ptScreen As POINTAPI) As Long

Type MSGBOXPARAMS
   cbSize As Long
   hwndOwner As Long
   hInstance As Long
   lpszText As String
   lpszCaption As String
   dwStyle As Long
   lpszIcon As String
   dwContextHelpId As Long
   lpfnMsgBoxCallback As Long
   dwLanguageId As Long
End Type

Declare Function MessageBoxIndirect Lib "user32" Alias "MessageBoxIndirectA" (lpMsgBoxParams As MSGBOXPARAMS) As Long
Declare Function OpenDesktop Lib "user32" Alias "OpenDesktopA" (ByVal lpszDesktop As String, ByVal dwFlags As Long, ByVal fInherit As Boolean, ByVal dwDesiredAccess As Long) As Long
Declare Function OpenInputDesktop Lib "user32" Alias "OpenInputDesktop" (ByVal dwFlags As Long, ByVal fInherit As Boolean, ByVal dwDesiredAccess As Long) As Long
Declare Function OpenWindowStation Lib "user32" Alias "OpenWindowStationA" (ByVal lpszWinSta As String, ByVal fInherit As Boolean, ByVal dwDesiredAccess As Long) As Long
Declare Function PaintDesktop Lib "user32" Alias "PaintDesktop" (ByVal hdc As Long) As Long

Type WNDCLASSEX
    cbSize As Long
    style As Long
    lpfnWndProc As Long
    cbClsExtra As Long
    cbWndExtra As Long
    hInstance As Long
    hIcon As Long
    hCursor As Long
    hbrBackground As Long
    lpszMenuName As String
    lpszClassName As String
    hIconSm As Long
End Type

Declare Function RegisterClassEx Lib "user32" Alias "RegisterClassExA" (pcWndClassEx As WNDCLASSEX) As Integer
Declare Function SetMenuContextHelpId Lib "user32" Alias "SetMenuContextHelpId" (ByVal hMenu As Long, ByVal dw As Long) As Long
Declare Function SetMenuDefaultItem Lib "user32" Alias "SetMenuDefaultItem" (ByVal hMenu As Long, ByVal uItem As Long, ByVal fByPos As Long) As Long
Declare Function SetMenuItemInfo Lib "user32" Alias "SetMenuItemInfoA" (ByVal hMenu As Long, ByVal un As Long, ByVal bool As Boolean, lpcMenuItemInfo As MENUITEMINFO) As Long
Declare Function SetMessageExtraInfo Lib "user32" Alias "SetMessageExtraInfo" (ByVal lParam As Long) As Long
Declare Function SetMessageQueue Lib "user32" Alias "SetMessageQueue" (ByVal cMessagesMax As Long) As Long
Declare Function SetProcessWindowStation Lib "user32" Alias "SetProcessWindowStation" (ByVal hWinSta As Long) As Long
Declare Function SetScrollInfo Lib "user32" Alias "SetScrollInfo" (ByVal hWnd As Long, ByVal n As Long, lpcScrollInfo As SCROLLINFO, ByVal bool As Boolean) As Long
Declare Function SetSystemCursor Lib "user32" Alias "SetSystemCursor" (ByVal hcur As Long, ByVal id As Long) As Long
Declare Function SetThreadDesktop Lib "user32" Alias "SetThreadDesktop" (ByVal hDesktop As Long) As Long
Declare Function SetTimer Lib "user32" Alias "SetTimer" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function SetUserObjectInformation Lib "user32" Alias "SetUserObjectInformationA" (ByVal hObj As Long, ByVal nIndex As Long, pvInfo As Any, ByVal nLength As Long) As Long
Declare Function SetWindowContextHelpId Lib "user32" Alias "SetWindowContextHelpId" (ByVal hWnd As Long, ByVal dw As Long) As Long
Declare Function SetWindowRgn Lib "user32" Alias "SetWindowRgn" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Declare Function SetWindowsHook Lib "user32" Alias "SetWindowsHookA" (ByVal nFilterType As Long, ByVal pfnFilterProc As Long) As Long
Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Declare Function ShowWindowAsync Lib "user32" Alias "ShowWindowAsync" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Declare Function SwitchDesktop Lib "user32" Alias "SwitchDesktop" (ByVal hDesktop As Long) As Long
Declare Function TileWindows Lib "user32" Alias "TileWindows" (ByVal hwndParent As Long, ByVal wHow As Long, lpRect As Rect, ByVal cKids As Long, lpKids As Long) As Integer
Declare Function ToAsciiEx Lib "user32" Alias "ToAsciiEx" (ByVal uVirtKey As Long, ByVal uScanCode As Long, lpKeyState As Byte, lpChar As Integer, ByVal uFlags As Long, ByVal dwhkl As Long) As Long

Type TPMPARAMS
    cbSize As Long
    rcExclude As Rect
End Type

Declare Function TrackPopupMenuEx Lib "user32" Alias "TrackPopupMenuEx" (ByVal hMenu As Long, ByVal un As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal hWnd As Long, lpTPMParams As TPMPARAMS) As Long
Declare Function UnhookWindowsHook Lib "user32" Alias "UnhookWindowsHook" (ByVal nCode As Long, ByVal pfnFilterProc As Long) As Long
Declare Function VkKeyScanEx Lib "user32" Alias "VkKeyScanExA" (ByVal ch As Byte, ByVal dwhkl As Long) As Integer
Declare Function WNetGetUniversalName Lib "mpr" Alias "WNetGetUniversalNameA" (ByVal lpLocalPath As String, ByVal dwInfoLevel As Long, lpBuffer As Any, lpBufferSize As Long) As Long
Declare Function WNetGetUser Lib "mpr" Alias "WNetGetUserA" (ByVal lpName As String, ByVal lpUserName As String, lpnLength As Long) As Long
Declare Function WNetOpenEnum Lib "mpr" Alias "WNetOpenEnumA" (ByVal dwScope As Long, ByVal dwType As Long, ByVal dwUsage As Long, lpNetResource As NETRESOURCE, lphEnum As Long) As Long

Public Const INVALID_HANDLE_VALUE = -1

'DrawEdge Constants
Public Const BDR_RAISEDOUTER = &H1
Public Const BDR_SUNKENOUTER = &H2
Public Const BDR_RAISEDINNER = &H4
Public Const BDR_SUNKENINNER = &H8

Public Const BDR_OUTER = &H3
Public Const BDR_INNER = &HC
Public Const BDR_RAISED = &H5
Public Const BDR_SUNKEN = &HA

Public Const EDGE_RAISED = (BDR_RAISEDOUTER Or BDR_RAISEDINNER)
Public Const EDGE_SUNKEN = (BDR_SUNKENOUTER Or BDR_SUNKENINNER)
Public Const EDGE_ETCHED = (BDR_SUNKENOUTER Or BDR_RAISEDINNER)
Public Const EDGE_BUMP = (BDR_RAISEDOUTER Or BDR_SUNKENINNER)

Public Const BF_LEFT = &H1
Public Const BF_TOP = &H2
Public Const BF_RIGHT = &H4
Public Const BF_BOTTOM = &H8

Public Const BF_TOPLEFT = (BF_TOP Or BF_LEFT)
Public Const BF_TOPRIGHT = (BF_TOP Or BF_RIGHT)
Public Const BF_BOTTOMLEFT = (BF_BOTTOM Or BF_LEFT)
Public Const BF_BOTTOMRIGHT = (BF_BOTTOM Or BF_RIGHT)
Public Const BF_RECT = (BF_LEFT Or BF_TOP Or BF_RIGHT Or BF_BOTTOM)

Public Const BF_DIAGONAL = &H10

' For diagonal lines, the BF_RECT flags specify the end point of
' the vector bounded by the rectangle parameter.
Public Const BF_DIAGONAL_ENDTOPRIGHT = (BF_DIAGONAL Or BF_TOP Or BF_RIGHT)
Public Const BF_DIAGONAL_ENDTOPLEFT = (BF_DIAGONAL Or BF_TOP Or BF_LEFT)
Public Const BF_DIAGONAL_ENDBOTTOMLEFT = (BF_DIAGONAL Or BF_BOTTOM Or BF_LEFT)
Public Const BF_DIAGONAL_ENDBOTTOMRIGHT = (BF_DIAGONAL Or BF_BOTTOM Or BF_RIGHT)

Public Const BF_MIDDLE = &H800    ' Fill in the middle.
Public Const BF_SOFT = &H1000     ' Use for softer buttons.
Public Const BF_ADJUST = &H2000   ' Calculate the space left over.
Public Const BF_FLAT = &H4000     ' For flat rather than 3-D borders.
Public Const BF_MONO = &H8000     ' For monochrome borders.

programatrix

Cierro el tema, si el moderador quierea aportar mas el sabe como abrirlo sin problemas.
Saludos  ;)

Slasher-K

La verdad que es más sencillo usar el visor de APIs, pero en fin no está demás, gracias por el aporte.

Por cierto, en mi FireFox no se ven la mitad de los post.

Saludos.



A la reina de las profundidades que cuida los pasos de una sombra en la noche :*