PlanetSquires Forums

Support Forums => WinFBX - Windows Framework for FreeBASIC => Topic started by: Upsydaisy on May 21, 2023, 12:04:42 PM

Title: How to use UDT with containers like CSafeArray or CDicObj?
Post by: Upsydaisy on May 21, 2023, 12:04:42 PM
Hi,

I have been experimenting with the containers provided in Afx. I would like to store a UDT in something like a CSafeArray but cannot figure out the best way of doing it?

I get the feeling the best way of doing this is to dynamically allocate the UDT then store the address in the container?

I also notice that container types use CVar for the items, could this help?

Thanks
Title: Re: How to use UDT with containers like CSafeArray or CDicObj?
Post by: José Roca on May 21, 2023, 05:48:53 PM
You have to pass a variant of type VT_RECORD that will hold a pointer to a IRecordInfo object. The low-level IRecordInfo interface will be used to describe the members of the UDT and fill the values.

IRecordInfo interface: https://learn.microsoft.com/en-us/windows/win32/api/oaidl/nn-oaidl-irecordinfo

It's not easy, unless you have good low-level COM programming knowledge.