Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/24/2014 in all areas

  1. Now replaced by a new version of the UDF in this link. <hr> [NEW VERSION] - 7 Mar 16 Added: A new option for $iAdded (+ 512) allows you to select just one cell of the ListView rather than the whole row. A new function _GUIListViewEx_SetDefColours allows the user to set the default colours when using either or both the "colour" and "single cell selection" options. Another new function _GUIListViewEx_BlockReDraw which prevents ListView redrawing during looped Insert/Delete/Change calls - this greatly speeds up execution by avoiding lengthy redrawing when using either or both the "colour" and "single cell selection" options, use of which forces the redraw to use a WM_NOTIFY handler within the script. Changed: A number of minor internal changes to speed up the loading of the ListView when using either or both of the "colour" and "single cell selection" options. A slightly modified Example_6 script shows the new functions in use. The LH native ListView can have rows and columns added/removed using both the old and new functions and has a context menu to allow for colour selection. The contents of this ListView can be mirrored to the RH UDF-created ListView which has "single cell selection" enabled and allows the colours of any item (including the selected cell) to be changed programmatically. New UDF in the zip below. Previous changes: ChangeLog.txt Hi, It seemed that I wanted to add, delete, edit or move items in a ListView quite often in my scripts and I got fed up with having to rewrite the code to do it each time. I also wanted to be able to drag items within and between ListViews with the mouse, plus edit the items. So I decided to write a UDF to make life easier and here is the result - GUIListViewEx. If you are interested in how it works, then read this bit - if not, then skip over it: The UDF is pretty easy to use: - You start by creating a ListView (either native or UDF) and passing the returned ControlID/handle and the array you used to fill it to the _Init function of the UDF. You also indicate whether the array has a count in the [0] (or [0][0]) element and if you create an empty ListView, the UDF will still cope and will shadow any items that you insert later. If you have a ListView filled with data but no matching array, there is a function to read that data into an array for you. You can select a colour for the insert mark when dragging items if you are going to use this feature - the default is black - and decide whether to have a shadow of the dragged item follow the mouse. Finally you can set the ListView to be sortable, editable - with various options to determine how the editing process works, determine external drag/drop behaviour and whether user colours are used. - You need to register a few Windows messages, but this is a single call to the _MsgRegister function. If you already have handlers for the relevant messages, there are functions to call within these handlers instead. If you do not want to drag, then you only need the WM_NOTIFY handler loaded. - Then you just need to call the main _Insert($vData), _Delete, _Up, and _Down functions when the appropriate button is pressed, select and drag items, or use one of the edit functions and your ListView responds automatically. - The UDF shadows the contents of the ListView (as explained in the spoiler section above) so you can get its current state at any time with the _ReturnArray function . Many of the functions actually return this data after each call just to help you keep track and there are dedicated Save/Load functions. - If enabled, the user can colour individual items within the ListView - and can set certain elements to be coloured on loading if required. - There are a couple of functions that you need to run in your idle loop if you need the functionality - they detect when items are dragged and edited. - When you have finished with the ListView, you should use the _Close function to clear the memory used by the UDF to shadow its contents. It is not vital, but if you use a lot of ListViews and do not do this, you could end up running out of memory. - You can have as many ListViews as you wish on display at any one time and the same "Insert", "Delete", "Up" and "Down" buttons can be used for them all - you just have to click on the one you want to be active. The UDF also allows you to set the active ListView programatically (_SetActive) - and to determine which is currently active (_GetActive). There are also additional Insert/DeleteSpec functions which allow you to action non-active ListViews. There are 6 example scripts to show the UDF working on native and UDF created ListViews, with single or multiple columns and either filled or empty, along with the UDF itself in this zip file: Credit to martin (for the basic drag code which I found on the forum), the Array UDF authors (for the basis of the array functions) and LarsJ (for the basic colour handler code). Happy for any feedback - hopefully positive! M23
    1 point
  2. wolf9228

    CArray Third Version

    CArray Third Version CArray.zip CArray.au3 #include <GuiListView.au3> #include <GUIConstantsEx.au3> Global $UNICODE = True ; BOOL $UNICODE Global $BinaryToStruct = True ;BOOL $BinaryToStruct True Fast // $tagStruct = "BYTE Binary[" & $BinaryLen & "]" Global $ByteSize=DllStructGetSize(DllStructCreate("BYTE")),$DoubleSize=DllStructGetSize(DllStructCreate("DOUBLE")) Global $OleAut32 = DllOpen("OleAut32.dll") , $Msvcrt = DllOpen("msvcrt.dll") , $kernel32 = DllOpen("kernel32.dll") Func CArray1D($RowsCount) If $RowsCount < 1 Then Return SetError(1,0,0) $CArray1D = DllStructCreate("INT RE;BYTE DATATYPE[" & $RowsCount & "];DOUBLE ELEMENTS[" & $RowsCount & "]") DllStructSetData($CArray1D,1,$RowsCount) Return $CArray1D EndFunc Func UBound1D(ByRef $CArray1D) $RE = DllStructGetData($CArray1D,"RE") if ($RE = 0) Then Return SetError(1,0,0) Return $RE EndFunc Func ReDim1D(ByRef $CArray1D,$RowsCount) Local $iRowsCount = DllStructGetData($CArray1D, 1) Local $TestBool = $iRowsCount > 0 And $RowsCount > 0 Select Case $TestBool And $RowsCount > $iRowsCount Local $NewCArray1D = DllStructCreate("INT RE;BYTE DATATYPE[" & $RowsCount & "];DOUBLE ELEMENTS[" & $RowsCount & "]") Local $DataTypePtr = DllStructGetPtr( $CArray1D , 2 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray1D,2) Local $ElementsPtr = DllStructGetPtr( $CArray1D , 3 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray1D,3) Local $SizeA = ($DoubleSize * $iRowsCount) Local $SizeB = $iRowsCount ;($ByteSize * $iRowsCount) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeB) DllStructSetData($NewCArray1D,1,$RowsCount) $CArray1D = $NewCArray1D Return True Case $TestBool And $RowsCount < $iRowsCount Local $NewCArray1D = DllStructCreate("INT RE;BYTE DATATYPE[" & $RowsCount & "];DOUBLE ELEMENTS[" & $RowsCount & "]") Local $DataTypePtr = DllStructGetPtr( $CArray1D , 2 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray1D,2) Local $ElementsPtr = DllStructGetPtr( $CArray1D , 3 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray1D,3) Local $SizeA = $DoubleSize * $RowsCount Local $SizeB = $RowsCount ;($ByteSize * $RowsCount) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeB) For $i = ($RowsCount + 1) To $iRowsCount If (DllStructGetData($CArray1D,2,$i) > 5) Then _ ;Null Value = 0 // 6 and 7 and 8 String Ptr And Binary Ptr DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$i)) Next DllStructSetData($NewCArray1D,1,$RowsCount) $CArray1D = $NewCArray1D Return True Case ($TestBool) And ($RowsCount = $iRowsCount) Return True EndSelect Return SetError(1,0,False) EndFunc Func GetAt1D(ByRef $CArray1D,$RowIndex) $RowIndex += 1 Switch DllStructGetData($CArray1D,"DATATYPE",$RowIndex) Case 8 $LPVOID = DllStructGetData($CArray1D,3,$RowIndex) $String = DllCall($Msvcrt,"WSTR:CDECL","wcscpy","PTR",$LPVOID,"PTR",$LPVOID) Return $String[0] Case 7 $LPVOID = DllStructGetData($CArray1D,3,$RowIndex) $String = DllCall($Msvcrt , "STR:CDECL" ,"strcpy","PTR",$LPVOID,"PTR",$LPVOID) Return $String[0] Case 6 $LPVOID = DllStructGetData($CArray1D,3,$RowIndex) $BinaryLen = DllCall($OleAut32,"UINT","SysStringByteLen","PTR",$LPVOID) Switch $BinaryToStruct Case True Return DllStructCreate("BYTE Binary[" & $BinaryLen[0] & "]",$LPVOID) Case False Return DllStructGetData(DllStructCreate("BYTE Binary[" & $BinaryLen[0] & "]",$LPVOID),1) EndSwitch Case 5 Return DllStructGetData($CArray1D,3,$RowIndex) Case 4 Return DllStructGetData($CArray1D,3,$RowIndex) Case 3 Return DllStructGetData($CArray1D,3,$RowIndex) <> 0 Case 2 Return Ptr(DllStructGetData($CArray1D,3,$RowIndex)) Case 1 Return Default EndSwitch if @error Then Return SetError(1,0,"") ; error For DllStructGetData($CArray1D,"DATATYPE",$RowIndex) Return "" ; Null Values EndFunc Func SetAt1D(ByRef $CArray1D,$RowIndex,$vValue) $RowIndex += 1 Local $DataType = DllStructGetData($CArray1D,2,$RowIndex) Select Case IsString($vValue) Switch $UNICODE Case True if DllStructSetData($CArray1D,2,8,$RowIndex) = 0 Then Return SetError(1,0,False) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$RowIndex)) $LPVOID = DllCall($OleAut32,"PTR","SysAllocString","WSTR",$vValue) DllStructSetData($CArray1D,3,$LPVOID[0],$RowIndex) Return True Case False if DllStructSetData($CArray1D,2,7,$RowIndex) = 0 Then Return SetError(1,0,False) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$RowIndex)) $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","STR",$vValue,"UINT",StringLen($vValue)) DllStructSetData($CArray1D,3,$LPVOID[0],$RowIndex) Return True EndSwitch Case IsBinary($vValue) Local $BinaryLen = BinaryLen($vValue) if DllStructSetData($CArray1D,2,6,$RowIndex) = 0 Then Return SetError(1,0,False) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$RowIndex)) $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","PTR",0,"UINT",$BinaryLen) $LPVOID = $LPVOID[0] DllStructSetData(DllStructCreate("BYTE[" & $BinaryLen & "]",$LPVOID),1,$vValue) DllStructSetData($CArray1D,3,$LPVOID,$RowIndex) Return True Case IsInt($vValue) if DllStructSetData($CArray1D,2,5,$RowIndex) = 0 Then Return SetError(1,0,False) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$RowIndex)) DllStructSetData($CArray1D,3,$vValue,$RowIndex) Return True Case IsFloat($vValue) if DllStructSetData($CArray1D,2,4,$RowIndex) = 0 Then Return SetError(1,0,False) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$RowIndex)) DllStructSetData($CArray1D,3,$vValue,$RowIndex) Return True Case IsBool($vValue) if DllStructSetData($CArray1D,2,3,$RowIndex) = 0 Then Return SetError(1,0,False) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$RowIndex)) DllStructSetData($CArray1D,3,$vValue,$RowIndex) Return True Case IsPtr($vValue) if DllStructSetData($CArray1D,2,2,$RowIndex) = 0 Then Return SetError(1,0,False) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$RowIndex)) DllStructSetData($CArray1D,3,$vValue,$RowIndex) Return True Case IsKeyword($vValue) ;Default Keyword if DllStructSetData($CArray1D,2,1,$RowIndex) = 0 Then Return SetError(1,0,False) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$RowIndex)) Return True EndSelect Return SetError(2,0,False) EndFunc Func SetWithReDim1D(ByRef $CArray1D,$RowIndex,$vValue) $RowIndex += 1 Local $RowsCount = DllStructGetData($CArray1D,"RE"),$DataType = 0 Select Case $RowsCount = 0 Or $RowIndex < 1; Failure For DllStructGetData($CArray1D,"RE") Or $RowIndex < 1 Return SetError(1,0,False) Case IsString($vValue) Switch $UNICODE Case True $LPVOID = DllCall($OleAut32,"PTR","SysAllocString","WSTR",$vValue) $DataType = 8 $vValue = $LPVOID[0] Case False $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","STR",$vValue,"UINT",StringLen($vValue)) $DataType = 7 $vValue = $LPVOID[0] EndSwitch Case IsBinary($vValue) Local $BinaryLen = BinaryLen($vValue) $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","PTR",0,"UINT",$BinaryLen) $LPVOID = $LPVOID[0] DllStructSetData(DllStructCreate("BYTE[" & $BinaryLen & "]",$LPVOID),1,$vValue) $DataType = 6 $vValue = $LPVOID Case IsInt($vValue) $DataType = 5 Case IsFloat($vValue) $DataType = 4 Case IsBool($vValue) $DataType = 3 Case IsPtr($vValue) $DataType = 2 Case IsKeyword($vValue) ;Default Keyword $DataType = 1 EndSelect Select Case $DataType = 0 Return SetError(2,0,False) Case $RowIndex <= $RowsCount if DllStructGetData($CArray1D,2,$RowIndex) > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$RowIndex)) DllStructSetData($CArray1D,2,$DataType,$RowIndex) DllStructSetData($CArray1D,3,$vValue,$RowIndex) Return True Case $RowIndex > $RowsCount ;----------------ReDim--------------------------------- Local $NewCArray1D = DllStructCreate("INT RE;BYTE DATATYPE[" & $RowIndex & "];DOUBLE ELEMENTS[" & $RowIndex & "]") Local $DataTypePtr = DllStructGetPtr( $CArray1D , 2 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray1D,2) Local $ElementsPtr = DllStructGetPtr( $CArray1D , 3 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray1D,3) Local $SizeA = $DoubleSize * $RowsCount Local $SizeB = $RowsCount;($ByteSize * $RowsCount) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeB) DllStructSetData($NewCArray1D,1,$RowIndex) ;----------------ReDim--------------------------------- $CArray1D = $NewCArray1D DllStructSetData($CArray1D,2,$DataType,$RowIndex) DllStructSetData($CArray1D,3,$vValue,$RowIndex) Return True EndSelect EndFunc Func Add1D(ByRef $CArray1D,$vValue,$End = True) Local $iRowsCount = DllStructGetData($CArray1D , 1 ) Local $NRowsCount = $iRowsCount + 1 ,$DataType = 0 Select Case IsString($vValue) Switch $UNICODE Case True $LPVOID = DllCall($OleAut32,"PTR","SysAllocString","WSTR",$vValue) $DataType = 8 $vValue = $LPVOID[0] Case False $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","STR",$vValue,"UINT",StringLen($vValue)) $DataType = 7 $vValue = $LPVOID[0] EndSwitch Case IsBinary($vValue) Local $BinaryLen = BinaryLen($vValue) $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","PTR",0,"UINT",$BinaryLen) $LPVOID = $LPVOID[0] DllStructSetData(DllStructCreate("BYTE[" & $BinaryLen & "]",$LPVOID),1,$vValue) $DataType = 6 $vValue = $LPVOID Case IsInt($vValue) $DataType = 5 Case IsFloat($vValue) $DataType = 4 Case IsBool($vValue) $DataType = 3 Case IsPtr($vValue) $DataType = 2 Case IsKeyword($vValue) ;Default Keyword $DataType = 1 EndSelect Select Case $DataType = 0 Return SetError(1,0,False) Case $End = True And $iRowsCount > 0 Local $NewCArray1D = DllStructCreate("INT RE;BYTE DATATYPE[" & $NRowsCount & "];DOUBLE ELEMENTS[" & $NRowsCount & "]") Local $DataTypePtr = DllStructGetPtr( $CArray1D , 2 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray1D,2) Local $ElementsPtr = DllStructGetPtr( $CArray1D , 3 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray1D,3) Local $SizeA = $DoubleSize * $iRowsCount Local $SizeB = $iRowsCount ;($ByteSize * $iRowsCount) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeB) DllStructSetData($NewCArray1D,1,$NRowsCount) DllStructSetData($NewCArray1D,2,$DataType,$NRowsCount) DllStructSetData($NewCArray1D,3,$vValue,$NRowsCount) $CArray1D = $NewCArray1D Return True Case $End = False And $iRowsCount > 0 Local $NewCArray1D = DllStructCreate("INT RE;BYTE DATATYPE[" & $NRowsCount & "];DOUBLE ELEMENTS[" & $NRowsCount & "]") Local $DataTypePtr = DllStructGetPtr( $CArray1D , 2 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray1D,2) Local $ElementsPtr = DllStructGetPtr( $CArray1D , 3 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray1D,3) Local $SizeA = $DoubleSize * $iRowsCount Local $SizeB = $iRowsCount ;($ByteSize * $iRowsCount) Local $SizeC = $DoubleSize ;($DoubleSize * 1) Local $SizeD = $ByteSize ;($ByteSize * 1) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr + $SizeC,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr + $SizeD,"PTR",$DataTypePtr,"ULONG_PTR",$SizeB) DllStructSetData($NewCArray1D,1,$NRowsCount) DllStructSetData($NewCArray1D,2,$DataType,1) DllStructSetData($NewCArray1D,3,$vValue,1) $CArray1D = $NewCArray1D Return True EndSelect if ($DataType > 5) Then DllCall($OleAut32,"NONE","SysFreeString","PTR",$vValue) Return SetError(2,0,False) EndFunc Func InsertAt1D(ByRef $CArray1D,$RowIndex,$vValue) Local $iRowsCount = DllStructGetData($CArray1D,1),$NRowIndex = ($RowIndex + 1) Local $NRowsCount = $iRowsCount + 1 , $DataType = 0 Select Case IsString($vValue) Switch $UNICODE Case True $LPVOID = DllCall($OleAut32,"PTR","SysAllocString","WSTR",$vValue) $DataType = 8 $vValue = $LPVOID[0] Case False $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","STR",$vValue,"UINT",StringLen($vValue)) $DataType = 7 $vValue = $LPVOID[0] EndSwitch Case IsBinary($vValue) Local $BinaryLen = BinaryLen($vValue) $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","PTR",0,"UINT",$BinaryLen) $LPVOID = $LPVOID[0] DllStructSetData(DllStructCreate("BYTE[" & $BinaryLen & "]",$LPVOID),1,$vValue) $DataType = 6 $vValue = $LPVOID Case IsInt($vValue) $DataType = 5 Case IsFloat($vValue) $DataType = 4 Case IsBool($vValue) $DataType = 3 Case IsPtr($vValue) $DataType = 2 Case IsKeyword($vValue) ;Default Keyword $DataType = 1 EndSelect Select Case $DataType = 0 Return SetError(1,0,False) Case $iRowsCount > 0 And $NRowIndex > 0 And $NRowIndex <= $iRowsCount Local $NewCArray1D = DllStructCreate("INT RE;BYTE DATATYPE[" & $NRowsCount & "];DOUBLE ELEMENTS[" & $NRowsCount & "]") Local $DataTypePtr = DllStructGetPtr( $CArray1D , 2 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray1D,2) Local $ElementsPtr = DllStructGetPtr( $CArray1D , 3 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray1D,3) Local $SizeA = $DoubleSize * $RowIndex DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) Local $SizeB = $DoubleSize * $NRowIndex Local $SizeC = $DoubleSize * $RowIndex Local $SizeD = $DoubleSize * ($iRowsCount - $RowIndex) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr + $SizeB,"PTR",$ElementsPtr + $SizeC,"ULONG_PTR",$SizeD) Local $SizeE = $RowIndex;($ByteSize * ($RowIndex)) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeE) Local $SizeF = $NRowIndex;($ByteSize * $NRowIndex) Local $SizeG = $RowIndex;($ByteSize * $RowIndex ) Local $SizeH = $iRowsCount - $RowIndex;($ByteSize * ($iRowsCount - $RowIndex)) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr + $SizeF,"PTR",$DataTypePtr + $SizeG,"ULONG_PTR",$SizeH) DllStructSetData($NewCArray1D,1,$NRowsCount) DllStructSetData($NewCArray1D,2,$DataType,$NRowIndex) DllStructSetData($NewCArray1D,3,$vValue,$NRowIndex) $CArray1D = $NewCArray1D Return True EndSelect if ($DataType > 5) Then DllCall($OleAut32,"NONE","SysFreeString","PTR",$vValue) Return SetError(2,0,False) EndFunc Func DeleteAt1D(ByRef $CArray1D,$RowIndex) Local $iRowsCount = DllStructGetData($CArray1D,1) if $RowIndex < 0 Or $RowIndex > $iRowsCount - 1 _ Or $iRowsCount = 0 Then Return SetError(1,0,False) Local $nRowsCount = $iRowsCount - 1 Local $NewCArray1D = DllStructCreate("INT RE;BYTE DATATYPE[" & $nRowsCount & "];DOUBLE ELEMENTS[" & $nRowsCount & "]") Local $DataTypePtr = DllStructGetPtr( $CArray1D , 2 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray1D,2) Local $ElementsPtr = DllStructGetPtr( $CArray1D , 3 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray1D,3) Local $SizeA = $DoubleSize * $RowIndex DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) Local $SizeB = $DoubleSize * ($iRowsCount - ($RowIndex + 1)) Local $SizeC = $DoubleSize * $RowIndex Local $SizeD = $DoubleSize * ($RowIndex + 1) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr + $SizeC,"PTR",$ElementsPtr + $SizeD,"ULONG_PTR",$SizeB) Local $SizeE = $RowIndex;($ByteSize * $RowIndex) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeE) Local $SizeF = $iRowsCount - ($RowIndex + 1);($ByteSize * ($iRowsCount - ($RowIndex + 1))) Local $SizeG = $RowIndex;($ByteSize * $RowIndex) Local $SizeH = $RowIndex + 1;($ByteSize * ($RowIndex - 1)) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr + $SizeG,"PTR",$DataTypePtr + $SizeH,"ULONG_PTR" ,$SizeF) DllStructSetData($NewCArray1D,1,$nRowsCount) $RowIndex += 1 if (DllStructGetData($CArray1D,2,$RowIndex) > 5) Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$RowIndex)) $CArray1D = $NewCArray1D Return True EndFunc Func FreeCArray1D(ByRef $CArray1D) Local $iRowsCount = DllStructGetData($CArray1D,"RE") if ($iRowsCount = 0) Then Return SetError(1,0,False) ;If Failure For $i = 1 To $iRowsCount If DllStructGetData($CArray1D,2,$i) > 5 Then _ ; Null Value = 0 // 6 and 7 and 8 String Ptr And Binary Ptr DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$i)) Next $CArray1D = CArray1D($iRowsCount) Return True EndFunc Func DeleteCArray1D(ByRef $CArray1D) Local $iRowsCount = DllStructGetData($CArray1D,"RE") if ($iRowsCount = 0) Then Return SetError(1,0,False) ;If Failure For $i = 1 To $iRowsCount If DllStructGetData($CArray1D,2,$i) > 5 Then _ ; Null Value = 0 // 6 and 7 and 8 String Ptr And Binary Ptr DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray1D,3,$i)) Next $CArray1D = 0 Return True EndFunc Func CArray2D($RowsCount,$ColusCount) Select Case $RowsCount < 1 Or $ColusCount < 1 Return SetError(1,0,0) Case Else Local $ElementsCount = $RowsCount * $ColusCount Local $CArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") DllStructSetData($CArray2D,1,$RowsCount) DllStructSetData($CArray2D,2,$ColusCount) Return $CArray2D EndSelect EndFunc Func UBound2D(ByRef $CArray2D , $Dimension = 1) Switch $Dimension Case 1 $RE = DllStructGetData($CArray2D,"RE") if ($RE = 0) Then Return SetError(1,0,0) Return $RE Case 2 $CE = DllStructGetData($CArray2D,"CE") if ($CE = 0) Then Return SetError(1,0,0) Return $CE Case Else Return SetError(2,0,0) EndSwitch EndFunc Func ReDim2D(ByRef $CArray2D,$RowsCount,$ColusCount) Local $iRowsCount = DllStructGetData($CArray2D,"RE") Local $iColusCount= DllStructGetData($CArray2D,"CE") Select Case $iRowsCount < 1 Or $RowsCount < 1 _ Or $iColusCount < 1 Or $iColusCount < 1 Return SetError(1,0,False) Case $ColusCount = $iColusCount And $RowsCount > $iRowsCount Local $ElementsCount = $RowsCount * $ColusCount Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $SizeA = $DoubleSize * $ColusCount * $iRowsCount Local $SizeB = $ColusCount * $iRowsCount;( $ByteSize * ($ColusCount * $iRowsCount) ) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeB) DllStructSetData($NewCArray2D,1,$RowsCount) DllStructSetData($NewCArray2D,2,$ColusCount) $CArray2D = $NewCArray2D Return True Case $ColusCount = $iColusCount And $RowsCount < $iRowsCount Local $ElementsCount = $RowsCount * $ColusCount Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $SizeA = $DoubleSize * $ColusCount * $RowsCount Local $SizeB = $ColusCount * $RowsCount;( $ByteSize * ($ColusCount * $RowsCount) ) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeB) For $i = $RowsCount + 1 To $iRowsCount For $j = 1 To $iColusCount $ElementNu = ($i * $iColusCount) - ($iColusCount - $j) If (DllStructGetData($CArray2D,3,$ElementNu) > 5) Then _ ;Null Value = 0 // 6 and 7 and 8 String Ptr And Binary Ptr DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) Next Next DllStructSetData($NewCArray2D,1,$RowsCount) DllStructSetData($NewCArray2D,2,$ColusCount) $CArray2D = $NewCArray2D Return True Case ($ColusCount > $iColusCount And $RowsCount >= $iRowsCount) Local $ElementsCount = $RowsCount * $ColusCount Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $RowSizeA = $ColusCount * $DoubleSize Local $RowSizeB = $iColusCount * $DoubleSize Local $RowSizeC = $ColusCount ;* $ByteSize ) Local $RowSizeD = $iColusCount ;* $ByteSize ) For $i = 1 To $iRowsCount DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$RowSizeB) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$RowSizeD) $NewElementsPtr += $RowSizeA $ElementsPtr += $RowSizeB $NewDataTypePtr += $RowSizeC $DataTypePtr += $RowSizeD Next DllStructSetData($NewCArray2D,1,$RowsCount) DllStructSetData($NewCArray2D,2,$ColusCount) $CArray2D = $NewCArray2D Return True Case $ColusCount = $iColusCount And $RowsCount = $iRowsCount Return True Case Else Local $pRowsCount = $iRowsCount , $pColusCount = $iColusCount If $RowsCount < $iRowsCount Then $pRowsCount = $RowsCount If $ColusCount < $iColusCount Then $pColusCount = $ColusCount Local $ElementsCount = $RowsCount * $ColusCount Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $RowSizeA = $ColusCount * $DoubleSize Local $RowSizeB = $iColusCount * $DoubleSize Local $RowSizeC = $pColusCount * $DoubleSize Local $RowSizeD = $ColusCount ;* $ByteSize Local $RowSizeE = $iColusCount ;* $ByteSize Local $RowSizeF = $pColusCount ;* $ByteSize For $i = 1 To $iRowsCount Select Case $i <= $pRowsCount DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$RowSizeC) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$RowSizeF) $NewElementsPtr += $RowSizeA $ElementsPtr += $RowSizeB $NewDataTypePtr += $RowSizeD $DataTypePtr += $RowSizeE For $j = ($pColusCount + 1) To $iColusCount $ElementNu = ($i * $iColusCount) - ($iColusCount - $j) If (DllStructGetData($CArray2D,3,$ElementNu) > 5) Then _ ;Null Value = 0 // 6 and 7 and 8 String Ptr And Binary Ptr DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) Next Case Else For $j = 1 To $iColusCount $ElementNu = ($i * $iColusCount) - ($iColusCount - $j) If (DllStructGetData($CArray2D,3,$ElementNu) > 5) Then _ ;Null Value = 0 // 6 and 7 and 8 String Ptr And Binary Ptr DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) Next EndSelect Next DllStructSetData($NewCArray2D,1,$RowsCount) DllStructSetData($NewCArray2D,2,$ColusCount) $CArray2D = $NewCArray2D Return True EndSelect EndFunc Func GetAt2D(ByRef $CArray2D,$RowIndex,$ColuIndex) Local $RowsCount = DllStructGetData($CArray2D,"RE") Local $ColusCount = DllStructGetData($CArray2D,"CE") $RowIndex += 1 $ColuIndex += 1 Local $ElementNu = ($RowIndex * $ColusCount) - ($ColusCount - $ColuIndex) Local $DataType = DllStructGetData( $CArray2D , 3 , $ElementNu ) Select Case $RowIndex < 1 Or $RowIndex > $RowsCount Or $ColuIndex < 1 _ Or $ColuIndex > $ColusCount Or $RowsCount < 1 Or $ColusCount < 1 Return SetError(1,0,"") Case $DataType = 8 $LPVOID = DllStructGetData($CArray2D,4,$ElementNu) $String = DllCall($Msvcrt,"WSTR:CDECL","wcscpy","PTR",$LPVOID,"PTR",$LPVOID) Return $String[0] Case $DataType = 7 $LPVOID = DllStructGetData($CArray2D,4,$ElementNu) $String = DllCall($Msvcrt , "STR:CDECL" ,"strcpy","PTR",$LPVOID,"PTR",$LPVOID) Return $String[0] Case $DataType = 6 $LPVOID = DllStructGetData($CArray2D,4,$ElementNu) $BinaryLen = DllCall($OleAut32,"UINT","SysStringByteLen","PTR",$LPVOID) Switch $BinaryToStruct Case True Return DllStructCreate("BYTE Binary[" & $BinaryLen[0] & "]",$LPVOID) Case False Return DllStructGetData(DllStructCreate("BYTE Binary[" & $BinaryLen[0] & "]",$LPVOID),1) EndSwitch Case $DataType = 5 Return DllStructGetData($CArray2D,4,$ElementNu) Case $DataType = 4 Return DllStructGetData($CArray2D,4,$ElementNu) Case $DataType = 3 Return DllStructGetData($CArray2D,4,$ElementNu) <> 0 Case $DataType = 2 Return Ptr(DllStructGetData($CArray2D,4,$ElementNu)) Case $DataType = 1 Return Default EndSelect Return "" ; Null Values EndFunc Func SetAt2D(ByRef $CArray2D,$RowIndex,$ColuIndex,$vValue) Local $RowsCount = DllStructGetData($CArray2D,1) Local $ColusCount = DllStructGetData($CArray2D,2) $RowIndex += 1 $ColuIndex += 1 Local $ElementNu = ($RowIndex * $ColusCount) - ($ColusCount - $ColuIndex) Local $DataType = DllStructGetData($CArray2D,3,$ElementNu) Select Case $RowIndex < 1 Or $RowIndex > $RowsCount Or $ColuIndex < 1 _ Or $ColuIndex > $ColusCount Or $RowsCount < 1 Or $ColusCount < 1 Return SetError(1,0,False) Case IsString($vValue) Switch $UNICODE Case True if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) $LPVOID = DllCall($OleAut32,"PTR","SysAllocString","WSTR",$vValue) DllStructSetData($CArray2D,3,8,$ElementNu) DllStructSetData($CArray2D,4,$LPVOID[0],$ElementNu) Return True Case False if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","STR",$vValue,"UINT",StringLen($vValue)) DllStructSetData($CArray2D,3,7,$ElementNu) DllStructSetData($CArray2D,4,$LPVOID[0],$ElementNu) Return True EndSwitch Case IsBinary($vValue) Local $BinaryLen = BinaryLen($vValue) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","PTR",0,"UINT",$BinaryLen) $LPVOID = $LPVOID[0] DllStructSetData(DllStructCreate("BYTE[" & $BinaryLen & "]",$LPVOID),1,$vValue) DllStructSetData($CArray2D,3,6,$ElementNu) DllStructSetData($CArray2D,4,$LPVOID,$ElementNu) Return True Case IsInt($vValue) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) DllStructSetData($CArray2D,3,5,$ElementNu) DllStructSetData($CArray2D,4,$vValue,$ElementNu) Return True Case IsFloat($vValue) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) DllStructSetData($CArray2D,3,4,$ElementNu) DllStructSetData($CArray2D,4,$vValue,$ElementNu) Return True Case IsBool($vValue) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) DllStructSetData($CArray2D,3,3,$ElementNu) DllStructSetData($CArray2D,4,$vValue,$ElementNu) Return True Case IsPtr($vValue) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) DllStructSetData($CArray2D,3,2,$ElementNu) DllStructSetData($CArray2D,4,$vValue,$ElementNu) Return True Case IsKeyword($vValue) if $DataType > 5 Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) ;Default Keyword DllStructSetData($CArray2D,3,1,$ElementNu) Return True EndSelect Return SetError(2,0,False) EndFunc Func SetWithReDim2D(ByRef $CArray2D,$RowIndex,$ColuIndex,$vValue) Local $DataType = 0 Local $RowsCount = DllStructGetData($CArray2D,"RE") Local $ColusCount = DllStructGetData($CArray2D,"CE") $RowIndex += 1 $ColuIndex += 1 Select Case $RowIndex < 1 Or $ColuIndex < 1 Or $RowsCount < 1 Or $ColusCount < 1 Return SetError(1,0,False) Case IsString($vValue) Switch $UNICODE Case True $LPVOID = DllCall($OleAut32,"PTR","SysAllocString","WSTR",$vValue) $DataType = 8 $vValue = $LPVOID[0] Case False $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","STR",$vValue,"UINT",StringLen($vValue)) $DataType = 7 $vValue = $LPVOID[0] EndSwitch Case IsBinary($vValue) Local $BinaryLen = BinaryLen($vValue) $LPVOID = DllCall($OleAut32,"PTR","SysAllocStringByteLen","PTR",0,"UINT",$BinaryLen) $LPVOID = $LPVOID[0] DllStructSetData(DllStructCreate("BYTE[" & $BinaryLen & "]",$LPVOID),1,$vValue) $DataType = 6 $vValue = $LPVOID Case IsInt($vValue) $DataType = 5 Case IsFloat($vValue) $DataType = 4 Case IsBool($vValue) $DataType = 3 Case IsPtr($vValue) $DataType = 2 Case IsKeyword($vValue) ;Default Keyword $DataType = 1 EndSelect Select Case $DataType = 0 Return SetError(2,0,False) Case $RowIndex <= $RowsCount And $ColuIndex <= $ColusCount Local $ElementNu = ($RowIndex * $ColusCount) - ($ColusCount - $ColuIndex) if (DllStructGetData($CArray2D,3,$ElementNu) > 5) Then _ DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) DllStructSetData($CArray2D,3,$DataType,$ElementNu) DllStructSetData($CArray2D,4,$vValue,$ElementNu) Return True Case $ColuIndex = $ColusCount And $RowIndex > $RowsCount ;-------------------------------------------ReDim--------------------------------------------------------- Local $ElementsCount = $RowIndex * $ColuIndex Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $SizeA = $DoubleSize * $ColuIndex * $RowsCount Local $SizeB = $ColuIndex * $RowsCount;( $ByteSize * ($ColuIndex * $RowsCount) ) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeB) DllStructSetData($NewCArray2D,1,$RowIndex) DllStructSetData($NewCArray2D,2,$ColuIndex) ;-------------------------------------------ReDim--------------------------------------------------------- Local $ElementNu = ($RowIndex * $ColuIndex) DllStructSetData($NewCArray2D,3,$DataType,$ElementNu) DllStructSetData($NewCArray2D,4,$vValue,$ElementNu) $CArray2D = $NewCArray2D Return True Case Else ; $ColuIndex > $ColusCount And $RowIndex > $RowsCount or $ColuIndex > $ColusCount And $RowIndex = $RowsCount ;-------------------------------------------ReDim--------------------------------------------------------- Local $pRowsCount = $RowsCount ,$pColusCount = $ColusCount If $RowIndex > $RowsCount Then $pRowsCount = $RowIndex If $ColuIndex > $ColusCount Then $pColusCount = $ColuIndex Local $ElementsCount = $pRowsCount * $pColusCount Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $RowSizeA = $ColusCount * $DoubleSize Local $RowSizeB = $ColusCount ;* $ByteSize Local $RowSizeC = $ColusCount * $DoubleSize Local $RowSizeD = $ColusCount ;* $ByteSize Local $RowSizeE = $pColusCount * $DoubleSize Local $RowSizeF = $pColusCount ;* $ByteSize For $i = 1 To $RowsCount DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$RowSizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$RowSizeB) $ElementsPtr += $RowSizeC $DataTypePtr += $RowSizeD $NewElementsPtr += $RowSizeE $NewDataTypePtr += $RowSizeF Next DllStructSetData($NewCArray2D,1,$pRowsCount) DllStructSetData($NewCArray2D,2,$pColusCount) ;-------------------------------------------ReDim--------------------------------------------------------- $ElementNu = ($RowIndex * $pColusCount) - ($pColusCount - $ColuIndex) DllStructSetData($NewCArray2D,3,$DataType,$ElementNu) DllStructSetData($NewCArray2D,4,$vValue,$ElementNu) $CArray2D = $NewCArray2D Return True EndSelect EndFunc Func Add2D(ByRef $CArray2D,$RowsCount = 1,$RowsEnd = True,$ColsCount = 0,$ColsEnd = True) Local $iRowsCount = DllStructGetData($CArray2D,"RE") Local $iColusCount= DllStructGetData($CArray2D,"CE") Local $vIndex = 0 Select Case $RowsCount < 0 Or $ColsCount < 0 Or $iRowsCount < 1 Or $iColusCount < 1 Return SetError(1,0,False) Case $ColsCount = 0 And $RowsCount = 0 Return True Case $ColsCount = 0 Local $NewRowsCount = $iRowsCount + $RowsCount Local $ElementsCount = $NewRowsCount * $iColusCount Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $SizeA = $DoubleSize * $iColusCount * $iRowsCount Local $SizeB = $iColusCount * $iRowsCount;( $ByteSize * ($iColusCount * $iRowsCount) ) Local $SizeC = $DoubleSize * $iColusCount * $RowsCount Local $SizeD = $iColusCount * $RowsCount;( $ByteSize * ($iColusCount * $RowsCount) ) Select Case $RowsEnd = True DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeB) Case $RowsEnd = False DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr + $SizeC,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr + $SizeD,"PTR",$DataTypePtr,"ULONG_PTR",$SizeB) EndSelect DllStructSetData($NewCArray2D,1,$NewRowsCount) DllStructSetData($NewCArray2D,2,$iColusCount) $CArray2D = $NewCArray2D Return True Case Else Local $NewRowsCount = $iRowsCount + $RowsCount Local $NewColsCount = $iColusCount + $ColsCount Local $ElementsCount = $NewRowsCount * ($NewColsCount) Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $SizeA = $DoubleSize * $iColusCount Local $SizeB = $DoubleSize * $NewColsCount Local $SizeC = $DoubleSize * $ColsCount Local $SizeD = $iColusCount;$ByteSize * $iColusCount Local $SizeE = $NewColsCount;$ByteSize * $NewColsCount Local $SizeF = $ColsCount ;$ByteSize * $ColsCount Local $SizeG = $DoubleSize * $NewColsCount * $RowsCount Local $SizeH = $NewColsCount * $RowsCount;$ByteSize * $NewColsCount * $RowsCount Select Case $RowsEnd = True And $ColsEnd = True For $i = 1 To $iRowsCount DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeD) $ElementsPtr += $SizeA $DataTypePtr += $SizeD $NewElementsPtr += $SizeB $NewDataTypePtr += $SizeE Next Case $RowsEnd = True And $ColsEnd = False For $i = 1 To $iRowsCount DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr + $SizeC,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr + $SizeF,"PTR",$DataTypePtr,"ULONG_PTR",$SizeD) $ElementsPtr += $SizeA $DataTypePtr += $SizeD $NewElementsPtr += $SizeB $NewDataTypePtr += $SizeE Next Case $RowsEnd = False And $ColsEnd = True $NewElementsPtr += $SizeG $NewDataTypePtr += $SizeH For $i = 1 To $iRowsCount DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeD) $ElementsPtr += $SizeA $DataTypePtr += $SizeD $NewElementsPtr += $SizeB $NewDataTypePtr += $SizeE Next Case $RowsEnd = False And $ColsEnd = False $NewElementsPtr += $SizeG $NewDataTypePtr += $SizeH For $i = 1 To $iRowsCount DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr + $SizeC,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr + $SizeF,"PTR",$DataTypePtr,"ULONG_PTR",$SizeD) $ElementsPtr += $SizeA $DataTypePtr += $SizeD $NewElementsPtr += $SizeB $NewDataTypePtr += $SizeE Next EndSelect DllStructSetData($NewCArray2D,1,$NewRowsCount) DllStructSetData($NewCArray2D,2,$NewColsCount) $CArray2D = $NewCArray2D Return True EndSelect EndFunc Func Insert2D(ByRef $CArray2D,$RowIndex = 0,$RowsCount = 1,$ColuIndex = 0,$ColsCount = 0) Local $iRowsCount = DllStructGetData($CArray2D,"RE") Local $iColusCount= DllStructGetData($CArray2D,"CE") Select Case $RowsCount < 0 Or $ColsCount < 0 Or $iRowsCount < 1 Or $iColusCount < 1 Or $RowIndex < 0 _ Or $ColuIndex < 0 Or $RowIndex > ($iRowsCount -1) Or $ColuIndex > ($iColusCount -1) Return SetError(1,0,False) Case $ColsCount = 0 And $RowsCount = 0 Return True Case $ColsCount = 0 Local $NewRowsCount = $iRowsCount + $RowsCount Local $ElementsCount = $NewRowsCount * $iColusCount Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $SizeA = $DoubleSize * $RowIndex * $iColusCount Local $SizeB = $DoubleSize * ($iRowsCount - $RowIndex) * $iColusCount Local $SizeC = $DoubleSize * $RowsCount * $iColusCount + $SizeA Local $SizeD = $RowIndex * $iColusCount;$ByteSize * $RowIndex * $iColusCount Local $SizeE = ($iRowsCount - $RowIndex) * $iColusCount;$ByteSize * ($iRowsCount - $RowIndex) * $iColusCount Local $SizeF = ($RowsCount * $iColusCount) + $SizeD;($ByteSize * $RowsCount * $iColusCount) + $SizeD DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr + $SizeC,"PTR",$ElementsPtr + $SizeA,"ULONG_PTR",$SizeB) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeD) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr + $SizeF,"PTR",$DataTypePtr + $SizeD,"ULONG_PTR",$SizeE) DllStructSetData($NewCArray2D,1,$NewRowsCount) DllStructSetData($NewCArray2D,2,$iColusCount) $CArray2D = $NewCArray2D Return True Case Else Local $NewRowsCount = $iRowsCount + $RowsCount Local $NewColsCount = $iColusCount + $ColsCount Local $ElementsCount = $NewRowsCount * $NewColsCount Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $SizeA = $DoubleSize * $ColuIndex Local $SizeB = $DoubleSize * ($iColusCount - $ColuIndex) Local $SizeC = $DoubleSize * $ColsCount Local $SizeD = $DoubleSize * $NewColsCount Local $SizeE = $DoubleSize * $iColusCount Local $SizeF = $DoubleSize * $RowsCount * $NewColsCount Local $SizeG = $ColuIndex;$ByteSize * ColuIndex Local $SizeH = $iColusCount - $ColuIndex;$ByteSize * ($iColusCount - ColuIndex) Local $SizeI = $ColsCount;$ByteSize * $ColsCount Local $SizeJ = $NewColsCount;$ByteSize * $NewColsCount Local $SizeK = $iColusCount;$ByteSize * $iColusCount Local $SizeL = $RowsCount * $NewColsCount;$ByteSize * $RowsCount * $NewColsCount Local $SizeM = $SizeA + $SizeC Local $SizeN = $SizeG + $SizeI For $i = 1 To $RowIndex DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr + $SizeM,"PTR",$ElementsPtr + $SizeA,"ULONG_PTR",$SizeB) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeG) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr + $SizeN,"PTR",$DataTypePtr + $SizeG,"ULONG_PTR",$SizeH) $NewElementsPtr += $SizeD $ElementsPtr += $SizeE $NewDataTypePtr += $SizeJ $DataTypePtr += $SizeK Next $NewElementsPtr += $SizeF $NewDataTypePtr += $SizeL For $j = $RowIndex + 1 To $iRowsCount DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr + $SizeM,"PTR",$ElementsPtr + $SizeA,"ULONG_PTR",$SizeB) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeG) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr + $SizeN,"PTR",$DataTypePtr + $SizeG,"ULONG_PTR",$SizeH) $NewElementsPtr += $SizeD $ElementsPtr += $SizeE $NewDataTypePtr += $SizeJ $DataTypePtr += $SizeK Next DllStructSetData($NewCArray2D,1,$NewRowsCount) DllStructSetData($NewCArray2D,2,$NewColsCount) $CArray2D = $NewCArray2D Return True EndSelect EndFunc Func Delete2D(ByRef $CArray2D,$RowIndex = 0,$RowsCount = 1,$ColuIndex = 0,$ColsCount = 0) Local $iRowsCount = DllStructGetData($CArray2D,"RE") Local $iColusCount= DllStructGetData($CArray2D,"CE") Select Case $RowIndex < 0 Or $ColuIndex < 0 Or $RowsCount >= $iRowsCount - $RowIndex _ Or $ColsCount >= $iColusCount - $ColuIndex Or $RowsCount < 0 Or $ColsCount < 0 Return SetError(1,0,False) Case $ColsCount = 0 And $RowsCount = 0 Return True Case $ColsCount = 0 Local $NewRowsCount = $iRowsCount - $RowsCount Local $ElementsCount = $NewRowsCount * $iColusCount Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $SizeA = $DoubleSize * $RowIndex * $iColusCount Local $SizeB = $DoubleSize * ($iRowsCount - ($RowsCount + $RowIndex)) * $iColusCount Local $SizeC = $DoubleSize * $RowsCount * $iColusCount Local $SizeD = $SizeA + $SizeC Local $SizeE = $RowIndex * $iColusCount;$ByteSize * $RowIndex * $iColusCount Local $SizeF = ($iRowsCount - ($RowsCount + $RowIndex)) * $iColusCount;$ByteSize * ($iRowsCount - ($RowsCount + $RowIndex)) * $iColusCount Local $SizeG = $RowsCount * $iColusCount;$ByteSize * $RowsCount * $iColusCount Local $SizeH = $SizeE + $SizeG DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr + $SizeA,"PTR",$ElementsPtr + $SizeD,"ULONG_PTR",$SizeB) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeE) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr + $SizeE,"PTR",$DataTypePtr + $SizeH,"ULONG_PTR",$SizeF) For $i = $RowIndex + 1 To $RowIndex + $RowsCount For $j = 1 To $iColusCount $ElementNu = ($i * $iColusCount) - ($iColusCount - $j) If (DllStructGetData($CArray2D,3,$ElementNu) > 5) Then _ ;Null Value = 0 // 6 and 7 and 8 String Ptr And Binary Ptr DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) Next Next DllStructSetData($NewCArray2D,1,$NewRowsCount) DllStructSetData($NewCArray2D,2,$iColusCount) $CArray2D = $NewCArray2D Case Else $RowIndex += 1 Local $NewColusCount = $iColusCount - $ColsCount Local $NewRowsCount = $iRowsCount - $RowsCount Local $ElementsCount = $NewRowsCount * $NewColusCount Local $NewCArray2D = DllStructCreate("INT RE;INT CE;BYTE DATATYPE["&$ElementsCount&"];DOUBLE ELEMENTS["&$ElementsCount&"]") Local $DataTypePtr = DllStructGetPtr( $CArray2D , 3 ) Local $NewDataTypePtr = DllStructGetPtr($NewCArray2D,3) Local $ElementsPtr = DllStructGetPtr( $CArray2D , 4 ) Local $NewElementsPtr = DllStructGetPtr($NewCArray2D,4) Local $SizeA = $DoubleSize * $ColuIndex Local $SizeB = $DoubleSize * $ColsCount Local $SizeC = $DoubleSize * $iColusCount - ($SizeA + $SizeB) Local $SizeD = $SizeA + $SizeB Local $SizeE = $ColuIndex;$ByteSize * $ColuIndex Local $SizeF = $ColsCount;$ByteSize * $ColsCount Local $SizeG = $iColusCount - ($SizeE + $SizeF);($ByteSize * $iColusCount) - ($SizeE + $SizeF) Local $SizeH = $SizeE + $SizeF Local $SizeI = $DoubleSize * $iColusCount Local $Sizej = $DoubleSize * $NewColusCount Local $SizeK = $iColusCount;$ByteSize * $iColusCount Local $SizeL = $NewColusCount;$ByteSize * $NewColusCount Local $nLoop = $ColuIndex + 1 Local $vLoop = $ColuIndex + $ColsCount Local $vCase = $RowIndex + $RowsCount - 1 For $i = 1 To $iRowsCount Select Case $i < $RowIndex Or $i > $vCase DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr,"PTR",$ElementsPtr,"ULONG_PTR",$SizeA) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewElementsPtr + $SizeA,"PTR",$ElementsPtr + $SizeD,"ULONG_PTR",$SizeC) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr,"PTR",$DataTypePtr,"ULONG_PTR",$SizeE) DllCall($kernel32,"NONE","RtlMoveMemory","PTR",$NewDataTypePtr + $SizeE,"PTR",$DataTypePtr + $SizeH,"ULONG_PTR",$SizeG) $NewElementsPtr += $Sizej $NewDataTypePtr += $SizeL $ElementsPtr += $SizeI $DataTypePtr += $SizeK For $j = $nLoop To $vLoop $ElementNu = ($i * $iColusCount) - ($iColusCount - $j) If (DllStructGetData($CArray2D,3,$ElementNu) > 5) Then _ ;Null Value = 0 // 6 and 7 and 8 String Ptr And Binary Ptr DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) Next Case Else $ElementsPtr += $SizeI $DataTypePtr += $SizeK For $j = 1 To $iColusCount $ElementNu = ($i * $iColusCount) - ($iColusCount - $j) If (DllStructGetData($CArray2D,3,$ElementNu) > 5) Then _ ;Null Value = 0 // 6 and 7 and 8 String Ptr And Binary Ptr DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) Next EndSelect Next DllStructSetData($NewCArray2D,1,$NewRowsCount) DllStructSetData($NewCArray2D,2,$NewColusCount) $CArray2D = $NewCArray2D Return True EndSelect EndFunc Func FreeCArray2D(ByRef $CArray2D) Local $ElementNu Local $RowsCount = DllStructGetData($CArray2D,"RE") Local $ColusCount = DllStructGetData($CArray2D,"CE") if ($RowsCount = 0 Or $ColusCount = 0) Then Return SetError(1,0,False) ;If DllStructGetData Failure For $i = 1 To $RowsCount For $j = 1 To $ColusCount $ElementNu = ($i * $ColusCount) - ($ColusCount - $j) If (DllStructGetData($CArray2D,3,$ElementNu) > 5) Then _ ; Null Value = 0 // 6 and 7 and 8 String Ptr And Binary Ptr DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) Next Next $CArray2D = CArray2D($RowsCount,$ColusCount) Return True EndFunc Func DeleteCArray2D(ByRef $CArray2D) Local $ElementNu Local $RowsCount = DllStructGetData($CArray2D,"RE") Local $ColusCount = DllStructGetData($CArray2D,"CE") if ($RowsCount = 0 Or $ColusCount = 0) Then Return SetError(1,0,False) ;If DllStructGetData Failure For $i = 1 To $RowsCount For $j = 1 To $ColusCount $ElementNu = ($i * $ColusCount) - ($ColusCount - $j) If (DllStructGetData($CArray2D,3,$ElementNu) > 5) Then _ ; Null Value = 0 // 6 and 7 and 8 String Ptr And Binary Ptr DllCall($OleAut32,"NONE","SysFreeString","PTR",DllStructGetData($CArray2D,4,$ElementNu)) Next Next $CArray2D = 0 Return True EndFunc Func Display(ByRef $CArrayStruct,$Title = "DisplayCArray") $TrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]") ;Taskbar Window $WPos = WinGetPos($TrayWnd) If Not IsArray($WPos) Then $iH = @DesktopHeight - 68 Else $iH = $WPos[1] - 30 EndIf $RE = DllStructGetData($CArrayStruct,"RE") $CE = DllStructGetData($CArrayStruct,"CE") Local $Error = @error , $Value = "" if $Error Then $CE = 1 $W = (($CE + 1) * 70) + 15 ; $CE + 1 ==> 1 Rows Number $H = (($RE + 1) * 20) + 50 ; $RE + 1 ==> 1 Clos Number If $W > (@DesktopWidth - 5) Then $W = @DesktopWidth - 5 If $H > $iH Then $H = $iH GUICreate($Title,$W,$H,0,0) $W -= 10 $H -= 40 $hListView = GUICtrlCreateListView("",5,5,$W,$H) _GUICtrlListView_SetExtendedListViewStyle($hListView, _ BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES,$LVS_EX_FLATSB)) $CopyButton = GUICtrlCreateButton("Copy Selected", 5,$H + 10, $W - 5, 25) For $i = 0 To $RE - 1 For $j = 0 To $CE - 1 if ($Error) Then $Value = GetAt1D($CArrayStruct,$i) Else $Value = GetAt2D($CArrayStruct,$i,$j) EndIf If $i = 0 Then If $J = 0 Then _ _GUICtrlListView_AddColumn($hListView, "Row",70) _GUICtrlListView_AddColumn($hListView, "Col " & $J,70) EndIf If $j = 0 Then _GUICtrlListView_AddItem($hListView,"",$i) _GUICtrlListView_AddSubItem($hListView,$i, "[" & $i & "]",$j) _GUICtrlListView_AddSubItem($hListView,$i,$Value,$j + 1) Else _GUICtrlListView_AddSubItem($hListView,$i,$Value,$j + 1) EndIf Next Next GUISetState() Do $msg = GUIGetMsg() If $msg = $CopyButton Then $selectionmark = _GUICtrlListView_GetSelectionMark($hListView) ClipPut(_GUICtrlListView_GetItemTextString($hListView,$selectionmark)) EndIf Until $msg = $GUI_EVENT_CLOSE GUIDelete() EndFunc SpeedTest_1D.au3 #include <Array.au3> #include "CArray.au3" $hTimer1 = TimerInit() Dim $nArray[1] For $i = 1 To 10000 ReDim $nArray[$i] Next $fDiff1 = TimerDiff($hTimer1) $hTimer2 = TimerInit() $vArray1D = CArray1D(1) For $i = 1 To 10000 ReDim1D($vArray1D,$i) Next $fDiff2 = TimerDiff($hTimer2) MsgBox(0,"ReDim Time","Autoit Array ==> " & $fDiff1 & @CRLF & "CArray ==> " & $fDiff2) $hTimer1 = TimerInit() Dim $nArray[1] For $i = 1 To 1000 _ArrayAdd ($nArray,$i) Next $fDiff1 = TimerDiff($hTimer1) $hTimer2 = TimerInit() $vArray1D = CArray1D(1) For $i = 1 To 1000 Add1D($vArray1D,$i) Next $fDiff2 = TimerDiff($hTimer2) MsgBox(0,"Add Time","Autoit Array ==> " & $fDiff1 & @CRLF & "CArray ==> " & $fDiff2) $hTimer1 = TimerInit() Dim $nArray[1000] For $i = 1 To 500 _ArrayDelete($nArray,$i - 1) Next $fDiff1 = TimerDiff($hTimer1) $hTimer2 = TimerInit() $vArray1D = CArray1D(1000) For $i = 1 To 500 DeleteAt1D($vArray1D,$i - 1) Next $fDiff2 = TimerDiff($hTimer2) MsgBox(0,"Delete Time","Autoit Array ==> " & $fDiff1 & @CRLF & "CArray ==> " & $fDiff2) SpeedTest_2D.au3 #include <Array.au3> #include "CArray.au3" $hTimer1 = TimerInit() Dim $nArray[1][1] , $Max = 0 For $i = 1 To 100 For $j = 1 To 100 if $Max < $j Then ReDim $nArray[$i][$j] $Max += 1 Else ReDim $nArray[$i][$Max] EndIf Next Next $fDiff1 = TimerDiff($hTimer1) $hTimer2 = TimerInit() $Max = 0 $vArray2D = CArray2D(1,1) For $i = 1 To 100 For $j = 1 To 100 if $Max < $j Then ReDim2D($vArray2D,$i,$j) $Max += 1 Else ReDim2D($vArray2D,$i,$Max) EndIf Next Next $fDiff2 = TimerDiff($hTimer2) MsgBox(0,"ReDim Time","Autoit Array ==> " & $fDiff1 & @CRLF & "CArray ==> " & $fDiff2) $hTimer1 = TimerInit() Dim $nArray[1][1] , $Max = 0 For $i = 1 To 50 For $j = 1 To 50 if $Max < $j Then ReDim $nArray[$i][$j] $Max += 1 Else ReDim $nArray[$i][$Max] EndIf $nArray[$i - 1][$j - 1] = $i * $j Next Next $fDiff1 = TimerDiff($hTimer1) $hTimer2 = TimerInit() $vArray2D = CArray2D(1,1) For $i = 1 To 50 For $j = 1 To 50 SetWithReDim2D($vArray2D,$i - 1,$j - 1,$i * $j) Next Next $fDiff2 = TimerDiff($hTimer2) MsgBox(0,"SetWithReDim2D Time","Autoit Array ==> " & $fDiff1 & @CRLF & "CArray ==> " & $fDiff2) Examples Of 1D Array Add_1D.au3 #include "CArray.au3" $vArray1D = CArray1D(5) SetAt1D($vArray1D,0,"0") SetAt1D($vArray1D,1,"1") SetAt1D($vArray1D,2,"2") SetAt1D($vArray1D,3,"3") SetAt1D($vArray1D,4,"4") Display($vArray1D) $Rt = Add1D($vArray1D,"beginning",False) ;Add1D(ByRef $CArray1D,$vValue,$End = True) ;Add Value ==> beginning In The beginning // End ==> False $Rt = Add1D($vArray1D,"End") ;Add1D(ByRef $CArray1D,$vValue,$End = True) ;Add Value ==> End In The End // Default End ==> True Display($vArray1D,"Add") DeleteCArray1D($vArray1D) DeleteAt_1D.au3 #include "CArray.au3" $vArray1D = CArray1D(6) SetAt1D($vArray1D,0,"0") SetAt1D($vArray1D,1,"1") SetAt1D($vArray1D,2,"2") SetAt1D($vArray1D,3,"3") SetAt1D($vArray1D,4,"4") SetAt1D($vArray1D,5,"5") Display($vArray1D) $Rt = DeleteAt1D($vArray1D,4) ;DeleteAt1D(ByRef $CArray1D,$RowIndex) ;Delete The RowIndex 4 //RowIndex ==> 4 Display($vArray1D,"Delete The RowIndex 4") DeleteCArray1D($vArray1D) DeleteCArray1D.au3 #include "CArray.au3" $vArray1D = CArray1D(6) SetAt1D($vArray1D,0,"0") SetAt1D($vArray1D,1,"1") SetAt1D($vArray1D,2,"2") SetAt1D($vArray1D,3,"3") SetAt1D($vArray1D,4,"4") SetAt1D($vArray1D,5,"5") Display($vArray1D) DeleteCArray1D($vArray1D) MsgBox(0,"MSG",$vArray1D) FreeCArray1D.au3 #include "CArray.au3" $vArray1D = CArray1D(6) SetAt1D($vArray1D,0,"0") SetAt1D($vArray1D,1,"1") SetAt1D($vArray1D,2,"2") SetAt1D($vArray1D,3,"3") SetAt1D($vArray1D,4,"4") SetAt1D($vArray1D,5,"5") Display($vArray1D) FreeCArray1D($vArray1D) Display($vArray1D) InsertAt_1D.au3 #include "CArray.au3" $vArray1D = CArray1D(5) SetAt1D($vArray1D,0,"0") SetAt1D($vArray1D,1,"1") SetAt1D($vArray1D,2,"2") SetAt1D($vArray1D,3,"3") SetAt1D($vArray1D,4,"4") Display($vArray1D) $Rt = InsertAt1D($vArray1D,2,"NewValue1") ;InsertAt1D(ByRef $CArray1D,$RowIndex,$vValue) ;Insert Value ==> NewValue2 At The RowIndex 2 Display($vArray1D) $Rt = InsertAt1D($vArray1D,4,"NewValue2") ;InsertAt1D(ByRef $CArray1D,$RowIndex,$vValue) ;Insert Value ==> NewValue2 At The RowIndex 4 Display($vArray1D) DeleteCArray1D($vArray1D) SetGet1D.au3 #include "CArray.au3" $iArray1D = CArray1D(3) ; 3 ==> Rows Count For $i = 0 To 3 ; 0 To 3 ==> Over the Count of Rows $Rt = SetAt1D($iArray1D,$i,$i) if (@error Or $Rt = False) Then ; Test Errors MsgBox(0,"BOOL","false" & @CRLF & "$i ==> " & $i) Else MsgBox(0,"BOOL","true" & @CRLF & "$i ==> " & $i) EndIf ; i ==> Row Index And vValue Next Display($iArray1D) DeleteCArray1D($iArray1D) $vArray1D = CArray1D(3) SetAt1D($vArray1D,0,"0") SetAt1D($vArray1D,1,"1") SetAt1D($vArray1D,2,"2") For $i = 0 To 3 ; 0 To 3 ==> Over the Count of Rows $vValue = GetAt1D($vArray1D,$i) ;GetAt1D(ByRef $CArray1D,$RowIndex) GetAt i ==> Row Index ;Return ==> vValue if (@error <> 0) Then ; Test Errors MsgBox(0,"Error","@error ==> " & @error) Else MsgBox(0,"No Error","$vValue ==> " & $vValue) EndIf Next Display($vArray1D) DeleteCArray1D($vArray1D) $nArray1D = CArray1D(1) ; 1 ==> Rows Count For $i = 0 To 10 ;SetAtGrow1D(ByRef $CArray1D,$RowIndex,$vValue) $Rt = SetWithReDim1D($nArray1D,$i,$i) ; i ==> Row Index And vValue Next Display($nArray1D) DeleteCArray1D($nArray1D) UBoundReDim_1D.au3 #include "CArray.au3" $vArray1D = CArray1D(4) ; 4 ==> Rows Count SetAt1D($vArray1D,0,"0") SetAt1D($vArray1D,1,"1") SetAt1D($vArray1D,2,"2") SetAt1D($vArray1D,3,"3") Display($vArray1D) ReDim1D($vArray1D,1); // 1 ==> Rows Count Display($vArray1D) $RowsCount = UBound1D($vArray1D);Get Rows Count MsgBox(0,"UBound","RowsCount = " & $RowsCount,0); DeleteCArray1D($vArray1D) Examples Of 2D Array Add_2D.au3 #include "CArray.au3" $vArray2D = CArray2D(4,4) SetAt2D($vArray2D,0,0,"0|0") SetAt2D($vArray2D,0,1,"0|1") SetAt2D($vArray2D,0,2,"0|2") SetAt2D($vArray2D,0,3,"0|3") SetAt2D($vArray2D,1,0,"1|0") SetAt2D($vArray2D,1,1,"1|1") SetAt2D($vArray2D,1,2,"1|2") SetAt2D($vArray2D,1,3,"1|3") SetAt2D($vArray2D,2,0,"2|0") SetAt2D($vArray2D,2,1,"2|1") SetAt2D($vArray2D,2,2,"2|2") SetAt2D($vArray2D,2,3,"2|3") SetAt2D($vArray2D,3,0,"3|0") SetAt2D($vArray2D,3,1,"3|1") SetAt2D($vArray2D,3,2,"3|2") SetAt2D($vArray2D,3,3,"3|3") Display($vArray2D) $Rt = Add2D($vArray2D,2) ;Add2D(ByRef $CArray2D,$RowsCount = 1,$RowsEnd = True,$ColsCount = 0,$ColsEnd = True) ; Add 2 Rows In The End ; RowsCount = 2 ; RowsEnd ==> Default: true ; ;ColsCount = 0,ColsEnd = true Display($vArray2D) $Rt = Add2D($vArray2D,0,0,2) ;Add2D(ByRef $CArray2D,$RowsCount = 1,$RowsEnd = True,$ColsCount = 0,$ColsEnd = True) ; Add 2 Columns In The End ; ColsCount = 2 ; ColsEnd ==> Default: true ; ;RowsCount = 0,RowsEnd = 0 Display($vArray2D) $Rt = Add2D($vArray2D,2,false,2,false) ;Add2D(ByRef $CArray2D,$RowsCount = 1,$RowsEnd = True,$ColsCount = 0,$ColsEnd = True) ; Add 2 Rows And 2 Columns In The beginning ;RowsCount = 2 ; RowsEnd ==> false ;ColsCount = 2 ; ColsEnd ==> false Display($vArray2D) DeleteCArray2D($vArray2D) Delete_2D.au3 #include "CArray.au3" $vArray2D = CArray2D(6,6) SetAt2D($vArray2D,0,0,"0|0") SetAt2D($vArray2D,0,1,"0|1") SetAt2D($vArray2D,0,2,"0|2") SetAt2D($vArray2D,0,3,"0|3") SetAt2D($vArray2D,0,4,"0|4") SetAt2D($vArray2D,0,5,"0|5") SetAt2D($vArray2D,1,0,"1|0") SetAt2D($vArray2D,1,1,"1|1") SetAt2D($vArray2D,1,2,"1|2") SetAt2D($vArray2D,1,3,"1|3") SetAt2D($vArray2D,1,4,"1|4") SetAt2D($vArray2D,1,5,"1|5") SetAt2D($vArray2D,2,0,"2|0") SetAt2D($vArray2D,2,1,"2|1") SetAt2D($vArray2D,2,2,"2|2") SetAt2D($vArray2D,2,3,"2|3") SetAt2D($vArray2D,2,4,"2|4") SetAt2D($vArray2D,2,5,"2|5") SetAt2D($vArray2D,3,0,"3|0") SetAt2D($vArray2D,3,1,"3|1") SetAt2D($vArray2D,3,2,"3|2") SetAt2D($vArray2D,3,3,"3|3") SetAt2D($vArray2D,3,4,"3|4") SetAt2D($vArray2D,3,5,"3|5") SetAt2D($vArray2D,4,0,"4|0") SetAt2D($vArray2D,4,1,"4|1") SetAt2D($vArray2D,4,2,"4|2") SetAt2D($vArray2D,4,3,"4|3") SetAt2D($vArray2D,4,4,"4|4") SetAt2D($vArray2D,4,5,"4|5") SetAt2D($vArray2D,5,0,"5|0") SetAt2D($vArray2D,5,1,"5|1") SetAt2D($vArray2D,5,2,"5|2") SetAt2D($vArray2D,5,3,"5|3") SetAt2D($vArray2D,5,4,"5|4") SetAt2D($vArray2D,5,5,"5|5") Display($vArray2D) $Rt = Delete2D($vArray2D,1,2) ;Delete2D(ByRef $CArray2D,$RowIndex = 0,$RowsCount = 1,$ColuIndex = 0,$ColsCount = 0) ;Delete 2 Rows From The RowIndex 1 ; RowsCount = 2 ; RowIndex ==> 1 ; ;int ColuIndex = 0,int ColsCount = 0 Display($vArray2D) $Rt = Delete2D($vArray2D,0,0,1,2) ;Delete2D(ByRef $CArray2D,$RowIndex = 0,$RowsCount = 1,$ColuIndex = 0,$ColsCount = 0) ;Delete 2 Columns From The ColuIndex 1 ; ColsCount = 2 ; ColuIndex ==> 1 ;int RowIndex = 0,int RowsCount = 0 Display($vArray2D) $Rt = Delete2D($vArray2D,1,2,1,2) ;Delete2D(ByRef $CArray2D,$RowIndex = 0,$RowsCount = 1,$ColuIndex = 0,$ColsCount = 0) ;Delete 2 Rows And 2 Columns From The RowIndex 1 And From ColuIndex 1 ;RowsCount = 2 ; RowIndex ==> 1 ;ColsCount = 2 ; ColuIndex ==> 1 Display($vArray2D) DeleteCArray2D($vArray2D) DeleteCArray2D.au3 #include "CArray.au3" $vArray2D = CArray2D(6,6) SetAt2D($vArray2D,0,0,"0|0") SetAt2D($vArray2D,0,1,"0|1") SetAt2D($vArray2D,0,2,"0|2") SetAt2D($vArray2D,0,3,"0|3") SetAt2D($vArray2D,0,4,"0|4") SetAt2D($vArray2D,0,5,"0|5") SetAt2D($vArray2D,1,0,"1|0") SetAt2D($vArray2D,1,1,"1|1") SetAt2D($vArray2D,1,2,"1|2") SetAt2D($vArray2D,1,3,"1|3") SetAt2D($vArray2D,1,4,"1|4") SetAt2D($vArray2D,1,5,"1|5") SetAt2D($vArray2D,2,0,"2|0") SetAt2D($vArray2D,2,1,"2|1") SetAt2D($vArray2D,2,2,"2|2") SetAt2D($vArray2D,2,3,"2|3") SetAt2D($vArray2D,2,4,"2|4") SetAt2D($vArray2D,2,5,"2|5") SetAt2D($vArray2D,3,0,"3|0") SetAt2D($vArray2D,3,1,"3|1") SetAt2D($vArray2D,3,2,"3|2") SetAt2D($vArray2D,3,3,"3|3") SetAt2D($vArray2D,3,4,"3|4") SetAt2D($vArray2D,3,5,"3|5") SetAt2D($vArray2D,4,0,"4|0") SetAt2D($vArray2D,4,1,"4|1") SetAt2D($vArray2D,4,2,"4|2") SetAt2D($vArray2D,4,3,"4|3") SetAt2D($vArray2D,4,4,"4|4") SetAt2D($vArray2D,4,5,"4|5") SetAt2D($vArray2D,5,0,"5|0") SetAt2D($vArray2D,5,1,"5|1") SetAt2D($vArray2D,5,2,"5|2") SetAt2D($vArray2D,5,3,"5|3") SetAt2D($vArray2D,5,4,"5|4") SetAt2D($vArray2D,5,5,"5|5") Display($vArray2D) DeleteCArray2D($vArray2D) MsgBox(0,"MSG",$vArray2D) FreeCArray2D.au3 #include "CArray.au3" $vArray2D = CArray2D(6,6) SetAt2D($vArray2D,0,0,"0|0") SetAt2D($vArray2D,0,1,"0|1") SetAt2D($vArray2D,0,2,"0|2") SetAt2D($vArray2D,0,3,"0|3") SetAt2D($vArray2D,0,4,"0|4") SetAt2D($vArray2D,0,5,"0|5") SetAt2D($vArray2D,1,0,"1|0") SetAt2D($vArray2D,1,1,"1|1") SetAt2D($vArray2D,1,2,"1|2") SetAt2D($vArray2D,1,3,"1|3") SetAt2D($vArray2D,1,4,"1|4") SetAt2D($vArray2D,1,5,"1|5") SetAt2D($vArray2D,2,0,"2|0") SetAt2D($vArray2D,2,1,"2|1") SetAt2D($vArray2D,2,2,"2|2") SetAt2D($vArray2D,2,3,"2|3") SetAt2D($vArray2D,2,4,"2|4") SetAt2D($vArray2D,2,5,"2|5") SetAt2D($vArray2D,3,0,"3|0") SetAt2D($vArray2D,3,1,"3|1") SetAt2D($vArray2D,3,2,"3|2") SetAt2D($vArray2D,3,3,"3|3") SetAt2D($vArray2D,3,4,"3|4") SetAt2D($vArray2D,3,5,"3|5") SetAt2D($vArray2D,4,0,"4|0") SetAt2D($vArray2D,4,1,"4|1") SetAt2D($vArray2D,4,2,"4|2") SetAt2D($vArray2D,4,3,"4|3") SetAt2D($vArray2D,4,4,"4|4") SetAt2D($vArray2D,4,5,"4|5") SetAt2D($vArray2D,5,0,"5|0") SetAt2D($vArray2D,5,1,"5|1") SetAt2D($vArray2D,5,2,"5|2") SetAt2D($vArray2D,5,3,"5|3") SetAt2D($vArray2D,5,4,"5|4") SetAt2D($vArray2D,5,5,"5|5") Display($vArray2D) FreeCArray2D($vArray2D) Display($vArray2D) Insert_2D.au3 #include "CArray.au3" $vArray2D = CArray2D(4,4) SetAt2D($vArray2D,0,0,"0|0") SetAt2D($vArray2D,0,1,"0|1") SetAt2D($vArray2D,0,2,"0|2") SetAt2D($vArray2D,0,3,"0|3") SetAt2D($vArray2D,1,0,"1|0") SetAt2D($vArray2D,1,1,"1|1") SetAt2D($vArray2D,1,2,"1|2") SetAt2D($vArray2D,1,3,"1|3") SetAt2D($vArray2D,2,0,"2|0") SetAt2D($vArray2D,2,1,"2|1") SetAt2D($vArray2D,2,2,"2|2") SetAt2D($vArray2D,2,3,"2|3") SetAt2D($vArray2D,3,0,"3|0") SetAt2D($vArray2D,3,1,"3|1") SetAt2D($vArray2D,3,2,"3|2") SetAt2D($vArray2D,3,3,"3|3") Display($vArray2D) $Rt = Insert2D($vArray2D,1,2) ;Insert2D(ByRef $CArray2D,$RowIndex = 0,$RowsCount = 1,$ColuIndex = 0,$ColsCount = 0) ;Insert 2 Rows From The RowIndex 1 ; RowsCount = 2 ; RowIndex ==> 1 ; ;int ColuIndex = 0,int ColsCount = 0 Display($vArray2D) $Rt = Insert2D($vArray2D,0,0,1,2) ;Insert2D(ByRef $CArray2D,$RowIndex = 0,$RowsCount = 1,$ColuIndex = 0,$ColsCount = 0) ;Insert 2 Columns From The ColuIndex 1 ; ColsCount = 2 ; ColuIndex ==> 1 ;int RowIndex = 0,int RowsCount = 0 Display($vArray2D) $Rt = Insert2D($vArray2D,1,2,1,2) ;Insert2D(ByRef $CArray2D,$RowIndex = 0,$RowsCount = 1,$ColuIndex = 0,$ColsCount = 0) ;Insert 2 Rows And 2 Columns From The RowIndex 1 And From The ColuIndex 1 ;RowsCount = 2 ; RowIndex ==> 1 ;ColsCount = 2 ; ColuIndex ==> 1 Display($vArray2D) DeleteCArray2D($vArray2D) SetGet2D.au3 #include "CArray.au3" $iArray2D = CArray2D(3,3) ; 3 ==> Rows Count ; 3 ==> Column Count For $i = 0 To 2 For $j = 0 To 3 ; 0 To 3 ==> Over the Count of columns $Rt = SetAt2D($iArray2D,$i,$j,($i * $j)) ; SetAt2D($iArray2D,i,j,(i * j)) if ($Rt = false And @error) Then ; Test Errors MsgBox(0,"BOOL","false") Else MsgBox(0,"BOOL","true") EndIf ; i ==> Row Index ; j ==> Column Index ; (i * j) ==> vValue Next Next Display($iArray2D) DeleteCArray2D($iArray2D) $vArray2D = CArray2D(3,3) SetAt2D($vArray2D,0,0,"0|0") SetAt2D($vArray2D,0,1,"0|1") SetAt2D($vArray2D,0,2,"0|2") SetAt2D($vArray2D,1,0,"1|0") SetAt2D($vArray2D,1,1,"1|1") SetAt2D($vArray2D,1,2,"1|2") SetAt2D($vArray2D,2,0,"2|0") SetAt2D($vArray2D,2,1,"2|1") SetAt2D($vArray2D,2,2,"2|2") For $i = 0 To 2 For $j = 0 To 3 ; 0 To 3 ==> Over the Count of columns $vValue = GetAt2D($vArray2D,$i,$j) ;GetAt2D(ByRef $CArray2D,$RowIndex,$ColuIndex); i ==> Row Index ; j ==> Column Index ;Return ==> vValue if (@error) Then ; Test Errors MsgBox(0,"@error",@error) Else MsgBox(0,"No Error",$vValue) EndIf Next Next Display($vArray2D) DeleteCArray2D($vArray2D) $nArray2D = CArray2D(1,1) ; 1 ==> Rows Count ; 1 ==> Column Count For $i = 0 To 9 For $j = 0 To 5 $Rt = SetWithReDim2D($nArray2D,$i,$j,($i * $j)) ; iArray2D(i,j,(i * j)) ;SetWithReDim2D(ByRef $CArray2D,$RowIndex,$ColuIndex,$vValue) ; i ==> Row Index ; j ==> Column Index ; (i * j) ==> vValue Next Next Display($nArray2D) DeleteCArray2D($nArray2D) UBoundReDim_2D.au3 #include "CArray.au3" $iArray2D = CArray2D(1,4) ; 1 ==> Rows Count ; 4 ==> Column Count Display($iArray2D) ReDim2D($iArray2D,4,4) ; 4 ==> Rows Count ; 4 ==> Columns Count ;ReDim2D(ByRef $CArray2D,$RowsCount,$ColusCount) Display($iArray2D) $RowsCount = UBound2D($iArray2D,1) ; Dimension = 1 ; Get Rows Count $ColsCount = UBound2D($iArray2D,2) ; Dimension = 2 ; Get Columns Count ;UBound2D(ByRef $CArray2D , $Dimension = 1) MsgBox(0,"UBound","$RowsCount = " & $RowsCount & " ; $ColsCount = " & $ColsCount) DeleteCArray2D($iArray2D) $jArray2D = CArray2D(1,5) ; 1 ==> Rows Count ; 5 ==> Column Count Display($jArray2D) ReDim2D($jArray2D,3,5) ; 3 ==> Rows Count ; 5 ==> Columns Count Display($jArray2D) DeleteCArray2D($jArray2D) $nArray2D = CArray2D(5,1) ; 5 ==> Rows Count ; 1 ==> Column Count Display($nArray2D) ReDim2D($nArray2D,5,3) ; 5 ==> Rows Count ; 3 ==> Columns Count Display($nArray2D) DeleteCArray2D($nArray2D) $vArray2D = CArray2D(4,4) ; 4 ==> Rows Count ; 4 ==> Columns Count SetAt2D($vArray2D,0,0,"0|0") SetAt2D($vArray2D,0,1,"0|1") SetAt2D($vArray2D,0,2,"0|2") SetAt2D($vArray2D,0,3,"0|3") SetAt2D($vArray2D,1,0,"1|0") SetAt2D($vArray2D,1,1,"1|1") SetAt2D($vArray2D,1,2,"1|2") SetAt2D($vArray2D,1,3,"1|3") SetAt2D($vArray2D,2,0,"2|0") SetAt2D($vArray2D,2,1,"2|1") SetAt2D($vArray2D,2,2,"2|2") SetAt2D($vArray2D,2,3,"2|3") SetAt2D($vArray2D,3,0,"3|0") SetAt2D($vArray2D,3,1,"3|1") SetAt2D($vArray2D,3,2,"3|2") SetAt2D($vArray2D,3,3,"3|3") Display($vArray2D) ReDim2D($vArray2D,3,2) ; 3 ==> Rows Count ; 2 ==> Columns Count Display($vArray2D) $RowsCount = UBound2D($vArray2D,1) ; Dimension = 1 ; Get Rows Count $ColsCount = UBound2D($vArray2D,2) ; Dimension = 2 ; Get Columns Count MsgBox(0,"UBound","$RowsCount = " & $RowsCount & " ; $ColsCount = " & $ColsCount) DeleteCArray2D($vArray2D)
    1 point
  3. Indeed, you could have used _VersionCheck() to check the entire version string though . Length doesn't always matter... take a look at this: ConsoleWrite(_StringVersionCheck("B3.3.12", "B3.3.12.0.0.0") & @CRLF) Func _StringVersionCheck($sVersNow, $sVersOld) Local $aNow = StringRegExp($sVersNow, "\w+", 3) If @error Then Return SetError(1) Local $aOld = StringRegExp($sVersOld, "\w+", 3) If @error Then Return SetError(2) Local $iUB1 = UBound($aNow), $iUB2 = UBound($aOld) If $iUB2 > $iUB1 Then ReDim $aNow[$iUB2] If $iUB1 > $iUB2 Then ReDim $aOld[$iUB1] $iUB1 = ($iUB1 >= $iUB2) ? $iUB1 : $iUB2 Local $sNowConv, $sOldConv, $iLen1, $iLen2 For $i = 0 To $iUB1 - 1 $iLen1 = StringLen($aNow[$i]) $iLen2 = StringLen($aOld[$i]) Select Case $iLen1 > $iLen2 $aOld[$i] = StringFormat("%0" & $iLen1 & "d", $aOld[$i]) Case $iLen2 > $iLen1 $aNow[$i] = StringFormat("%0" & $iLen2 & "d", $aNow[$i]) EndSelect $sNowConv &= $aNow[$i] & (($i = $iUB1 - 1) ? "" : ".") $sOldConv &= $aOld[$i] & (($i = $iUB1 - 1) ? "" : ".") Next Return StringCompare($sNowConv, $sOldConv) EndFunc In your solution, the "old" version would be greater than the newer version. However, they are both equal (as you can see from the result (0 = 0, -1 = old number is greater, 1 = newer version greater).
    1 point
  4. guinness

    TypeScript

    Well worth an hour of my time:
    1 point
  5. ; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "AdapterType: " & $objItem.AdapterType & @CRLF $Output = $Output & "AdapterTypeId: " & $objItem.AdapterTypeId & @CRLF $Output = $Output & "AutoSense: " & $objItem.AutoSense & @CRLF $Output = $Output & "Availability: " & $objItem.Availability & @CRLF $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF $Output = $Output & "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "DeviceID: " & $objItem.DeviceID & @CRLF $Output = $Output & "ErrorCleared: " & $objItem.ErrorCleared & @CRLF $Output = $Output & "ErrorDescription: " & $objItem.ErrorDescription & @CRLF $Output = $Output & "GUID: " & $objItem.GUID & @CRLF $Output = $Output & "Index: " & $objItem.Index & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "Installed: " & $objItem.Installed & @CRLF $Output = $Output & "InterfaceIndex: " & $objItem.InterfaceIndex & @CRLF $Output = $Output & "LastErrorCode: " & $objItem.LastErrorCode & @CRLF $Output = $Output & "MACAddress: " & $objItem.MACAddress & @CRLF $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF $Output = $Output & "MaxNumberControlled: " & $objItem.MaxNumberControlled & @CRLF $Output = $Output & "MaxSpeed: " & $objItem.MaxSpeed & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "NetConnectionID: " & $objItem.NetConnectionID & @CRLF $Output = $Output & "NetConnectionStatus: " & $objItem.NetConnectionStatus & @CRLF $Output = $Output & "NetEnabled: " & $objItem.NetEnabled & @CRLF $strNetworkAddresses = $objItem.NetworkAddresses(0) $Output = $Output & "NetworkAddresses: " & $strNetworkAddresses & @CRLF $Output = $Output & "PermanentAddress: " & $objItem.PermanentAddress & @CRLF $Output = $Output & "PhysicalAdapter: " & $objItem.PhysicalAdapter & @CRLF $Output = $Output & "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0) $Output = $Output & "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF $Output = $Output & "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF $Output = $Output & "ProductName: " & $objItem.ProductName & @CRLF $Output = $Output & "ServiceName: " & $objItem.ServiceName & @CRLF $Output = $Output & "Speed: " & $objItem.Speed & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "StatusInfo: " & $objItem.StatusInfo & @CRLF $Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF $Output = $Output & "SystemName: " & $objItem.SystemName & @CRLF $Output = $Output & "TimeOfLastReset: " & WMIDateStringToDate($objItem.TimeOfLastReset) & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_NetworkAdapter" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc its in networkadapter, not networkadapterconfiguration
    1 point
  6. I just added a tab create feature for IE here: _IEJS_TabCreate()
    1 point
×
×
  • Create New...