#case capital

typedef quad  longlong, LONGLONG
typedef qword ulonglong, ULONGLONG
typedef void *pvoid, PVOID
typedef int SCODE
typedef double DATE
typedef word USHORT
typedef short SHORT,VARIANT_BOOL,VARTYPE
typedef byte BYTE
typedef char CHAR
typedef word WORD,USHORT
typedef long LONG
typedef int INT
typedef uint UINT
typedef dword ULONG
typedef float FLOAT
typedef double DOUBLE
typedef wbstring BSTR

typedef void IUnknown,IDispatch
typedef void IRecordInfo


type DECIMAL
   WORD wReserved
   BYTE scale
   BYTE sign
   ULONG Hi32
   ULONGLONG Lo64
end type

type CY
  LONGLONG int64
end type

type SAFEARRAYBOUND
   ULONG cElements
   LONG lLbound
end type

type SAFEARRAY
  USHORT         cDims
  USHORT         fFeatures
  ULONG          cbElements
  ULONG          cLocks
  PVOID          pvData
  SAFEARRAYBOUND rgsabound[1]
end type


enum VARTYPE {
   VT_EMPTY = 0x0000,
   VT_NULL = 0x0001,
   VT_I2 = 0x0002,
   VT_I4 = 0x0003,
   VT_R4 = 0x0004,
   VT_R8 = 0x0005,
   VT_CY = 0x0006,
   VT_DATE = 0x0007,
   VT_BSTR = 0x0008,
   VT_DISPATCH = 0x0009,
   VT_ERROR = 0x000A,
   VT_BOOL = 0x000B,
   VT_VARIANT = 0x000C,
   VT_UNKNOWN = 0x000D,
   VT_DECIMAL = 0x000E,
   VT_I1 = 0x0010,
   VT_UI1 = 0x0011,
   VT_UI2 = 0x0012,
   VT_UI4 = 0x0013,
   VT_I8 = 0x0014,
   VT_UI8 = 0x0015,
   VT_INT = 0x0016,
   VT_UINT = 0x0017,
   VT_VOID = 0x0018,
   VT_HRESULT = 0x0019,
   VT_PTR = 0x001A,
   VT_SAFEARRAY = 0x001B,
   VT_CARRAY = 0x001C,
   VT_USERDEFINED = 0x001D,
   VT_LPSTR = 0x001E,
   VT_LPWSTR = 0x001F,
   VT_RECORD = 0x0024,
   VT_INT_PTR = 0x0025,
   VT_UINT_PTR = 0x0026,
   VT_ARRAY = 0x2000,
   VT_BYREF = 0x4000
}


type VARIANT
  DECIMAL decVal
  =
  WORD    vt 'VARTYPE
  WORD    wReserved1
  WORD    wReserved2
  WORD    wReserved3
  + 8
  =
  LONGLONG     llVal
  =
  LONG         lVal
  =
  BYTE         bVal
  =
  SHORT        iVal
  =
  FLOAT        fltVal
  =
  DOUBLE       dblVal
  =
  VARIANT_BOOL boolVal
  =
  SCODE        scode
  =
  CY           cyVal
  =
  DATE         pdate
  =
  BSTR         bstrVal
  =
  IUnknown     *punkVal
  =
  IDispatch    *pdispVal
  =
  SAFEARRAY    *parray
  =
  BYTE         *pbVal
  =
  SHORT        *piVal
  =
  LONG         *plVal
  =
  LONGLONG     *pllVal
  =
  FLOAT        *pfltVal;
  =
  DOUBLE       *pdblVal
  =
  VARIANT_BOOL *pboolVal
  =
  SCODE        *pscode
  =
  CY           *pcyVal
  =
  DATE         *pdate
  =
  BSTR         *pbstrVal
  =
  IUnknown     **ppunkVal
  =
  IDispatch    **ppdispVal
  =
  SAFEARRAY    **pparray
  =
  VARIANT      *pvarVal
  =
  PVOID        byref
  =
  CHAR         cVal
  =
  USHORT       uiVal
  =
  ULONG        ulVal
  =
  ULONGLONG    ullVal
  =
  INT          intVal
  =
  UINT         uintVal
  =
  DECIMAL      *pdecVal
  =
  CHAR         *pcVal
  =
  USHORT       *puiVal
  =
  ULONG        *pulVal
  =
  ULONGLONG    *pullVal
  =
  INT          *pintVal
  =
  UINT         *puintVal
  =
  PVOID       pvRecord;
  IRecordInfo *pRecInfo;
end type


  typedef VARIANT VARIANTARG

'#recordof VARIANT
'mbox str sizeof VARIANT


extern lib "oleAut32.dll"
=========================

HRESULT VariantChangeType(
  VARIANTARG       *pvargDest,
  VARIANTARG       *pvarSrc, 'const
  USHORT           wFlags,
  VARTYPE          vt
);

end extern


'oleaut
'https://docs.microsoft.com/en-us/windows/desktop/api/oleauto/nf-oleauto-variantinit
