' OleAuto.ab

#ifndef _INC_OLEAUTO_AB
#define _INC_OLEAUTO_AB

' EXTERN_C const IID IID_StdOle;

Const STDOLE_MAJORVERNUM = &h1
Const STDOLE_MINORVERNUM = &h0
Const STDOLE_LCID = &h0000

' Version # of stdole2.tlb
Const STDOLE2_MAJORVERNUM = &h2
Const STDOLE2_MINORVERNUM = &h0
Const STDOLE2_LCID = &h0000

/*
#ifndef _LCID_DEFINED
TypeDef LCID = DWord
#define _LCID_DEFINED
#endif
*/

#require <oaidl.ab>
'Dummy

' BSTR API
Declare Function SysAllocString Lib "oleaut32" (sz As /*Const*/ *OLECHAR) As BSTR
Declare Function SysReAllocString Lib "oleaut32" (ByRef bstr As BSTR, psz As /*Const*/ *OLECHAR) As Long
Declare Function SysAllocStringLen Lib "oleaut32" (pch As /*Const*/ *OLECHAR, cch As DWord) As BSTR
Declare Function SysReAllocStringLen Lib "oleaut32" (ByRef bstr As BSTR, pch As /*Const*/ *OLECHAR, cch As DWord) As Long
Declare Sub SysFreeString Lib "oleaut32" (bstr As BSTR)
Declare Function SysStringLen Lib "oleaut32" (bstr As BSTR) As DWord

'#if (defined (_WIN32) Or defined (_WIN64))
Declare Function SysStringByteLen Lib "oleaut32" (bstr As BSTR) As DWord
Declare Function SysAllocStringByteLen Lib "oleaut32" (pch As PCSTR, len As DWord) As BSTR
'#endif

' Time API
Declare Function DosDateTimeToVariantTime Lib "oleaut32" (wDosDate As Word, wDosTime As Word, ByRef vtime As Double) As Long
Declare Function VariantTimeToDosDateTime Lib "oleaut32" (vtime As Double, ByRef wDosDate As Word, ByRef wDosTime As Word) As Long

'#if (defined (_WIN32) Or defined (_WIN64))
Declare Function SystemTimeToVariantTime Lib "oleaut32" (ByRef SystemTime As SYSTEMTIME, ByRef vtime As Double) As Long
Declare Function VariantTimeToSystemTime Lib "oleaut32" (vtime As Double, ByRef SystemTime As SYSTEMTIME) As Long
'#endif

' SafeArray API
Declare Function SafeArrayAllocDescriptor Lib "oleaut32" (cDims As DWord, ByRef psaOut As *SAFEARRAY) As HRESULT
Declare Function SafeArrayAllocDescriptorEx Lib "oleaut32" (vt As VARTYPE, cDims As DWord, ByRef psaOut As *SAFEARRAY) As HRESULT
Declare Function SafeArrayAllocData Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
Declare Function SafeArrayCreate Lib "oleaut32" (vt As VARTYPE, cDims As DWord, ByRef rgsabound As SAFEARRAYBOUND) As *SAFEARRAY
Declare Function SafeArrayCreateEx Lib "oleaut32" (vt As VARTYPE, cDims As DWord, ByRef rgsabound As SAFEARRAYBOUND, pvExtra As VoidPtr) As *SAFEARRAY
Declare Function SafeArrayCopyData Lib "oleaut32" (psaSource As *SAFEARRAY, psaTarget As *SAFEARRAY) As HRESULT
Declare Function SafeArrayDestroyDescriptor Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
Declare Function SafeArrayDestroyData Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
Declare Function SafeArrayDestroy Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
Declare Function SafeArrayRedim Lib "oleaut32" (psa As *SAFEARRAY, ByRef psaboundNew As SAFEARRAYBOUND) As HRESULT
Declare Function SafeArrayGetDim Lib "oleaut32" (psa As *SAFEARRAY) As DWord
Declare Function SafeArrayGetElemsize Lib "oleaut32" (psa As *SAFEARRAY) As DWord
Declare Function SafeArrayGetUBound Lib "oleaut32" (psa As *SAFEARRAY, ByRef lUbound As Long) As HRESULT
Declare Function SafeArrayGetLBound Lib "oleaut32" (psa As *SAFEARRAY, ByRef lLbound As Long) As HRESULT
Declare Function SafeArrayLock Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
Declare Function SafeArrayUnlock Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
Declare Function SafeArrayAccessData Lib "oleaut32" (psa As *SAFEARRAY, ByRef pvData As VoidPtr) As HRESULT
Declare Function SafeArrayUnaccessData Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
Declare Function SafeArrayGetElement Lib "oleaut32" (psa As *SAFEARRAY, rgIndices As *Long, ByRef v As Any) As HRESULT
Declare Function SafeArrayPutElement Lib "oleaut32" (psa As *SAFEARRAY, rgIndices As *Long, ByRef v As Any) As HRESULT
Declare Function SafeArrayCopy Lib "oleaut32" (psa As *SAFEARRAY, ByRef ppsaOut As *SAFEARRAY) As HRESULT
Declare Function SafeArrayPtrOfIndex Lib "oleaut32" (psa As *SAFEARRAY, rgIndices As *Long, ByRef pvData As VoidPtr) As HRESULT
Declare Function SafeArraySetRecordInfo Lib "oleaut32" (psa As *SAFEARRAY, prinfo As *IRecordInfo) As HRESULT
Declare Function SafeArrayGetRecordInfo Lib "oleaut32" (psa As *SAFEARRAY, ByRef prinfo As *IRecordInfo) As HRESULT
Declare Function SafeArraySetIID Lib "oleaut32" (psa As *SAFEARRAY, ByRef guid As IID) As HRESULT
Declare Function SafeArrayGetIID Lib "oleaut32" (psa As *SAFEARRAY, ByRef guid As IID) As HRESULT
Declare Function SafeArrayGetVartype Lib "oleaut32" (psa As *SAFEARRAY, ByRef vt As VARTYPE) As HRESULT
Declare Function SafeArrayCreateVector Lib "oleaut32" (psa As *SAFEARRAY, ByRef cElements As DWord) As *SAFEARRAY
Declare Function SafeArrayCreateVectorEx Lib "oleaut32" (psa As *SAFEARRAY, ByRef cElements As DWord, pvExtra As VoidPtr) As *SAFEARRAY

' VARIANT API
Declare Sub VariantInit Lib "oleaut32" (ByRef varg As VARIANTARG)
Declare Function VariantClear Lib "oleaut32" (ByRef varg As VARIANTARG) As HRESULT
Declare Function VariantCopy Lib "oleaut32" (ByRef vargDest As VARIANTARG, ByRef vargSrc As VARIANTARG) As HRESULT
Declare Function VariantCopyInd Lib "oleaut32" (ByRef varDest As VARIANT, ByRef vargSrc As VARIANTARG) As HRESULT
Declare Function VariantChangeType Lib "oleaut32" (ByRef vargDest As VARIANT, ByRef varSrc As VARIANTARG, wFlags As Word, vt As VARTYPE) As HRESULT
Declare Function VariantChangeTypeEx Lib "oleaut32" (ByRef vargDest As VARIANT, ByRef varSrc As VARIANTARG, lcid As LCID, wFlags As Word, vt As VARTYPE) As HRESULT

' Flags for VariantChangeType/VariantChangeTypeEx
Const VARIANT_NOVALUEPROP = &h01
Const VARIANT_ALPHABOOL = &h02
Const VARIANT_NOUSEROVERRIDE = &h04
Const VARIANT_CALENDAR_HIJRI = &h08
Const VARIANT_LOCALBOOL = &h10
Const VARIANT_CALENDAR_THAI = &h20
Const VARIANT_CALENDAR_GREGORIAN = &h40
Const VARIANT_USE_NLS = &h80

' Vector <-> Bstr conversion APIs
Declare Function VectorFromBstr Lib "oleaut32" (bstr As BSTR, ByRef psa As *SAFEARRAY) As HRESULT
Declare Function BstrFromVector Lib "oleaut32" (psa As *SAFEARRAY, ByRef bstr As BSTR) As HRESULT

' Variant API Flags
Const VAR_TIMEVALUEONLY = &h00000001 As DWord
Const VAR_DATEVALUEONLY = &h00000002 As DWord
Const VAR_VALIDDATE = &h00000004 As DWord
Const VAR_CALENDAR_HIJRI = &h00000008 As DWord
Const VAR_LOCALBOOL = &h00000010 As DWord
Const VAR_FORMAT_NOSUBSTITUTE = &h00000020 As DWord
Const VAR_FOURDIGITYEARS = &h00000040 As DWord
Const LOCALE_USE_NLS = &h10000000 As DWord
Const VAR_CALENDAR_THAI = &h00000080 As DWord
Const VAR_CALENDAR_GREGORIAN = &h00000100 As DWord

Const VTDATEGRE_MAX = 2958465
Const VTDATEGRE_MIN = -657434

' VARTYPE Coercion API
Declare Function VarUI1FromI2 Lib "oleaut32" (sIn As Integer, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromI4 Lib "oleaut32" (lIn As Long, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromI8 Lib "oleaut32" (i64In As Int64, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromR4 Lib "oleaut32" (fltIn As Single, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromR8 Lib "oleaut32" (dblIn As Double, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromCy Lib "oleaut32" (cyIn As CY, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromDate Lib "oleaut32" (dateIn As DATE, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromI1 Lib "oleaut32" (cIn As SByte, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromUI2 Lib "oleaut32" (uiIn As Word, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef bOut As Byte) As HRESULT

Declare Function VarI2FromUI1 Lib "oleaut32" (bIn As Byte, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromI4 Lib "oleaut32" (lIn As Long, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromI8 Lib "oleaut32" (i64In As Int64, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromR4 Lib "oleaut32" (fltIn As Single, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromR8 Lib "oleaut32" (dblIn As Double, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromCy Lib "oleaut32" (cyIn As CY, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromDate Lib "oleaut32" (dateIn As DATE, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromI1 Lib "oleaut32" (cIn As SByte, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromUI2 Lib "oleaut32" (uiIn As Word, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef sOut As Integer) As HRESULT

Declare Function VarI4FromUI1 Lib "oleaut32" (bIn As Byte, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromI2 Lib "oleaut32" (sIn As Integer, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromI8 Lib "oleaut32" (i64In As Int64, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromR4 Lib "oleaut32" (fltIn As Single, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromR8 Lib "oleaut32" (dblIn As Double, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromCy Lib "oleaut32" (cyIn As CY, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromDate Lib "oleaut32" (dateIn As DATE, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromI1 Lib "oleaut32" (cIn As SByte, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromUI2 Lib "oleaut32" (uiIn As Word, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef lOut As Long) As HRESULT
Declare Function VarI4FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef lOut As Long) As HRESULT

Declare Function VarI8FromUI1 Lib "oleaut32" (bIn As Byte, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromI2 Lib "oleaut32" (sIn As Integer, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromI4 Lib "oleaut32" (lIn As Long, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromR4 Lib "oleaut32" (fltIn As Single, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromR8 Lib "oleaut32" (dblIn As Double, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromCy Lib "oleaut32" (cyIn As CY, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromDate Lib "oleaut32" (dateIn As DATE, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromI1 Lib "oleaut32" (cIn As SByte, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromUI2 Lib "oleaut32" (uiIn As Word, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef i64Out As Int64) As HRESULT

Declare Function VarR4FromUI1 Lib "oleaut32" (bIn As Byte, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromI2 Lib "oleaut32" (sIn As Integer, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromI4 Lib "oleaut32" (lIn As Long, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromI8 Lib "oleaut32" (i64In As Int64, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromR8 Lib "oleaut32" (dblIn As Double, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromCy Lib "oleaut32" (cyIn As CY, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromDate Lib "oleaut32" (dateIn As DATE, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromI1 Lib "oleaut32" (cIn As SByte, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromUI2 Lib "oleaut32" (uiIn As Word, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef fltOut As Single) As HRESULT

Declare Function VarR8FromUI1 Lib "oleaut32" (bIn As Byte, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromI2 Lib "oleaut32" (sIn As Integer, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromI4 Lib "oleaut32" (lIn As Long, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromI8 Lib "oleaut32" (i64In As Int64, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromR4 Lib "oleaut32" (fltIn As Single, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromCy Lib "oleaut32" (cyIn As CY, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromDate Lib "oleaut32" (dateIn As DATE, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromI1 Lib "oleaut32" (cIn As SByte, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromUI2 Lib "oleaut32" (uiIn As Word, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef dblOut As Double) As HRESULT

Declare Function VarDateFromUI1 Lib "oleaut32" (bIn As Byte, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromI2 Lib "oleaut32" (sIn As Integer, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromI4 Lib "oleaut32" (lIn As Long, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromI8 Lib "oleaut32" (i64In As Int64, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromR4 Lib "oleaut32" (fltIn As Single, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromR8 Lib "oleaut32" (dblIn As Double, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromCy Lib "oleaut32" (cyIn As CY, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromI1 Lib "oleaut32" (cIn As SByte, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromUI2 Lib "oleaut32" (uiIn As Word, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromUI4 Lib "oleaut32" (ulIn As DWord, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromUI8 Lib "oleaut32" (ui64In As QWord, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef dateOut As DATE) As HRESULT

Declare Function VarCyFromUI1 Lib "oleaut32" (bIn As Byte, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromI2 Lib "oleaut32" (sIn As Integer, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromI4 Lib "oleaut32" (lIn As Long, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromI8 Lib "oleaut32" (i64In As Int64, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromR4 Lib "oleaut32" (fltIn As Single, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromR8 Lib "oleaut32" (dblIn As Double, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromDate Lib "oleaut32" (dateIn As DATE, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromI1 Lib "oleaut32" (cIn As SByte, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromUI2 Lib "oleaut32" (uiIn As Word, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromUI4 Lib "oleaut32" (ulIn As DWord, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromUI8 Lib "oleaut32" (ui64In As QWord, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef cyOut As CY) As HRESULT

Declare Function VarBstrFromUI1 Lib "oleaut32" (bIn As Byte, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromI2 Lib "oleaut32" (sIn As Integer, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromI4 Lib "oleaut32" (lIn As Long, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromI8 Lib "oleaut32" (i64In As Int64, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromR4 Lib "oleaut32" (fltIn As Single, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromR8 Lib "oleaut32" (dblIn As Double, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromCy Lib "oleaut32" (cyIn As CY, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromDate Lib "oleaut32" (dateIn As DATE, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromI1 Lib "oleaut32" (cIn As SByte, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromUI2 Lib "oleaut32" (uiIn As Word, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromUI4 Lib "oleaut32" (ulIn As DWord, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromUI8 Lib "oleaut32" (i64In As QWord, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromDec Lib "oleaut32" (ByRef decIn As DECIMAL, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT

Declare Function VarBoolFromUI1 Lib "oleaut32" (bIn As Byte, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromI2 Lib "oleaut32" (sIn As Integer, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromI4 Lib "oleaut32" (lIn As Long, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromI8 Lib "oleaut32" (i64In As Int64, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromR4 Lib "oleaut32" (fltIn As Single, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromR8 Lib "oleaut32" (dblIn As Double, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromDate Lib "oleaut32" (dateIn As DATE, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromCy Lib "oleaut32" (cyIn As CY, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromI1 Lib "oleaut32" (cIn As SByte, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromUI2 Lib "oleaut32" (uiIn As Word, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromUI4 Lib "oleaut32" (ulIn As DWord, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromUI8 Lib "oleaut32" (i64In As QWord, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef boolOut As VARIANT_BOOL) As HRESULT

Declare Function VarI1FromI2 Lib "oleaut32" (sIn As Integer, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromI4 Lib "oleaut32" (lIn As Long, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromI8 Lib "oleaut32" (i64In As Int64, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromR4 Lib "oleaut32" (fltIn As Single, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromR8 Lib "oleaut32" (dblIn As Double, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromCy Lib "oleaut32" (cyIn As CY, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromDate Lib "oleaut32" (dateIn As DATE, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromI1 Lib "oleaut32" (cIn As SByte, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromUI2 Lib "oleaut32" (uiIn As Word, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef cOut As Char) As HRESULT

Declare Function VarUI2FromUI1 Lib "oleaut32" (bIn As Byte, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromI2 Lib "oleaut32" (uiIn As Integer, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromI4 Lib "oleaut32" (lIn As Long, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromI8 Lib "oleaut32" (i64In As Int64, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromR4 Lib "oleaut32" (fltIn As Single, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromR8 Lib "oleaut32" (dblIn As Double, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromDate Lib "oleaut32" (dateIn As DATE, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromCy Lib "oleaut32" (cyIn As CY, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromI1 Lib "oleaut32" (cIn As SByte, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromUI8 Lib "oleaut32" (i64In As QWord, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef uiOut As Word) As HRESULT

Declare Function VarUI4FromUI1 Lib "oleaut32" (bIn As Byte, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromI2 Lib "oleaut32" (uiIn As Integer, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromI4 Lib "oleaut32" (lIn As Long, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromI8 Lib "oleaut32" (i64In As Int64, ByRef lOut As DWord) As HRESULT
Declare Function VarUI4FromR4 Lib "oleaut32" (fltIn As Single, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromR8 Lib "oleaut32" (dblIn As Double, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromDate Lib "oleaut32" (dateIn As DATE, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromCy Lib "oleaut32" (cyIn As CY, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromI1 Lib "oleaut32" (cIn As SByte, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromUI2 Lib "oleaut32" (uiIn As Word, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI4FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef lOut As DWord) As HRESULT
Declare Function VarUI4FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef ulOut As DWord) As HRESULT

Declare Function VarUI8FromUI1 Lib "oleaut32" (bIn As Byte, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromI2 Lib "oleaut32" (sIn As Integer, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromI4 Lib "oleaut32" (lIn As Long, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromI8 Lib "oleaut32" (ui64In As Int64, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromR4 Lib "oleaut32" (fltIn As Single, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromR8 Lib "oleaut32" (dblIn As Double, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromCy Lib "oleaut32" (cyIn As CY, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromDate Lib "oleaut32" (dateIn As DATE, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromI1 Lib "oleaut32" (cIn As SByte, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromUI2 Lib "oleaut32" (uiIn As Word, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef i64Out As QWord) As HRESULT

Declare Function VarDecFromUI1 Lib "oleaut32" (bIn As Byte, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromI2 Lib "oleaut32" (uiIn As Integer, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromI4 Lib "oleaut32" (lIn As Long, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromI8 Lib "oleaut32" (i64In As Int64, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromR4 Lib "oleaut32" (fltIn As Single, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromR8 Lib "oleaut32" (dblIn As Double, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromDate Lib "oleaut32" (dateIn As DATE, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromCy Lib "oleaut32" (cyIn As CY, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromI1 Lib "oleaut32" (cIn As SByte, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromUI2 Lib "oleaut32" (uiIn As Word, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromUI4 Lib "oleaut32" (ulIn As DWord, ByRef decOut As DECIMAL) As HRESULT
Declare Function VarDecFromUI8 Lib "oleaut32" (ui64In As QWord, ByRef decOut As DECIMAL) As HRESULT

Declare Function VarUI1FromInt Lib "oleaut32" Alias "VarUI1FromI4" (lIn As Long, ByRef bOut As Byte) As HRESULT
Declare Function VarUI1FromUint Lib "oleaut32" Alias "VarUI1FromUI4" (ulIn As DWord, ByRef bOut As Byte) As HRESULT
Declare Function VarI2FromInt Lib "oleaut32" Alias "VarI2FromI4" (lIn As Long, ByRef sOut As Integer) As HRESULT
Declare Function VarI2FromUint Lib "oleaut32" Alias "VarI2FromUI4" (ulIn As DWord, ByRef sOut As Integer) As HRESULT
Declare Function VarI4FromUint Lib "oleaut32" Alias "VarI4FromUI4" (ulIn As DWord, ByRef lOut As Long) As HRESULT
Declare Function VarI8FromInt Lib "oleaut32" Alias "VarI8FromI4" (lIn As Long, ByRef i64Out As Int64) As HRESULT
Declare Function VarI8FromUint Lib "oleaut32" Alias "VarI8FromUI4" (ulIn As DWord, ByRef i64Out As Int64) As HRESULT
Declare Function VarR4FromInt Lib "oleaut32" Alias "VarR4FromI4" (lIn As Long, ByRef fltOut As Single) As HRESULT
Declare Function VarR4FromUint Lib "oleaut32" Alias "VarR4FromUI4" (ulIn As DWord, ByRef fltOut As Single) As HRESULT
Declare Function VarR8FromInt Lib "oleaut32" Alias "VarR8FromI4" (lIn As Long, ByRef dblOut As Double) As HRESULT
Declare Function VarR8FromUint Lib "oleaut32" Alias "VarR8FromUI4" (ulIn As DWord, ByRef dblOut As Double) As HRESULT
Declare Function VarDateFromInt Lib "oleaut32" Alias "VarDateFromI4" (lIn As Long, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromUint Lib "oleaut32" Alias "VarDateFromUI4" (ulIn As DWord, ByRef dateOut As DATE) As HRESULT
Declare Function VarCyFromInt Lib "oleaut32" Alias "VarCyFromI4" (lIn As Long, ByRef cyOut As CY) As HRESULT
Declare Function VarCyFromUint Lib "oleaut32" Alias "VarCyFromUI4" (ulIn As DWord, ByRef cyOut As CY) As HRESULT
Declare Function VarBstrFromInt Lib "oleaut32" Alias "VarBstrFromI4" (lIn As Long, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBstrFromUint Lib "oleaut32" Alias "VarBstrFromUI4" (ulIn As DWord, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarBoolFromInt Lib "oleaut32" Alias "VarBoolFromI4" (lIn As Long, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarBoolFromUint Lib "oleaut32" Alias "VarBoolFromUI4" (ulIn As DWord, ByRef boolOut As VARIANT_BOOL) As HRESULT
Declare Function VarI1FromInt Lib "oleaut32" Alias "VarI1FromI4" (lIn As Long, ByRef cOut As Char) As HRESULT
Declare Function VarI1FromUint Lib "oleaut32" Alias "VarI1FromUI4" (ulIn As DWord, ByRef cOut As Char) As HRESULT
Declare Function VarUI2FromInt Lib "oleaut32" Alias "VarUI2FromI4" (lIn As Long, ByRef uiOut As Word) As HRESULT
Declare Function VarUI2FromUint Lib "oleaut32" Alias "VarUI2FromUI4" (ulIn As DWord, ByRef uiOut As Word) As HRESULT
Declare Function VarUI4FromInt Lib "oleaut32" Alias "VarUI4FromI4" (lIn As Long, ByRef ulOut As DWord) As HRESULT
Declare Function VarUI8FromInt Lib "oleaut32" Alias "VarUI8FromI4" (lIn As Long, ByRef i64Out As QWord) As HRESULT
Declare Function VarUI8FromUint Lib "oleaut32" Alias "VarUI8FromUI4" (ulIn As DWord, ByRef i64Out As QWord) As HRESULT
Declare Function VarDecFromInt Lib "oleaut32" Alias "VarDecFromI4" (lIn As Long, ByRef decOut As DECIMAL) As HRESULT

Declare Function VarIntFromUI1 Lib "oleaut32" Alias "VarI4FromUI1" (bIn As Byte, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromI2 Lib "oleaut32" Alias "VarI4FromI2" (sIn As Integer, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromI8 Lib "oleaut32" Alias "VarI4FromI8" (i64In As Int64, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromR4 Lib "oleaut32" Alias "VarI4FromR4" (fltIn As Single, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromR8 Lib "oleaut32" Alias "VarI4FromR8" (dblIn As Double, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromCy Lib "oleaut32" Alias "VarI4FromCy" (cyIn As CY, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromDate Lib "oleaut32" Alias "VarI4FromDate" (dateIn As DATE, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromStr Lib "oleaut32" Alias "VarI4FromStr" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromDisp Lib "oleaut32" Alias "VarI4FromDisp" (pdispIn As *IDispatch, lcid As LCID, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromBool Lib "oleaut32" Alias "VarI4FromBool" (boolIn As VARIANT_BOOL, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromI1 Lib "oleaut32" Alias "VarI4FromI1" (cIn As SByte, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromUI2 Lib "oleaut32" Alias "VarI4FromUI2" (uiIn As Word, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromUI4 Lib "oleaut32" Alias "VarI4FromUI4" (ulIn As DWord, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromUI8 Lib "oleaut32" Alias "VarI4FromUI8" (ui64In As QWord, ByRef lOut As Long) As HRESULT
Declare Function VarIntFromDec Lib "oleaut32" Alias "VarI4FromDec" (ByRef decIn As DECIMAL, ByRef lOut As Long) As HRESULT
Declare Function VarUintFromUI1 Lib "oleaut32" Alias "VarUI4FromUI1" (bIn As Byte, ByRef ulOut As DWord) As HRESULT
Declare Function VarIntFromUint Lib "oleaut32" Alias "VarI4FromUI4" (ulIn As DWord, ByRef lOut As Long) As HRESULT
Declare Function VarUintFromI2 Lib "oleaut32" Alias "VarUI4FromI2" (uiIn As Integer, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromI4 Lib "oleaut32" Alias "VarUI4FromI4" (lIn As Long, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromI8 Lib "oleaut32" Alias "VarUI4FromI8" (i64In As Int64, ByRef lOut As DWord) As HRESULT
Declare Function VarUintFromR4 Lib "oleaut32" Alias "VarUI4FromR4" (fltIn As Single, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromR8 Lib "oleaut32" Alias "VarUI4FromR8" (dblIn As Double, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromDate Lib "oleaut32" Alias "VarUI4FromDate" (dateIn As DATE, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromCy Lib "oleaut32" Alias "VarUI4FromCy" (cyIn As CY, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromStr Lib "oleaut32" Alias "VarUI4FromStr" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromDisp Lib "oleaut32" Alias "VarUI4FromDisp" (pdispIn As *IDispatch, lcid As LCID, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromBool Lib "oleaut32" Alias "VarUI4FromBool" (boolIn As VARIANT_BOOL, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromI1 Lib "oleaut32" Alias "VarUI4FromI1" (cIn As SByte, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromUI2 Lib "oleaut32" Alias "VarUI4FromUI2" (uiIn As Word, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromUI8 Lib "oleaut32" Alias "VarUI4FromUI8" (ui64In As QWord, ByRef lOut As DWord) As HRESULT
Declare Function VarUintFromDec Lib "oleaut32" Alias "VarUI4FromDec" (ByRef decIn As DECIMAL, ByRef ulOut As DWord) As HRESULT
Declare Function VarUintFromInt Lib "oleaut32" Alias "VarUI4FromI4" (lIn As Long, ByRef ulOut As DWord) As HRESULT

Sub VarI4FromInt(iIn As Long, ByRef lOut As Long)
	lOut = iIn
End Sub

Sub VarUI4FromUint(uiIn As DWord, ByRef ulOut As DWord)
	ulOut = uiIn
End Sub

Sub VarIntFromI4(lIn As Long, ByRef iOut As Long)
	iOut = lIn
End Sub

Sub VarUintFromUI4(ulIn As DWord, ByRef uiOut As DWord)
	uiOut = ulIn
End Sub

' New VARIANT <-> string parsing functions
Type NUMPARSE
	cDig As Long
	dwInFlags As DWord
	dwOutFlags As DWord
	cchUsed As Long
	nBaseShift As Long
	nPwr10 As Long
End Type

Const NUMPRS_LEADING_WHITE  = &h0001
Const NUMPRS_TRAILING_WHITE = &h0002
Const NUMPRS_LEADING_PLUS = &h0004
Const NUMPRS_TRAILING_PLUS = &h0008
Const NUMPRS_LEADING_MINUS = &h0010
Const NUMPRS_TRAILING_MINUS = &h0020
Const NUMPRS_HEX_OCT = &h0040
Const NUMPRS_PARENS = &h0080
Const NUMPRS_DECIMAL = &h0100
Const NUMPRS_THOUSANDS = &h0200
Const NUMPRS_CURRENCY = &h0400
Const NUMPRS_EXPONENT = &h0800
Const NUMPRS_USE_ALL = &h1000
Const NUMPRS_STD = &h1FFF

Const NUMPRS_NEG = &h110000
Const NUMPRS_INEXACT = &h20000

Const VTBIT_I1 = (1 << VT_I1)
Const VTBIT_UI1 = (1 << VT_UI1)
Const VTBIT_I2 = (1 << VT_I2)
Const VTBIT_UI2 = (1 << VT_UI2)
Const VTBIT_I4 = (1 << VT_I4)
Const VTBIT_UI4 = (1 << VT_UI4)
Const VTBIT_I8 = (1 << VT_I8)
Const VTBIT_UI8 = (1 << VT_UI8)
Const VTBIT_R4 = (1 << VT_R4)
Const VTBIT_R8 = (1 << VT_R8)
Const VTBIT_CY = (1 << VT_CY)
Const VTBIT_DECIMAL = (1 << VT_DECIMAL)

Declare Function VarParseNumFromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef numprs As NUMPARSE, rgbDig As *Byte) As HRESULT
Declare Function VarNumFromParseNum Lib "oleaut32" (ByRef numprs As NUMPARSE, rgbDig As *Byte, dwVtBits As DWord, ByRef var As VARIANT) As HRESULT

' VARTYPE Math API
Declare Function VarAdd Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarAnd Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarCat Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarDiv Lib "oleaut32.dll" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarEqv Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarIdiv Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarImp Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarMod Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarMul Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarOr Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarPow Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarSub Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarXor Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT

Declare Function VarAbs Lib "oleaut32" (ByRef in As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarFix Lib "oleaut32" (ByRef in As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarInt Lib "oleaut32" (ByRef in As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarNeg Lib "oleaut32" (ByRef in As VARIANT, ByRef result As VARIANT) As HRESULT
Declare Function VarNot Lib "oleaut32" (ByRef in As VARIANT, ByRef result As VARIANT) As HRESULT

Declare Function VarRound Lib "oleaut32" (ByRef in As VARIANT, cDecimals As Long, ByRef result As VARIANT) As HRESULT

Declare Function VarCmp Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, lcid As LCID, dwFlags As DWord) As HRESULT

Declare Function VarDecAdd Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As DECIMAL, ByRef result As DECIMAL) As HRESULT
Declare Function VarDecDiv Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As DECIMAL, ByRef result As DECIMAL) As HRESULT
Declare Function VarDecMul Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As DECIMAL, ByRef result As DECIMAL) As HRESULT
Declare Function VarDecSub Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As DECIMAL, ByRef result As DECIMAL) As HRESULT

Declare Function VarDecAbs Lib "oleaut32" (ByRef in As DECIMAL, ByRef result As DECIMAL) As HRESULT
Declare Function VarDecFix Lib "oleaut32" (ByRef in As DECIMAL, ByRef result As DECIMAL) As HRESULT
Declare Function VarDecInt Lib "oleaut32" (ByRef in As DECIMAL, ByRef result As DECIMAL) As HRESULT
Declare Function VarDecNeg Lib "oleaut32" (ByRef in As DECIMAL, ByRef result As DECIMAL) As HRESULT

Declare Function VarDecRound Lib "oleaut32" (ByRef in As DECIMAL, cDecimals As Long, ByRef result As DECIMAL) As HRESULT

Declare Function VarDecCmp Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As DECIMAL) As HRESULT
Declare Function VarDecCmpR8 Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As Double) As HRESULT

Declare Function VarCyAdd Lib "oleaut32" (lhs As CY, rhs As CY, ByRef result As CY) As HRESULT
Declare Function VarCyMul Lib "oleaut32" (lhs As CY, rhs As CY, ByRef result As CY) As HRESULT
Declare Function VarCyMulI4 Lib "oleaut32" (lhs As CY, rhs As Long, ByRef result As CY) As HRESULT
Declare Function VarCyMulI8 Lib "oleaut32" (lhs As CY, rhs As Int64, ByRef result As CY) As HRESULT
Declare Function VarCySub Lib "oleaut32" (lhs As CY, rhs As CY, ByRef result As CY) As HRESULT

Declare Function VarCyAbs Lib "oleaut32" (in As CY, ByRef result As CY) As HRESULT
Declare Function VarCyFix Lib "oleaut32" (in As CY, ByRef result As CY) As HRESULT
Declare Function VarCyInt Lib "oleaut32" (in As CY, ByRef result As CY) As HRESULT
Declare Function VarCyNeg Lib "oleaut32" (in As CY, ByRef result As CY) As HRESULT

Declare Function VarCyRound Lib "oleaut32" (in As CY, cDecimals As Long, ByRef result As CY) As HRESULT

Declare Function VarCyCmp Lib "oleaut32" (ByRef lhs As CY, ByRef rhs As CY) As HRESULT
Declare Function VarCyCmpR8 Lib "oleaut32" (ByRef lhs As CY, ByRef rhs As Double) As HRESULT

Declare Function VarBstrCat Lib "oleaut32" (lhs As BSTR, rhs As BSTR, ByRef result As BSTR) As HRESULT
Declare Function VarBstrCmp Lib "oleaut32" (lhs As BSTR, rhs As BSTR, lcid As LCID, dwFlags As DWord) As HRESULT
Declare Function VarR8Pow Lib "oleaut32" (lhs As Double, rhs As Double, ByRef result As Double) As HRESULT
Declare Function VarR4CmpR8 Lib "oleaut32" (lhs As Single, rhs As Double) As HRESULT
Declare Function VarR8Round Lib "oleaut32" (in As Double, cDecimals As Long, ByRef result As Double) As HRESULT

Const VARCMP_LT = 0
Const VARCMP_EQ = 1
Const VARCMP_GT = 2
Const VARCMP_NULL = 3

Const VT_HARDTYPE = VT_RESERVED

' New date functions
Type UDATE
	st As SYSTEMTIME
	wDayOfYear As Word
End Type

Declare Function VarDateFromUdate Lib "oleaut32" (ByRef udateIn As UDATE, dwFlags As DWord, ByRef dateOut As DATE) As HRESULT
Declare Function VarDateFromUdateEx Lib "oleaut32" (ByRef udateIn As UDATE, lcid As LCID, dwFlags As DWord, ByRef dateOut As DATE) As HRESULT
Declare Function VarUdateFromDate Lib "oleaut32" (dateIn As DATE, dwFlags As DWord, ByRef udateOut As UDATE) As HRESULT

Declare Function GetAltMonthNames Lib "oleaut32" (lcid As LCID, ByRef rgp As LPOLESTR) As HRESULT

' Format
Declare Function VarFormat Lib "oleaut32" (ByRef in As VARIANT, pstrFormat As LPOLESTR, iFirstDay As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarFormatDateTime Lib "oleaut32" (ByRef in As VARIANT, iNamedFormat As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarFormatNumber Lib "oleaut32" (ByRef in As VARIANT, iNumDig As Long, iIncLead As Long, iUseParens As Long, iGroup As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarFormatPercent Lib "oleaut32" (ByRef in As VARIANT, iNumDig As Long, iIncLead As Long, iUseParens As Long, iGroup As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarFormatCurrency Lib "oleaut32" (ByRef in As VARIANT, iNumDig As Long, iIncLead As Long, iUseParens As Long, iGroup As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT

Declare Function VarWeekdayName Lib "oleaut32" (iWeekday As Long, fAbbrev As Long, iFirstDay As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
Declare Function VarMonthName Lib "oleaut32" (iMonth As Long, fAbbrev As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT

Declare Function VarFormatFromTokens Lib "oleaut32" (ByRef in As VARIANT, pstrFormat As LPOLESTR, pbTokCur As *Byte, dwFlags As DWord, ByRef bstrOut As BSTR, lcid As LCID) As HRESULT
Declare Function VarTokenizeFormatString Lib "oleaut32" (pstrFormat As LPOLESTR, rgbTok As *Byte, cbTok As Long, iFirstDay As Long, iFirstWeek As Long, lcid As LCID, ByRef cbActual As Long) As HRESULT

' ITypeLib
TypeDef PTYPELIB = *ITypeLib

' ITypeInfo
TypeDef DISPID = Long
typedef MEMBERID = DISPID

'Const MEMBERID_NIL = DISPID_UNKNOWN
Const ID_DEFAULTINST = -2


Const DISPATCH_METHOD = &h1
Const DISPATCH_PROPERTYGET = &h2
Const DISPATCH_PROPERTYPUT = &h4
Const DISPATCH_PROPERTYPUTREF = &h8

Typedef LPTYPEINFO = VoidPtr '*ITypeInfo

' ITypeComp
TypeDef LPTYPECOMP = VoidPtr '*ITypeComp

' ICreateTypeLib
TypeDef LPCREATETYPELIB = VoidPtr '*ICreateTypeLib
typedef LPCREATETYPEINFO = VoidPtr '*ICreateTypeInfo

' TypeInfo API
'#if (defined (_WIN32) || defined (_WIN64))
Declare Function LHashValOfNameSysA Lib "oleaut32" (syskind As SYSKIND, lcid As LCID, szName As PCSTR) As DWord
'#endif

Declare Function LHashValOfNameSys Lib "oleaut32" (syskind As SYSKIND, lcid As LCID, szName As /*Const*/ *OLECHAR) As DWord

Const LHashValOfName(lcid, szName) = LHashValOfNameSys(SYS_WIN32, (lcid), (szName))
Const WHashValOfLHashVal(lhashval) = (((lhashval) And &h0000ffff) As Word)
Const IsHashValCompatible(lhashval1, lhashval2) = (((&h00ff0000 And (lhashval1)) = (&h00ff0000 And (lhashval2))) As BOOL)

'Declare Function LoadTypeLib Lib "oleaut32" (szFile As /*Const*/ *OLECHAR, ByRef ptlib As *ITypeLib) As DWord

Const Enum REGKIND
	REGKIND_DEFAULT,
	REGKIND_REGISTER,
	REGKIND_NONE
End Enum

Const LOAD_TLB_AS_32BIT = &h20
Const LOAD_TLB_AS_64BIT = &h40
Const MASK_TO_RESET_TLB_BITS = (Not (LOAD_TLB_AS_32BIT Or LOAD_TLB_AS_64BIT))

Declare Function LoadTypeLibEx Lib "oleaut32" (szFile As /*Const*/ *OLECHAR, regkind As REGKIND, ByRef ptlib As *ITypeLib) As HRESULT
Declare Function LoadRegTypeLib Lib "oleaut32" (ByRef rguid As GUID, wVerMajor As Word, wVerMinor As Word, lcid As LCID, ByRef ptlib As *ITypeLib) As HRESULT
Declare Function QueryPathOfRegTypeLib Lib "oleaut32" (ByRef rguid As GUID, wVerMajor As Word, wVerMinor As Word, lcid As LCID, ByRef bstrPathName As BSTR) As HRESULT
Declare Function RegisterTypeLib Lib "oleaut32" (ptlib As *ITypeLib, szFullPath As *OLECHAR, szHelpDir As *OLECHAR) As HRESULT
Declare Function CreateTypeLib Lib "oleaut32" (syskind As SYSKIND, szFile As /*Const*/ *OLECHAR, ByRef pctlib As *ICreateTypeLib) As HRESULT
Declare Function CreateTypeLib2 Lib "oleaut32" (syskind As SYSKIND, szFile As LPCOLESTR, ByRef pctlib As *ICreateTypeLib) As HRESULT

' IDispatch implementation support
TypeDef LPDISPATCH = *IDispatch

Type PARAMDATA
	szName As *OLECHAR
	vt As *VARTYPE
End Type

TypeDef LPPARAMDATA = *PARAMDATA

Type METHODDATA
	szName As *OLECHAR
	ppdata As *PARAMDATA
	dispid As DISPID
	iMeth As DWord
	cc As CALLCONV
	cArgs As DWord
	wFlags As Word
	vtReturn As VARTYPE
End Type

TypeDef LPMETHODDATA = *METHODDATA

Type INTERFACEDATA
	pmethdata As *METHODDATA
	cMembers As DWord
End Type

TypeDef LPINTERFACEDATA = *INTERFACEDATA

Declare Function DispGetParam Lib "oleaut32" (pdispparams As *DISPPARAMS, position As DWord, vtTarg As VARTYPE, ByRef varResult As VARIANT, ByRef uArgErr As DWord) As HRESULT
Declare Function DispGetIDsOfNames Lib "oleaut32" (ptinfo As *ITypeInfo, position As DWord, vtTarg As VARTYPE, ByRef varResult As VARIANT, ByRef uArgErr As DWord) As HRESULT
Declare Function DispInvoke Lib "oleaut32" (_this As VoidPtr, ptinfo As *ITypeInfo, dispidMember As DISPID, wFlags As Word, pparams As *DISPPARAMS, ByRef varResult As VARIANT, ByRef excepinfo As EXCEPINFO, ByRef uArgErr As DWord) As HRESULT
Declare Function CreateDispTypeInfo Lib "oleaut32" (ByRef pidata As INTERFACEDATA, lcid As LCID, ByRef ptinfo As *ITypeInfo) As HRESULT
Declare Function CreateStdDispatch Lib "oleaut32" (punkOuter As *IUnknown, pvThis As VoidPtr, ptinfo As *ITypeInfo, ByRef punkStdDisp As *IUnknown) As HRESULT
Declare Function DispCallFunc Lib "oleaut32" (pvInstance As VoidPtr, oVft As ULONG_PTR, cc As CALLCONV, vtReturn As VARTYPE, cActuals As DWord, ByRef rgvt As VARTYPE, ByRef rgpvarg As *VARIANTARG, ByRef vargResult As VARIANT) As HRESULT

' Active Object Registration API
Const ACTIVEOBJECT_STRONG = &h0
Const ACTIVEOBJECT_WEAK = &h1

Declare Function RegisterActiveObject Lib "oleaut32" (punk As *IUnknown, ByRef rclsid As CLSID, dwFlags As DWord, ByRef dwRegister As DWord) As HRESULT
Declare Function RevokeActiveObject Lib "oleaut32" (dwRegister As DWord, pvReserved As VoidPtr) As HRESULT
Declare Function GetActiveObject Lib "oleaut32" (ByRef rclsid As CLSID, pvReserved As VoidPtr, ByRef punk As *IUnknown) As HRESULT

' ErrorInfo API
Declare Function SetErrorInfo Lib "oleaut32" (dwReserved As DWord, perrinfo As *IErrorInfo) As HRESULT
Declare Function GetErrorInfo Lib "oleaut32" (dwReserved As DWord, ByRef perrinfo As *IErrorInfo) As HRESULT
Declare Function CreateErrorInfo Lib "oleaut32" (ByRef perrinfo As *ICreateErrorInfo) As HRESULT

' User Defined Data types support
Declare Function GetRecordInfoFromTypeInfo Lib "oleaut32" (pTypeInfo As *ITypeInfo, ByRef pRecInfo As *IRecordInfo) As HRESULT
Declare Function GetRecordInfoFromGuids Lib "oleaut32" (ByRef rGuidTypeLib As GUID, uVerMajor As DWord, uVerMinor As DWord, lcid As LCID, ByRef rGuidTypeInfo As GUID, ByRef pRecInfo As *IRecordInfo) As HRESULT

' MISC API
Declare Function OaBuildVersion Lib "oleaut32" () As DWord
Declare Sub ClearCustData Lib "oleaut32" (ByRef CustData As CUSTDATA)

#endif '_INC_OLEAUTO_AB
