函数参考


_WinAPI_DisplayStruct

Displays data from the specified structure or memory address as a list.

#Include <WinAPIEx.au3>
_WinAPI_DisplayStruct ( $tStruct [, $sStruct [, $sTitle [, $iItem [, $iSubItem [, $iFlags [, $fTop [, $hParent]]]]]]] )

参数

$tStruct A structure that was created by DllStructCreate(), or memory address to be display its data.
$sStruct [可选参数] A string representing the structure. If $tStruct is a structure, this parameter can be omitted or be
an empty string. In this case, the structure will display as "byte[n]" structure. If $tStruct is a
memory address, $sStruct should be a string representing the structure, otherwise, the function
fail, and @error set to 1.
$sTitle [可选参数] The title of the window, deault is "Structure: ListView Display".
$iItem [可选参数] The 1-based index or name of the structure member to be selected in the list. If this parameter is 0,
or an incorrect index or name, the first element of the structure will be selected.
$iSubItem [可选参数] The 1-based index of the array in the structure member pointed to by the $iItem parameter to be
selected. If $iItem was not defined as an array in the $sStruct, or invalid array index, the element
pointed to by the $iItem parameter will be selected.
$iFlags [可选参数] A set of bit flags that specifies an additional displaying options. This parameter can be 0, or any
combination of the following values.

1 - Prevent displaying "" and "" fields at the beginning and end of the list.
2 - Prevent displaying "" fields.
4 - Prevent displaying "" in "Member" column of the list if the structure element has no name.
8 - Prevent highlighting structure elements that are defined as an array.
16 - Prevent perceiving structure elements named "Reserved*" as unused elements.
32 - Prevent using double-click to copy values of the structure elements to the clipboard.
64 - Forced to expand structure elements of BYTE[n], UBYTE[n], and BOOLEAN[n] types (elements of CHAR[n] and WCHAR[n] types always displays as a string).
128 - Forced to display the values of the structure elements in the hexadecimal representation, if possibly.
256 - Forced to return error code instead of displaying a message box if a memory access error occurred.
512 - Forced to disable checking the read access memory allocated to a given structure.
$fTop [可选参数] Specifies whether create a window with "Always On Top" attribute, valid values:
TRUE - The window is created with the $WS_EX_TOPMOST extended style. (Default)
FALSE - The window will not have the "TOPMOST" flag set.
$hParent [可选参数] Handle to the parent window.

返回值

成功: 返回 1.
Failure 0 and sets the @error flag to the one of the following values:
1 The $sStruct parameter is not a string.
2 There is an unknown data type in the string passed.
3 Failed to allocate the memory needed for the structure, or invalid pointer.
4 Unspecified error.
5 Error accessing memory to read data.

注意/说明

This function is intended primarily for debugging and should not be used in the final script, since no useful
information for the end user does not carry.

相关

详情参考

None

示例/演示


#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global $sStruct = 'dword Length;short State;uint Flags;handle hBitmap;hwnd hDC;long Rect[4];byte[14];int Reserved[10];wchar Text[80]'
Global $tStruct = DllStructCreate($sStruct)

DllStructSetData($tStruct, 1, 80)
DllStructSetData($tStruct, 2, 6)
DllStructSetData($tStruct, 3, 1)
DllStructSetData($tStruct, 4, 0x00010014)
DllStructSetData($tStruct, 5, 0x01010057)
DllStructSetData($tStruct, 6, 20, 1)
DllStructSetData($tStruct, 6, 20, 2)
DllStructSetData($tStruct, 6, 60, 3)
DllStructSetData($tStruct, 6, 80, 4)
DllStructSetData($tStruct, 7, Binary('0x656A6D633835206C6A6764206200'))
DllStructSetData($tStruct, 8, 0)
DllStructSetData($tStruct, 9, 'Simple Text')

_WinAPI_DisplayStruct($tStruct, $sStruct)