Modify

Opened 12 years ago

Last modified 2 years ago

#2443 assigned Feature Request

Name of nested structs

Reported by: GtaSpider Owned by: Jon
Milestone: Component: AutoIt
Version: Severity: None
Keywords: nested structs Cc:

Description

Hello,

as mentioned in this topic, i would realy like to see the ability to name nested structs.
http://www.autoitscript.com/forum/topic/154288-betastructs-and-nested-structs/

f.e. $tagMINMAXINFO: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632605(v=vs.85).aspx consists of five POINT ($tagPOINT) structs. And these structs consits of two LONG variables. If you now could name these nested structs you could set them like on the example below. I don't know what would be better, maybe it would be smarter to set the name of the structure after the ENDSTRUCT keyword so you could use them like these

$tagMINMAXINFO = $tagPOINT&" ptReserved; "&$tagPOINT&" ptMaxSize; [...]"

And the example:

#include <StructureConstants.au3>

#cs - Example 1
	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;"
#ce - Example 1

#region - Example 2, may the smarter option
Global Const $tagMINMAXINFO = $tagPOINT & " ptReserved;" & _
		$tagPOINT & " ptMaxSize;" & _
		$tagPOINT & " ptMaxPosition;" & _
		$tagPOINT & " ptMinTrackSize;" & _
		$tagPOINT & " ptMaxTrackSize;"
#endregion - Example 2, may the smarter option


 
$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

Thanks in Advance,
Sincerely,
your Spider.
p.s. thank you very much for your effort!

Attachments (0)

Change History (4)

comment:1 by GtaSpider, 12 years ago

Sorry, forgot to set version to blank :(

comment:2 by TicketCleanup, 12 years ago

Version: 3.3.9.20

Automatic ticket cleanup.

comment:3 by J-Paul Mesnage, 5 years ago

Owner: set to J-Paul Mesnage
Status: newassigned

introduce new types tag/endtag to be use in DllStructCreate()
DllStruct*Data can be replace by $tStruct.tag.element
DllStructGetPtr by $tStruct.tag.element.Ptr()

Fiw sent to Jon

comment:4 by J-Paul Mesnage, 2 years ago

Owner: changed from J-Paul Mesnage to Jon

Modify Ticket

Action
as assigned The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.