Image and video hosting by TinyPic
While working on debugging a project a while back, I was looking for better ways to debug the code.  And voila, here it is.

Anyway, this function displays the contents of your DLLStruct's in a ListView format (placing the items in an array and utilizing _ArrayDisplay).

IMPORTANT: You must supply the string EXACTLY as it was used to set up the structure (although you can add descriptions after the datatypes if they aren't already there). The string requirement might seem like one more extra step, but without it the function wouldn't work (and you're debugging would be much harder).

The code is smart enough to split items into subitems (based on [#]'s found), and will display the description with {sub item #x}).

Also - the behaviour with GINORMOUS pieces of data is unknown - this is best used with smaller structures!

NOTE: One thing you might notice about structures is alignment has alot to do with where items are placed in the structure. The default is '8', which means that everything is aligned on a boundary equally divisible by itself (char being 1 byte is aligned anywhere, int's being 4 bytes, are aligned on offsets divisible by 4, double's and int64's both are aligned on offsets equally divisible by 8)

HOWEVER: a prefix of 'align ##' can change this behavior so that the data can be 'misaligned' so to speak, to the specified alignment # (see AutoIT Help info for DLLStructCreate)

Update Log:
5/27/2011: Small fixes, ability to use multiple 'align' directives
Fixed: initial 'align (##);' check code failed in certain circumstances (align on its own, spaces after #)
Fixed: 'char' & 'byte' can now be part of description of all array objects
Added/Fixed: 'align (##);' can now appear anywhere in a structure, now properly handled (extra ones are reported in display)
5/26/2011: Updated to new structure alignment directives (as of AutoIt v3.3.7.2beta)
Added: Structure size information, End-of-Structure Padding Info
Added: Struct/EndStruct support, these show up in list with C-style curly braces { };
3/18/2010: Updated to all new supported types as of AutoIT v3.3.6.0
Added: Index, Offset, Size Columns, Base Pointer & Alignment Type info (in Title Bar and in 'Offset' column)
Fixed: subitem listings, items with labels, alignment override being read as a type, subitem offsets, fixed case-sensitivity
Adjusted: stripped unnecessary whitespace, added options to display Strings (char[#]/wchar[#]) and Binary string data (ubyte[#],byte[#]) as one concatenated string

Ascend4nt's AutoIT Code License agreement:
While I provide this source code freely, if you do use the code in your projects, all I ask is that:
  1. If you provide source, keep the header as I have put it, OR, if you expand it, then at least acknowledge me as the original author, and any other authors I credit
  2. If the program is released, acknowledge me in your credits (it doesn't have to state which functions came from me, though  again if the source is provided - see #1)
  3. The source on it's own (as opposed to part of a project) can not be posted unless a link to the page(s) where the code were retrieved from is provided and a message stating that the latest updates will be available on the page(s) linked to.
  4. Pieces of the code can however be discussed on the threads where Ascend4nt has posted the code without worrying about further linking.

- Example Usage CODE START -

#include <Misc.au3> ; _VersionCompare()

Local $sStructStr="Align 16;Short Albi;byte;hwnd;char;align 8;byte;short[2];dword;" & _
 "byte;short;byte;int64;char[9];int64;byte;byte;ptr;char;double;short;wchar[3]" & _
 ";byte;float;byte;uint_ptr;byte;int;byte[13];word 2bytes;handle isptr;hwnd isalsoptr;" & _
 "boolean isbyte[2];bool isint;dword_ptr;long_ptr;ulong_ptr;lparam;wparam;lresult;byte;"

; Version Struct/EndStruct addition
If _VersionCompare(@AutoItVersion,'')>0 Then
$sStructStr&="Struct asd;ptr;byte WithInStruct;EndStruct asd;byte"

Local $stStruct=DllStructCreate($sStructStr)
If @error Then Exit ConsoleWrite("DLLStructCreate @error="&@error&@CRLF)
If Not _DLLStructDisplay($stStruct,$sStructStr,"Randomness") Then
    ConsoleWrite("_DLLStructDisplay failed, @error="&@error&@CRLF)

D4n Centient,
May 27, 2011, 9:29 AM