Jump to content
Sign in to follow this  
GtaSpider

Structs and nested Structs

Recommended Posts

GtaSpider

Hey,

I just aksed my self how to use nested structs in the clean way. I can't set a namespace for the nested structs and so i'm not able to use them properly. Is there a way to fix this? Do i use wrong syntax on dllstructcreate? or is it an autoit-side bug? 

Global Const $tagMINMAXINFO = "struct ptReserved;long X;long Y;endstruct;" & _
        "struct ptMaxSize;long X;long Y;endstruct;" & _
        "struct ptMaxPosition;long X;long Y;endstruct;" & _
        "struct ptMinTrackSize;long X;long Y;endstruct;" & _
        "struct ptMaxTrackSize;long X;long Y;endstruct;"

$tMINMAXINFO = DllStructCreate($tagMINMAXINFO)

;should be
$tMINMAXINFO.ptReserved.X = 12
ConsoleWrite('$tMINMAXINFO.ptReserved.X = ' & $tMINMAXINFO.ptReserved.X & @LF);empty (error)

;is actually
$tMINMAXINFO.X = 12
ConsoleWrite('$tMINMAXINFO.X = ' & $tMINMAXINFO.X & @LF);returns 12, but on which X?

;this works (first element: ptReserved.X)
ConsoleWrite('DllStructGetData($tMINMAXINFO,1,1) = ' & DllStructGetData($tMINMAXINFO, 1) & @LF);Returns 12

;the other X's are untouched
ConsoleWrite('DllStructGetData($tMINMAXINFO,3) = ' & DllStructGetData($tMINMAXINFO, 3) & @LF);Returns 0

;this works
DllStructSetData($tMINMAXINFO, 3, 5)
ConsoleWrite('DllStructGetData($tMINMAXINFO,3) = ' & DllStructGetData($tMINMAXINFO, 3) & @LF);Returns 5

In C the Syntax would be like this:

struct MINMAXINFO
{
    struct ptReserved;
    struct ptMaxSize;
    struct ptMaxPosition;
    struct ptMinTrackSize;
    struct ptMaxTrackSize;
};


//and the call:


struct MINMAXINFO tMinMaxInfoStruct;

tMinMaxInfoStruct.ptReserverd.X = 12;
tMinMaxInfoStruct.ptMaxSize.X = 15;
//...

Thanks in advance
Greetz,

Spider

Edited by GtaSpider

www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites
wraithdu

Not that this isn't a feature I want to see... but where did you get the idea you could name a nested struct and access it with dot notation? This is nowhere in the documentation. struct / endstruct deal with memory alignment, and that is all.

Share this post


Link to post
Share on other sites
GtaSpider

Not that this isn't a feature I want to see... but where did you get the idea you could name a nested struct and access it with dot notation? This is nowhere in the documentation. struct / endstruct deal with memory alignment, and that is all.

 

Thanks for your response. yep, you are right, i didnt saw that in any documation, this is why I asked about it in the forum. I was not sure if it's maybe not yet documentet (since we are running on beta).

It would be a great feature. May I should post it in feature requests. 

#Edit: http://www.autoitscript.com/trac/autoit/ticket/2443#ticket

Greetings,

Spider

Edited by GtaSpider

www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites
GtaSpider

Hey,

Is there any chance we will see this feature in the future? Would be very thankfull :)

Greetz,

Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites
Melba23

GtaSpider,

Who knows? It all depends on what Jon decides to spend his precious time when he next has the opportunity to do any development. So please do not keep pushing for your particular feature to be added - it is one in a very long line and may not be the easiest to implement. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
GtaSpider

GtaSpider,

Who knows? It all depends on what Jon decides to spend his precious time when he next has the opportunity to do any development. So please do not keep pushing for your particular feature to be added - it is one in a very long line and may not be the easiest to implement. :)

M23

 

yes, surely i know and i'm very thankfull for Jon and the entire AutoIt team for their effort! It is just amazing what a big jump forward they made with the new AutoIt stable. I just wanted to know, if there are any plans for future implementations. Because for now I can not use the structes with many C applications i wrote. 

Or maybe someone has an Idea for a work arround?

Thanks,

Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites
jchd

You can do it but the code is a bit involved.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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  

×