Jump to content
Sign in to follow this  
Kip

DllStructSetData() instead of variables?

Recommended Posts

Kip

Hi

I know you can (kinda) store data in a struct.

But can you actually keep data in a structure?

Because, if so.. you can create some really cool arrays :)

Or is it slowing down the computer/program?

Share this post


Link to post
Share on other sites
SmOke_N

Hi

I know you can (kinda) store data in a struct.

But can you actually keep data in a structure?

Because, if so.. you can create some really cool arrays :)

Or is it slowing down the computer/program?

Creating the struct globally then using DllStructSetData() would keep the data in the struct for the entire app to use.

Obviously making the struct local within a function, unless you pass that struct back as a return, the data would be destroyed.

The same rules would apply as other variables.

Gary did some nice work with the Structs in the struct include.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Siao

It's not much slower than using AutoIt arrays, from teh (rather limited) testing I did.

I had the same idea mainly because of ability to use memory pointers. Which it seems developers have no intention to make available for AutoIt's native variables, and that's a shame.

Too bad the DllStruct syntax is so bloated, and making function wrappers would add more overhead.


"be smart, drink your wine"

Share this post


Link to post
Share on other sites
Kip

My idea was this:

Posted Image

In the first array type, data can only be "kept" in the last dimension,

In the second one (the one that can be created using DllStruct..) data can be stored in multiple dimensions. And every dimension can have a different count of elements.

It's just 'array in array', but using standard autoit arrays, the script would slow down.

Edited by Kip

Share this post


Link to post
Share on other sites
Jon

At the moment structs are actually stored inside a hidden autoit array, so by storing stuff in a struct array, you are actually storing stuff inside an array inside an array...

Also, DLLStructs are ONLY designed to be used with DllCall - we had problems before when people used them as their own custom data storage.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.