Windows APIs to Xojo data type conversion

Here is a list of Windows types related to their Xojo equivalent, this is useful when you perform a Declare in Xojo.

Rule of thumb: ByRef and ByVal are only applicable to intrinsic data types (Integer, String, Double, Structures etc.) All arrays and object types are reference types, effectively behaving as if ByRef was used with a intrinsic data type.

If a parameter specifies OUT and is an intrinsic data type then it will need a ByRef so the value can be modified.

Remember: If you are calling a 32bit library from a 64bit application you may need to use use Int32 instead of Integer and UInt32 instead of UInteger.

Key: ? needs confirmation
References Used

Please post here if you spot an error.

Data typeXojo typeCode
ATOMUInt16name As UInt16
BOOLInt32name As Int32
value=CType(name, Boolean)
BOOLEANUInt8name As UInt8
value=CType(name, Boolean)
BYTEBytename As Byte
CCHARInt8name As Int8
CHARInt8name As Int8
COLORREFUInt32 or Color ?See Color
CONSTConstname As (check call)
DOUBLEDoublename As Double
DWORDUInt32name As UInt32
DWORDLONGUInt64name As UInt64
DWORD_PTRUIntegername As UInteger
DWORD32UInt32name As UInt32
DWORD64UInt64name As UInt64
FLOATSinglename As Single
HACCELIntegername As Integer
HALF_PTRInt16 (x32)
Int32 (x64)
Let me know if you find a use for this
HANDLEIntegername As Integer
HBITMAPIntegername As Integer
HBRUSHIntegername As Integer
HCOLORSPACEIntegername As Integer
HCONVIntegername As Integer
HCONVLISTIntegername As Integer
HCURSORIntegername As Integer
HDCIntegername As Integer
HDDEDATAIntegername As Integer
HDESKIntegername As Integer
HDROPIntegername As Integer
HDWPIntegername As Integer
HENHMETAFILEIntegername As Integer
HFILEInt32name As Int32
HFONTIntegername As Integer
HGDIOBJIntegername As Integer
HGLOBALIntegername As Integer
HHOOKIntegername As Integer
HICONIntegername As Integer
HINSTANCEIntegername As Integer
HKEYIntegername As Integer
HKLIntegername As Integer
HLOCALIntegername As Integer
HMENUIntegername As Integer
HMETAFILEIntegername As Integer
HMODULEIntegername As Integer
HMONITORInteger (W2000 onwards)name As Integer
HPALETTEIntegername As Integer
HPENIntegername As Integer
HRESULTInt32name As Int32
HRGNIntegername As Integer
HRSRCIntegername As Integer
HSZIntegername As Integer
HWINSTAIntegername As Integer
HWNDIntegerhWnd as Integer
INTInt32name As Int32
INT_PTRIntegername As Integer
INT8Int8name As Int8
INT16Int16name As Int16
INT32Int32name As Int32
INT64Int64name As Int64
LANGIDUInt16name As UInt16
LCIDUInt32name As UInt32
LCTYPEUInt32name As UInt32
LGRPIDUInt32name As UInt32
LONGInt32name As Int32
LONGLONGInt64name As Int64
LONG_PTRIntegername As Integer
LONG32Int32name As Int32
LONG64Int64name As Int64
LPARAMIntegername As Integer
LPBOOLInt32ByRef name As Int32
value=CType(name, Boolean)
LPBYTEByteByRef name As Byte
Color ?
ByRef name As UInt32
name As Color See Color
LPCSTRCStringname As CString
LPCTSTRWStringname As WString
Const name As (check call) = xxx
ByRef name As (check call) (if intrinsic)
name As (check call) (if NOT intrinsic)
LPCWSTRWStringname As WString
LPDWORDUInt32ByRef name As UInt32
LPHANDLEIntegerByRef name As Integer
LPINTInt32ByRef name As Int32
LPLONGInt32ByRef name As Long
LPSTRCStringname As CString

name As WString (unicode)
name As CString (ansi)
If a value is returned, use:
name As Ptr
Dim tmp As New MemoryBlock(256)
'Make your call
LPWORDUInt16ByRef UInt16
LPWSTRWStringname As WString
LRESULTIntegername As Integer
PBOOLInt32ByRef name As Int32
value=CType(name, Boolean)
PBOOLEANUInt8ByRef name As UInt8
value=CType(name, Boolean)
PBYTEByteByRef name As Byte
PCHARInt8ByRef name As Int8
PCSTRCStringname As CString
name As WString (unicode)
name As CString (ansi)
PCWSTRWStringname As WString
PDWORDUInt32ByRef name As UInt32
PDWORDLONGUInt64ByRef name As UInt64
PDWORD_PTRUIntegerByRef name As UInteger
PDWORD32UInt32ByRef name As UInt32
PDWORD64UInt64ByRef name As UInt64
PFLOATSingleByRef name As Single
PHALF_PTRInt16 (x86)
Int32 (x64)
ByRef name As Int16
ByRef name As Int32
PHANDLEIntegerByRef name As Integer
PHKEYIntegerByRef name As Integer
PINTInt32ByRef name As Int32
PINT_PTRIntegerByRef name As Integer
PINT8Int8ByRef name As Int8
PINT16Int16ByRef name As Int16
PINT32Int32ByRef name As Int32
PINT64Int64ByRef name As Int64
PLCIDUInt32ByRef name As UInt32
PLONGInt32ByRef name As Int32
PLONGLONGInt64ByRef name As Int64
PLONG_PTRIntegerByRef name As Integer
PLONG32Int32ByRef name As Int32
PLONG64Int64ByRef name As Int64
POINTER_32IntegerByRef name As Integer
POINTER_64IntegerByRef name As Integer
POINTER_SIGNEDIntegername As Integer
POINTER_UNSIGNEDUIntegername As UInteger
PSHORTInt16ByRef name As Int16
PSIZE_TUIntegerByRef name As UInteger
PSSIZE_TIntegerByRef name As Integer
PSTRCStringname As CString
ByRef name As UInt16 (unicode)
ByRef name As Int8 (ansi)
ByRef name As UInt16 (unicode)
ByRef name As UInt8 (ansi)
ByRef name As WString (unicode)
ByRef name As CString (ansi)
PUCHARUInt8ByRef name As UInt8
PUHALF_PTRUInt16 (x86)
UInt32 (x64)
ByRef name As UInt16
ByRef name As UInt32
PUINTUInt32ByRef name As UInt32
PUINT_PTRUIntegerByRef name As UInteger
PUINT8UInt8ByRef name As UInt8
PUINT16UInt16ByRef name As UInt16
PUINT32UInt32ByRef name As UInt32
PUINT64UInt64ByRef name As UInt64
PULONGUInt32ByRef name As UInt32
PULONGLONGUInt64ByRef name As UInt64
PULONG_PTRUIntegerByRef name As UInteger
PULONG32UInt32ByRef name As UInt32
PULONG64UInt64ByRef name As UInt64
PUSHORTUInt16ByRef name As UInt16
(check call)
(check call)
name As Ptr (if using memoryblock)
ByRef name As (check call) (if intrinsic)
name As (check call) (if NOT intrinsic)
PWCHARUInt16ByRef name As UInt16
PWORDUInt16ByRef name As UInt16
ByRef name As WString
name As Ptr (to memoryblock)
QWORDUInt64name As UInt64
SC_HANDLEIntegername As Integer
SHORTInt16name As Int16
SIZE_TUIntegername As UInteger
SSIZE_TIntegername As Integer
ByRef name As UInt16 (unicode)
ByRef name As Int8 (ansi)
ByRef name As UInt16 (unicode)
ByRef name As Int8 (ansi)
UCHARUInt8name As UInt8
UHALF_PTRUInt16 (x86)
UInt32 (x64)
name As UInt16
name As UInt32
UINTUInt32name As UInt32
UINT_PTRUIntegername As UInteger
UINT8UInt8name As UInt8
UINT16UInt16name As UInt16
UINT32UInt32name As UInt32
UINT64UInt64name As UInt64
ULONGUInt32name As UInt32
ULONGLONGUInt64name As UInt64
ULONG_PTRUIntegername As UInteger
ULONG32UInt32name As UInt32
ULONG64UInt64name As UInt64
  Length As UInt16
  MaximumLength As UInt16
  Buffer As WString
End Structure
USHORTUInt16name As UInt16
USNInt64name As Int64
(check call)
(check call)
name As Ptr
ByRef name As (check call)
name As (check call)
(If there is no return, see Declare Sub)
WCHARUInt16name As UInt16
WINAPIMicrosoft Win32 API calls are all StdCall so you might need:
#Pragma X86CallingConvention StdCall
WNDPROCInteger or PtrhWnd as Integer
hWnd As Ptr
WORDUInt16name As UInt16
WPARAMUIntegername As UInteger
ByRef name As UInteger (if OUT)

Microsoft – Windows API Index
Microsoft – Windows Data Types (see below for up to date edition)
Microsoft – Data Type Ranges
Microsoft – Integer Limits
Microsoft – New Data Types
Microsoft – WINVER List
Xojo – Integer Sizes (bottom of page)
Xojo Data Types
Microsoft – Windows Data Types (published and up to date edition)
Sign Extension (POINTER_32 and POINTER_64)

One thought on “Windows APIs to Xojo data type conversion

Leave a Reply

Your email address will not be published. Required fields are marked *