I’m starting to get into some slightly advanced programming that requires the use of Windows and third party API’s on Windows 8.1 with PB 5.21 LTS. I use many of the simple Windows API’s and I’m happy with the basic use of structures and linked lists but some of the API’s want to return data to a structured array.
I create my structure, create a list of type my structure, I give the API the pointer of the list but that’s when I get problems?
I assume I need to somehow determine the size of my list to be and then allocate that memory. How do I do that? I know how to allocate memory but I may be missing the point of how the allocated memory, structured list and API all fit together.
To give an idea of the things I’m attempting, I’ve been trying to work with IP controlled power sockets and the API wants to return a list of found devices to a structured array.
NFC reader/writer API wants to do a similar devices found task.
Finally I want to control the source input of my monitors using the dxva2.dll. With multiple monitors, again a structured array of a list of found devices.
I do apologise in advance if it is here as I may be using the wrong search criteria. I have tried searching the forum, the web and the manual for help but I can’t seem to find anything on this specific issue within PB.
Any help, advice, links or samples would be welcome. I’m not looking for a “please do it for me”, I want to learn and understand how it’s done and I learn better when following an example. I’m sure it’s something stupid I’m not doing or understanding.
Many thanks.
Help required for API's returning data to structured arrays.
Re: Help required for API's returning data to structured arr
Allocate an structured Array:
Dim arr.StructType( count ) ; arr() is the address of the whole array, or @arr(0)
Allocate structured memory:
*mem.StructType = AllocateMemory( count * Sizeof(StructType) ) ; *mem is the address of the whole structured memory block
Dim arr.StructType( count ) ; arr() is the address of the whole array, or @arr(0)
Allocate structured memory:
*mem.StructType = AllocateMemory( count * Sizeof(StructType) ) ; *mem is the address of the whole structured memory block
Re: Help required for API's returning data to structured arr
Many thanks for that Danilo.