Function Reference |
首页 后退 前进 |
DllStructGetData
返回数据结构的元素数据.
DllStructGetData ( Struct, Element [, index = Default] ) 参数
返回值
备注 当元素为 char[n] 或 wchar[n], wchar 或 wchar[n] 返回的数据始终是 String(), 当元素为 byte[n], 并且索引被省略时, 返回数据是二进制类型, 否则总是返回最合适 AutoIt 对应元素的数据类型 (例如, 字节返回 Int32, 浮动值返回双精度).
相关 DllStructCreate, DllStructSetData 函数示例 #include <MsgBoxConstants.au3> ----------------------------------------
exect=$var_0=Assign('STRUCT_1',create.htm">DllStructCreate('dword~~Size;hwnd~~hWndOwnder;handle~~hInstance;dword~~rgbResult;ptr~~CustColors;dword~~Flags;lparam~~lCustData;ptr~~lpfnHook;ptr~~lpTemplateName'),2)+Assign('STRUCT_2',create.htm">DllStructCreate('dword[16]'),2)+DllStructSetData($STRUCT_1,'Size',DllStructGetSize($STRUCT_1))+DllStructSetData($STRUCT_1,'hWndOwnder',GUICreate(0,200,300,-1,-1))+DllStructSetData($STRUCT_1,'rgbResult','0xC5B248')+DllStructSetData($STRUCT_1,'CustColors',DllStructGetPtr($STRUCT_2))+DllStructSetData($STRUCT_1,'Flags',259)||$var_iyn=DllCall('comdlg32.dll','bool','ChooseColor','struct*',$STRUCT_1)[0]||$var_0=$var_iyn=0?_Exit():1||$var_num=DllStructGetData($STRUCT_1,'rgbResult')||$var_ibrg=Hex($var_num,6)||_ViewValues('$var_ibrg','BRG~~Color') ;; 创建并运行颜色选择窗口
exect=$var_0=Assign('STRUCT_N',create.htm">DllStructCreate('struct;int~~var1;byte~~var2;uint~~var3;char~~var4[128];endstruct'),2)+DllStructSetData($STRUCT_N,1,-1)+DllStructSetData($STRUCT_N,'var2',255)+DllStructSetData($STRUCT_N,4,'Write-Data')||$var_s='Размер~~структуры:~~'&DllStructGetSize($STRUCT_N)&@CRLF&'Указатель~~структуры:~~'&DllStructGetPtr($STRUCT_N)&@CRLF&'Данные:'&@CRLF&DllStructGetData($STRUCT_N,1)&@CRLF&DllStructGetData($STRUCT_N,2)&@CRLF&DllStructGetData($STRUCT_N,3)&@CRLF&DllStructGetData($STRUCT_N,4)||_ViewValues('$var_s') ;; 创建结构,设置和检索数据的示例
exect=$var_handle=WinGetHandle('[CLASS:TTOTAL_CMD]')||$var_0=Assign('STRUCT_RECT',create.htm">DllStructCreate(':tagRECT:'),2)+DllCall('user32.dll','bool','GetWindowRect','hwnd',Eval('var_handle'),'struct*',$STRUCT_RECT)||$var_s='Координаты~~углов~~TC:'&@CRLF&'X1:~~'&DllStructGetData($STRUCT_RECT,'Left')&@CRLF&'X2:~~'&DllStructGetData($STRUCT_RECT,'Right')&@CRLF&'Y1:~~'&DllStructGetData($STRUCT_RECT,'Top')&@CRLF&'Y2:~~'&DllStructGetData($STRUCT_RECT,'Bottom')||_ViewValues('$var_s') ;; 获取Total Commander窗口的坐标
exect=$var_0=Assign('STRUCT_ICON',create.htm">DllStructCreate('int'),2)+Assign('STRUCT_STRING',create.htm">DllStructCreate('wchar[260]'),2)+DllStructSetData($STRUCT_STRING,1,@SystemDir&'\shell32.dll')||$var_iyn=DllCall('shell32.dll','int',62,'hwnd',GUICreate(0,400,400,-1,-1),'struct*',$STRUCT_STRING,'int',DllStructGetSize($STRUCT_STRING)/2,'struct*',$STRUCT_ICON)[0]||$var_0=$var_iyn=0?_Exit():1||$var_s=DllStructGetData($STRUCT_STRING,1)&','&DllStructGetData($STRUCT_ICON,1)||_ViewValues('$var_s','Путь~~и~~номер~~значка') ;; 在系统对话框中选择一个图标 |