Sign in to follow this  
Followers 0
wolf9228

CArray

3 posts in this topic

#1 ·  Posted (edited)

CArray Data Type ==> (String,Int,Binary,Float,HWnd,Ptr,Bool)

Data types (COM object,Autoit Array,DllStruct) are not allowed

All Files

CArray.zip

Simple logic error in the following two functions

CArray1D($RowsCount)

CArray2D($RowsCount,$ColusCount)

Project after the amendment

New_CArray.zip

CArray.au3

#include <GuiListView.au3>
#include <GUIConstantsEx.au3>

Func CArray1D($RowsCount)
Select
Case $RowsCount < 0
Return SetError(1,0,0)
Case Else
$pRowsCount = $RowsCount
if $pRowsCount = 0 Then $pRowsCount = 1
$CArray1D = DllStructCreate("INT RE;INT CE;PTR ELEMENTS[" & $pRowsCount & "]")
DllStructSetData($CArray1D,"RE",$RowsCount)
DllStructSetData($CArray1D,"CE",1)
Return SetError(0,0,$CArray1D)
EndSelect
EndFunc

Func UBound1D(ByRef $CArray1D)
If Not IsDllStruct($CArray1D) Then Return SetError(1,0,0)
$RowsCount = DllStructGetData($CArray1D,"RE")
Return SetError(@error,0,$RowsCount)
EndFunc

Func ReDim1D(ByRef $CArray1D,$RowsCount)
If Not IsDllStruct($CArray1D) Then Return SetError(1,0,False)
If ($RowsCount < 0) Then Return SetError(2,0,False)
Local $iRowsCount = UBound1D($CArray1D),$PtrSize = 4 ,$pRowsCount = $iRowsCount
If ($RowsCount < $pRowsCount) Then $pRowsCount = $RowsCount
Local $NewArray1D = CArray1D($RowsCount)
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetPtr1D($NewArray1D) _
,"ptr",GetPtr1D($CArray1D),"ulong_ptr",($PtrSize * $pRowsCount))
If ($RowsCount < $iRowsCount) Then
For $i = $RowsCount To $iRowsCount - 1
$hMemory = DllStructGetData($CArray1D,"ELEMENTS",$i + 1)
If Not ($hMemory) Then ContinueLoop
DllCall("kernel32.dll","handle","GlobalFree","ptr",$hMemory)
Next
EndIf
$CArray1D = $NewArray1D
Return SetError(0,0,True)
EndFunc

Func FreeCArray1D(ByRef $CArray1D)
If Not IsDllStruct($CArray1D) Then Return SetError(1,0,False)
Local $iRowsCount = UBound1D($CArray1D),$hMemory
For $RowIndex = 0 To $iRowsCount - 1
$hMemory = DllStructGetData($CArray1D,"ELEMENTS",$RowIndex + 1)
If Not ($hMemory) Then ContinueLoop
DllCall("kernel32.dll","handle","GlobalFree","ptr",$hMemory)
Next
Return SetError(0,0,True)
EndFunc

Func DeleteCArray1D(ByRef $CArray1D)
FreeCArray1D($CArray1D)
if @error Then Return SetError(1,0,False)
$CArray1D = "Nothing"
Return SetError(0,0,True)
EndFunc

Func GetAt1D(ByRef $CArray1D,$RowIndex)
If Not IsDllStruct($CArray1D) Then Return SetError(1,0,0)
Local $iRowsCount = UBound1D($CArray1D),$Value,$hMemory
If ($RowIndex < 0 Or $RowIndex > ($iRowsCount -1)) Then Return SetError(2,0,0)
$hMemory = DllStructGetData($CArray1D,"ELEMENTS",$RowIndex + 1)
return SetError(0,0,MemToValue($hMemory))
EndFunc

Func SetAt1D(ByRef $CArray1D,$RowIndex,$vValue)
If Not IsDllStruct($CArray1D) Or Not IsDataType($vValue) Then Return SetError(1,0,False)
Local $iRowsCount = UBound1D($CArray1D),$Value,$hMemory
If ($RowIndex < 0 Or $RowIndex > ($iRowsCount -1)) Then Return SetError(2,0,False)
Local $hMemory = ValueToMem($vValue)
If @error Then Return SetError(3,0,False)
Local $ihMemory = DllStructGetData($CArray1D,"ELEMENTS",$RowIndex + 1)
If ($ihMemory) Then DllCall("kernel32.dll","handle","GlobalFree","ptr",$ihMemory)
DllStructSetData($CArray1D,"ELEMENTS",$hMemory,$RowIndex + 1)
Return SetError(0,0,True)
EndFunc

Func SetAtGrow1D(ByRef $CArray1D,$RowIndex,$vValue)
If Not IsDllStruct($CArray1D) Or Not IsDataType($vValue) Then Return SetError(1,0,False)
Local $iRowsCount = UBound1D($CArray1D)
If ($RowIndex < 0) Then Return SetError(2,0,False)
If ($RowIndex > ($iRowsCount - 1)) Then ReDim1D($CArray1D,$RowIndex + 1)
SetAt1D($CArray1D,$RowIndex,$vValue)
If @error Then Return SetError(3,0,False)
Return SetError(0,0,True)
EndFunc

Func Add1D(ByRef $CArray1D,$vValue,$End = True)
If Not IsDllStruct($CArray1D) Or Not IsDataType($vValue) Then Return SetError(1,0,False)
Local $iRowsCount = UBound1D($CArray1D),$PtrSize = 4
Local $NewArray1D = CArray1D($iRowsCount + 1)
If ($End) Then
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetPtr1D($NewArray1D) _
,"ptr",GetPtr1D($CArray1D),"ulong_ptr",($PtrSize * $iRowsCount))
SetAt1D($NewArray1D,$iRowsCount,$vValue)
If @error Then Return SetError(2,0,0)
Else
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetPtr1D($NewArray1D,1) _
,"ptr",GetPtr1D($CArray1D),"ulong_ptr",($PtrSize * $iRowsCount))
SetAt1D($NewArray1D,0,$vValue)
If @error Then Return SetError(2,0,0)
EndIf
$CArray1D = $NewArray1D
Return SetError(0,0,True)
EndFunc

Func DeleteAt1D(ByRef $CArray1D,$RowIndex)
If Not IsDllStruct($CArray1D) Then Return SetError(1,0,False)
Local $iRowsCount = UBound1D($CArray1D),$Value,$hMemory,$iSize,$PtrSize = 4
If ($RowIndex < 0 Or $RowIndex > ($iRowsCount - 1)) Then Return SetError(2,0,False)
$iSize = ($PtrSize * ($iRowsCount - ($RowIndex + 1)))
Local $NewArray1D = CArray1D($iRowsCount - 1),$ihMemory
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetPtr1D($NewArray1D) _
,"ptr",GetPtr1D($CArray1D),"ulong_ptr",($PtrSize * $RowIndex))
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetPtr1D($NewArray1D,$RowIndex) _
,"ptr",GetPtr1D($CArray1D,($RowIndex + 1)),"ulong_ptr",$iSize)
Local $ihMemory = DllStructGetData($CArray1D,"ELEMENTS",$RowIndex + 1)
If ($ihMemory) Then DllCall("kernel32.dll","handle","GlobalFree","ptr",$ihMemory)
$CArray1D = $NewArray1D
Return SetError(0,0,True)
EndFunc

Func InsertAt1D(ByRef $CArray1D,$RowIndex,$vValue)
If Not IsDllStruct($CArray1D) Or Not IsDataType($vValue) Then Return SetError(1,0,False)
Local $iRowsCount = UBound1D($CArray1D),$iSize,$PtrSize = 4
If ($RowIndex < 0 Or $RowIndex > ($iRowsCount - 1)) Then Return SetError(2,0,False)
$iSize = ($PtrSize * ($iRowsCount - $RowIndex))
Local $NewArray1D = CArray1D($iRowsCount + 1)
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetPtr1D($NewArray1D) _
,"ptr",GetPtr1D($CArray1D),"ulong_ptr",($PtrSize * $RowIndex))
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetPtr1D($NewArray1D,$RowIndex + 1) _
,"ptr",GetPtr1D($CArray1D,$RowIndex),"ulong_ptr",$iSize)
SetAt1D($NewArray1D,$RowIndex,$vValue)
If @error Then Return SetError(2,0,False)
$CArray1D = $NewArray1D
Return SetError(0,0,True)
EndFunc

Func Find1D(ByRef $CArray1D,$vValue,$begin = -1,$End = -1,$CaseSensitive = false)
If Not IsDllStruct($CArray1D) Or Not IsDataType($vValue) Then Return SetError(1,0,-1)
Local $iRowsCount = UBound1D($CArray1D)
If ($End = - 1) Then $End = ($iRowsCount - 1)
If ($begin = - 1) Then $begin = 0;
If ($begin < 0 Or $begin > ($iRowsCount -1) Or $End < 0 _
Or $End > ($iRowsCount - 1) Or $End < $begin) Then Return SetError(2,0,-1)
If IsString($vValue) Then
For $i = $begin To $End
If GetElType1D($CArray1D,$i) <> 1 Then ContinueLoop
If (Not($CaseSensitive)) Then
If (StringCompare(GetAt1D($CArray1D,$i),$vValue,0) = 0) Then Return SetError(0,0,$i)
Else
If (StringCompare(GetAt1D($CArray1D,$i),$vValue,1) = 0) Then Return SetError(0,0,$i)
EndIf
Next
Else
For $i = $begin To $End
If GetElType1D($CArray1D,$i) = 1 Then ContinueLoop
If GetAt1D($CArray1D,$i) = $vValue Then Return SetError(0,0,$i)
Next
EndIf
Return SetError(3,0,-1)
EndFunc

Func GetPtr1D(ByRef $CArray1D,$MoveCount = 0)
If Not IsDllStruct($CArray1D) Then Return SetError(1,0,0)
Local $iRowsCount = UBound1D($CArray1D)
If ($MoveCount < 0 Or $MoveCount > $iRowsCount) Then Return SetError(2,0,0)
Local $Ptr1Dr , $PtrSize = 4
$Ptr1D = DllStructGetPtr($CArray1D,3) + ($MoveCount * $PtrSize)
Return SetError(0,0,$Ptr1D)
EndFunc

Func GetElType1D(ByRef $CArray1D,$RowIndex)
If Not IsDllStruct($CArray1D) Then Return SetError(1,0,-1)
$hMemory = DllStructGetData($CArray1D,"ELEMENTS",$RowIndex + 1)
$hLock = DllCall("kernel32.dll","ptr","GlobalLock","handle",$hMemory)
If @error Or $hLock[0] = 0 Then Return SetError(2,0,-1)
$hLock = $hLock[0]
$Struct = DllStructCreate("INT DataSize;INT DataType",$hLock)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
$DataType = DllStructGetData($Struct,"DataType")
If @error Then Return SetError(3,0,-1)
Return SetError(0,0,$DataType)
EndFunc

Func CArray2D($RowsCount,$ColusCount)
Select
Case $RowsCount < 0 Or $ColusCount < 0
Return SetError(1,0,0)
Case Else
$pRowsCount = $RowsCount
$pColusCount = $ColusCount
if ($pRowsCount = 0) Then $pRowsCount = 1
if ($pColusCount = 0) Then $pColusCount = 1
$CArray2D = DllStructCreate("INT RE;INT CE;PTR ELEMENTS[" & $pRowsCount * $pColusCount & "]")
DllStructSetData($CArray2D,"RE",$RowsCount)
DllStructSetData($CArray2D,"CE",$ColusCount)
Return SetError(0,0,$CArray2D)
EndSelect
EndFunc

Func UBound2D(ByRef $CArray2D , $Dimension = 1)
If Not IsDllStruct($CArray2D) Then Return SetError(1,0,0)
$RowsCount = DllStructGetData($CArray2D,"RE")
If ($Dimension = 1) Then Return SetError(@error,0,$RowsCount)
$ColusCount = DllStructGetData($CArray2D,"CE")
If ($Dimension = 2) Then Return SetError(@error,0,$ColusCount)
Return SetError(2,0,0)
EndFunc

Func ReDim2D(ByRef $CArray2D,$RowsCount,$ColusCount)
If Not IsDllStruct($CArray2D) Then Return SetError(1,0,False)
If ($RowsCount < 0 Or $ColusCount < 0) Then Return SetError(2,0,False)
Local $iRowsCount = UBound2D($CArray2D) , $iColusCount = UBound2D($CArray2D,2)
Local $pRowsCount = $iRowsCount , $pColusCount = $iColusCount
If ($RowsCount < $iRowsCount) Then $pRowsCount = $RowsCount
If ($ColusCount < $iColusCount) Then $pColusCount = $ColusCount
Local $NewCArray2D = CArray2D($RowsCount,$ColusCount) , $PtrSize = 4
For $i = 0 To $iRowsCount - 1
If ($i < $pRowsCount) Then
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetRowPtr($NewCArray2D,$i) _
,"ptr",GetRowPtr($CArray2D,$i),"ulong_ptr",($PtrSize * $pColusCount))
For $j = $pColusCount To $iColusCount - 1
$hMemory = DllStructGetData($CArray2D,"ELEMENTS",GetElementNu($CArray2D,$i,$j))
If Not ($hMemory) Then ContinueLoop
DllCall("kernel32.dll","handle","GlobalFree","ptr",$hMemory)
Next
Else
For $j = 0 To $iColusCount - 1
$hMemory = DllStructGetData($CArray2D,"ELEMENTS",GetElementNu($CArray2D,$i,$j))
If Not ($hMemory) Then ContinueLoop
DllCall("kernel32.dll","handle","GlobalFree","ptr",$hMemory)
Next
EndIf
Next
$CArray2D = $NewCArray2D
Return SetError(0,0,True)
EndFunc

Func FreeCArray2D(ByRef $CArray2D)
If Not IsDllStruct($CArray2D) Then Return SetError(1,0,False)
Local $iRowsCount = UBound2D($CArray2D) , $iColusCount = UBound2D($CArray2D,2)
For $RowIndex = 0 To $iRowsCount - 1
For $ColuIndex = 0 To $iColusCount - 1
$hMemory = DllStructGetData($CArray2D,"ELEMENTS",GetElementNu($CArray2D,$RowIndex,$ColuIndex))
If Not ($hMemory) Then ContinueLoop
DllCall("kernel32.dll","handle","GlobalFree","ptr",$hMemory)
Next
Next
Return SetError(0,0,True)
EndFunc

Func DeleteCArray2D(ByRef $CArray2D)
FreeCArray1D($CArray2D)
if @error Then Return SetError(1,0,False)
$CArray2D = "Nothing"
Return SetError(0,0,True)
EndFunc

Func GetAt2D(ByRef $CArray2D,$RowIndex,$ColuIndex)
If Not IsDllStruct($CArray2D) Then Return SetError(1,0,0)
$Element = GetElementNu($CArray2D,$RowIndex,$ColuIndex)
If @error Then Return SetError(2,0,0)
$hMemory = DllStructGetData($CArray2D,"ELEMENTS",$Element)
return SetError(0,0,MemToValue($hMemory))
EndFunc

Func SetAt2D(ByRef $CArray2D,$RowIndex,$ColuIndex,$vValue)
If Not IsDllStruct($CArray2D) Or Not IsDataType($vValue) Then Return SetError(1,0,False)
$Element = GetElementNu($CArray2D,$RowIndex,$ColuIndex)
If @error Then Return SetError(2,0,False)
Local $hMemory = ValueToMem($vValue)
If @error Then Return SetError(3,0,False)
Local $ihMemory = DllStructGetData($CArray2D,"ELEMENTS",$Element)
If ($ihMemory) Then DllCall("kernel32.dll","handle","GlobalFree","ptr",$ihMemory)
DllStructSetData($CArray2D,"ELEMENTS",$hMemory,$Element)
Return SetError(0,0,True)
EndFunc

Func SetAtGrow2D(ByRef $CArray2D,$RowIndex,$ColuIndex,$vValue)
If Not IsDllStruct($CArray2D) Or Not IsDataType($vValue) Then Return SetError(1,0,False)
If ($RowIndex < 0 Or $ColuIndex < 0) Then Return SetError(2,0,False)
Local $iRowsCount = UBound2D($CArray2D) , $iColusCount = UBound2D($CArray2D,2)
Local $iRowIndex = $iRowsCount, $iColuIndex = $iColusCount
If ($RowIndex > ($iRowsCount - 1)) Then $iRowIndex = ($RowIndex + 1)
If ($ColuIndex > ($iColusCount - 1)) Then $iColuIndex = ($ColuIndex + 1)
If ($RowIndex > ($iRowsCount - 1) Or $ColuIndex > ($iColusCount - 1)) Then ReDim2D($CArray2D,$iRowIndex,$iColuIndex)
SetAt2D($CArray2D,$RowIndex,$ColuIndex,$vValue)
If @error Then Return SetError(3,0,False)
Return SetError(0,0,True)
EndFunc

Func Add2D(ByRef $CArray2D,$RowsCount = 1,$RowsEnd = True,$ColsCount = 0,$ColsEnd = True)
If Not IsDllStruct($CArray2D) Then Return SetError(1,0,False)
If ($RowsCount < 0 Or $ColsCount < 0) Then Return SetError(2,0,False)
Local $iRowsCount = UBound2D($CArray2D) , $iColusCount = UBound2D($CArray2D,2) , $PtrSize = 4
Local $vIndex = 0 , $NewCArray2D = CArray2D($iRowsCount + $RowsCount,$iColusCount + $ColsCount)
For $i = 0 To ($iRowsCount + $RowsCount) - 1
If ($RowsEnd ==  False And $i < $RowsCount) Then
Else
If ($ColsEnd = True) Then
If ($vIndex < $iRowsCount) Then
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetRowPtr($NewCArray2D,$i) _
,"ptr",GetRowPtr($CArray2D,$vIndex),"ulong_ptr",($PtrSize * $iColusCount))
EndIf
Else
If ($vIndex < $iRowsCount) Then
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetRowPtr($NewCArray2D,$i) + ($ColsCount _
* $PtrSize),"ptr",GetRowPtr($CArray2D,$vIndex),"ulong_ptr",($PtrSize * $iColusCount))
EndIf
EndIf
$vIndex += 1;
EndIf
Next
$CArray2D = $NewCArray2D
Return SetError(0,0,True)
EndFunc

Func Insert2D(ByRef $CArray2D,$RowIndex = 0,$RowsCount = 1,$ColuIndex = 0,$ColsCount = 0)
If Not IsDllStruct($CArray2D) Then Return SetError(1,0,False)
Local $iRowsCount = UBound2D($CArray2D),$iColusCount = UBound2D($CArray2D,2),$PtrSize = 4
Local $vIndex = 0,$NewCArray2D = CArray2D($iRowsCount + $RowsCount,$iColusCount + $ColsCount)
If ($RowIndex < 0 Or $ColuIndex < 0 Or $RowIndex > ($iRowsCount -1) _
Or $ColuIndex > ($iColusCount - 1)) Then Return SetError(2,0,False)
For $i = 0 To ($iRowsCount + $RowsCount) - 1
If ($i < $RowIndex Or $i > $RowIndex + ($RowsCount - 1)) Then
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetRowPtr($NewCArray2D,$i) _
,"ptr",GetRowPtr($CArray2D,$vIndex),"ulong_ptr",($PtrSize * $ColuIndex))
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetRowPtr($NewCArray2D,$i) _
+ (($ColuIndex + $ColsCount) * $PtrSize),"ptr",GetRowPtr($CArray2D,$vIndex) + ($ColuIndex * _
$PtrSize),"ulong_ptr",($PtrSize * ($iColusCount - $ColuIndex)))
$vIndex += 1
EndIf
Next
$CArray2D = $NewCArray2D
Return SetError(0,0,True)
EndFunc

Func Delete2D(ByRef $CArray2D,$RowIndex = 0,$RowsCount = 1,$ColuIndex = 0,$ColsCount = 0)
If Not IsDllStruct($CArray2D) Then Return SetError(1,0,False)
Local $iRowsCount = UBound2D($CArray2D),$iColusCount = UBound2D($CArray2D,2),$PtrSize = 4
Local $vIndex = 0,$NewCArray2D = CArray2D($iRowsCount - $RowsCount,$iColusCount - $ColsCount)
If ($RowIndex < 0 Or $ColuIndex < 0 Or $RowsCount > ($iRowsCount - $RowIndex) _
Or $ColsCount > ($iColusCount - $ColuIndex)) Then Return SetError(2,0,False)
For $i = 0 To $iRowsCount - 1
If ($i < $RowIndex Or $i > ($RowIndex + ($RowsCount - 1))) Then
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetRowPtr($NewCArray2D,$vIndex) _
,"ptr",GetRowPtr($CArray2D,$i),"ulong_ptr",($PtrSize * $ColuIndex))
DllCall("kernel32.dll","none","RtlMoveMemory","ptr",GetRowPtr($NewCArray2D,$vIndex) + _
($ColuIndex  * $PtrSize),"ptr",GetRowPtr($CArray2D,$i) + (($ColuIndex + $ColsCount) * $PtrSize) _
,"ulong_ptr",$PtrSize * ($iColusCount - ($ColuIndex + $ColsCount)))
For $j = $ColuIndex To $ColsCount - 1
$hMemory = DllStructGetData($CArray2D,"ELEMENTS",GetElementNu($CArray2D,$i,$j))
If Not ($hMemory) Then ContinueLoop
DllCall("kernel32.dll","handle","GlobalFree","ptr",$hMemory)
Next
$vIndex += 1;
Else
For $j = 0 To $iColusCount - 1
$hMemory = DllStructGetData($CArray2D,"ELEMENTS",GetElementNu($CArray2D,$i,$j))
If Not ($hMemory) Then ContinueLoop
DllCall("kernel32.dll","handle","GlobalFree","ptr",$hMemory)
Next
EndIf
Next
$CArray2D = $NewCArray2D
Return SetError(0,0,True)
EndFunc

Func Find2D(ByRef $CArray2D,$vValue,$RowIndex = -1,$ColuIndex = -1,$CaseSensitive = false)
If Not IsDllStruct($CArray2D) Or Not IsDataType($vValue) Then Return SetError(1,0,-1)
Local $iRowsCount = UBound2D($CArray2D),$iColusCount = UBound2D($CArray2D,2),$RtIndex[2]
If ($RowIndex = -1) Then $RowIndex = ($iRowsCount - 1)
If ($ColuIndex = -1) Then $ColuIndex = ($iColusCount - 1)
If ($RowIndex < 0 Or $RowIndex > ($iRowsCount - 1) _
Or $ColuIndex < 0 Or $ColuIndex > (($iColusCount -1))) Then Return SetError(2,0,-1)
If (IsString($vValue)) Then
For $i = 0 To $RowIndex
For $j = 0 To $ColuIndex
If GetElType2D($CArray2D,$i,$j) <> 1 Then ContinueLoop
$RtIndex[0] = $i
$RtIndex[1] = $j
If (Not($CaseSensitive)) Then
If (StringCompare(GetAt2D($CArray2D,$i,$j),$vValue,0) = 0) _
Then Return SetError(0,0,$RtIndex)
Else
If (StringCompare(GetAt2D($CArray2D,$i,$j),$vValue,1) = 0) _
Then Return SetError(0,0,$RtIndex)
EndIf
Next
Next
Else
For $i = 0 To $RowIndex
For $j = 0 To $ColuIndex
If GetElType2D($CArray2D,$i,$j) = 1 Then ContinueLoop
$RtIndex[0] = $i
$RtIndex[1] = $j
If (GetAt2D($CArray2D,$i,$j) = $vValue) Then Return SetError(0,0,$RtIndex)
Next
Next
EndIf
Return SetError(3,0,-1)
EndFunc

Func GetRowPtr(ByRef $CArray2D,$RowIndex)
If Not IsDllStruct($CArray2D) Then Return SetError(1,0,0)
Local $RowsCount = UBound2D($CArray2D) , $ColusCount = UBound2D($CArray2D,2)
If ($RowIndex < 0 Or $RowIndex > ($RowsCount - 1)) Then Return SetError(2,0,0)
Local $RowPtr , $PtrSize = 4
$RowPtr = (DllStructGetPtr($CArray2D,3) + (($RowIndex * $ColusCount) * $PtrSize))
Return SetError(0,0,$RowPtr)
EndFunc

Func GetElementNu(ByRef $CArray2D,$RowIndex,$ColuIndex)
If Not IsDllStruct($CArray2D) Then Return SetError(1,0,-1)
Local $iRowsCount = UBound2D($CArray2D) , $iColusCount = UBound2D($CArray2D,2)
If ($RowIndex < 0 Or  $RowIndex > ($iRowsCount -1) Or  $ColuIndex < 0 _
Or $ColuIndex > ($iColusCount -1)) Then Return SetError(2,0,-1)
Local $Element = (($RowIndex + 1) * $iColusCount) - ($iColusCount - ($ColuIndex + 1))
Return SetError(0,0,$Element)
EndFunc

Func GetElType2D(ByRef $CArray2D,$RowIndex,$ColuIndex)
If Not IsDllStruct($CArray2D) Then Return SetError(1,0,-1)
$Number = GetElementNu($CArray2D,$RowIndex,$ColuIndex)
If @error Then Return SetError(2,0,-1)
$hMemory = DllStructGetData($CArray2D,"ELEMENTS",$Number)
$hLock = DllCall("kernel32.dll","ptr","GlobalLock","handle",$hMemory)
If @error Or $hLock[0] = 0 Then Return SetError(3,0,-1)
$hLock = $hLock[0]
$Struct = DllStructCreate("INT DataSize;INT DataType",$hLock)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
$DataType = DllStructGetData($Struct,"DataType")
If @error Then Return SetError(4,0,-1)
Return SetError(0,0,$DataType)
EndFunc

Func IsDataType($Value)
If IsString($Value) Or IsBinary($Value) Or IsInt($Value) _
Or IsFloat($Value) Or IsBool($Value) Or IsPtr($Value) Or _
IsHWnd($Value) Or IsKeyword($Value) Then Return True
Return False
EndFunc

Func ValueToMem($Value)
Local $IntSize = 4 , $BoolSize = 4
Local $PtrSize = 4 , $HWndSize = 4
If Not IsDataType($Value) Then Return SetError(1,0,0)
Select
Case IsString($Value)
$DataSize = StringLen($Value) + 1
$hMemory = DllCall("kernel32.dll","handle","GlobalAlloc","uint",(0x0002 + 0x0040),"ulong_ptr",($DataSize * 2) + ($IntSize * 2))
;(0x0002 + 0x0040) ==> $GHND / ($IntSize * 2) 2 ==> "int DataSize;int DataType;
If @error Or $hMemory[0] = 0 Then Return SetError(2,0,0)
$hLock = DllCall("kernel32.dll","ptr","GlobalLock","handle",$hMemory[0])
$Struct = DllStructCreate("INT DataSize;INT DataType;WCHAR Data[" & $DataSize & "]",$hLock[0])
DllStructSetData($Struct,"DataSize",$DataSize)
DllStructSetData($Struct,"DataType",1)
DllStructSetData($Struct,"Data",$Value)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory[0])
Return SetError(0,0,$hMemory[0])
Case IsBinary($Value)
$DataSize = BinaryLen($Value)
$hMemory = DllCall("kernel32.dll","handle","GlobalAlloc","uint",(0x0002 + 0x0040),"ulong_ptr",$DataSize + ($IntSize * 2))
;(0x0002 + 0x0040) ==> $GHND / ($IntSize * 2) 2 ==> "int DataSize;int DataType;
If @error Or $hMemory[0] = 0 Then Return SetError(2,0,0)
$hLock = DllCall("kernel32.dll","ptr","GlobalLock","handle",$hMemory[0])
$Struct = DllStructCreate("INT DataSize;INT DataType;BYTE Data[" & $DataSize & "]",$hLock[0])
DllStructSetData($Struct,"DataSize",$DataSize)
DllStructSetData($Struct,"DataType",2)
DllStructSetData($Struct,"Data",$Value)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory[0])
Return SetError(0,0,$hMemory[0])
Case IsInt($Value)
$Value = String($Value)
$DataSize = StringLen($Value) + 1
$hMemory = DllCall("kernel32.dll","handle","GlobalAlloc","uint",(0x0002 + 0x0040),"ulong_ptr",($DataSize * 2) + ($IntSize * 2))
;(0x0002 + 0x0040) ==> $GHND / ($IntSize * 2) 2 ==> "int DataSize;int DataType;
If @error Or $hMemory[0] = 0 Then Return SetError(2,0,0)
$hLock = DllCall("kernel32.dll","ptr","GlobalLock","handle",$hMemory[0])
$Struct = DllStructCreate("INT DataSize;INT DataType;WCHAR Data[" & $DataSize & "]",$hLock[0])
DllStructSetData($Struct,"DataSize",$DataSize)
DllStructSetData($Struct,"DataType",3)
DllStructSetData($Struct,"Data",$Value)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory[0])
Return SetError(0,0,$hMemory[0])
Case IsFloat($Value)
$Value = String($Value)
$DataSize = StringLen($Value) + 1
$hMemory = DllCall("kernel32.dll","handle","GlobalAlloc","uint",(0x0002 + 0x0040),"ulong_ptr",($DataSize * 2) + ($IntSize * 2))
;(0x0002 + 0x0040) ==> $GHND / ($IntSize * 2) 2 ==> "int DataSize;int DataType;
If @error Or $hMemory[0] = 0 Then Return SetError(2,0,0)
$hLock = DllCall("kernel32.dll","ptr","GlobalLock","handle",$hMemory[0])
$Struct = DllStructCreate("INT DataSize;INT DataType;WCHAR Data[" & $DataSize & "]",$hLock[0])
DllStructSetData($Struct,"DataSize",$DataSize)
DllStructSetData($Struct,"DataType",4)
DllStructSetData($Struct,"Data",$Value)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory[0])
Return SetError(0,0,$hMemory[0])
Case IsBool($Value)
$hMemory = DllCall("kernel32.dll","handle","GlobalAlloc","uint",(0x0002 + 0x0040),"ulong_ptr",$BoolSize + ($IntSize * 2))
;(0x0002 + 0x0040) ==> $GHND / $BoolSize + ($IntSize * 2) ==> INT DataSize;INT DataType;BOOL Data
If @error Or $hMemory[0] = 0 Then Return SetError(2,0,0)
$hLock = DllCall("kernel32.dll","ptr","GlobalLock","handle",$hMemory[0])
$Struct = DllStructCreate("INT DataSize;INT DataType;BOOL Data",$hLock[0])
DllStructSetData($Struct,"DataType",5)
DllStructSetData($Struct,"Data",$Value)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory[0])
Return SetError(0,0,$hMemory[0])
Case IsPtr($Value)
$hMemory = DllCall("kernel32.dll","handle","GlobalAlloc","uint",(0x0002 + 0x0040),"ulong_ptr",$PtrSize + ($IntSize * 2))
;(0x0002 + 0x0040) ==> $GHND / $PtrSize + ($IntSize * 2) ==> "INT DataSize;INT DataType;PTR Data"
If @error Or $hMemory[0] = 0 Then Return SetError(2,0,0)
$hLock = DllCall("kernel32.dll","ptr","GlobalLock","handle",$hMemory[0])
$Struct = DllStructCreate("INT DataSize;INT DataType;PTR Data",$hLock[0])
DllStructSetData($Struct,"DataType",6)
DllStructSetData($Struct,"Data",$Value)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory[0])
Return SetError(0,0,$hMemory[0])
Case IsHWnd($Value)
$hMemory = DllCall("kernel32.dll","handle","GlobalAlloc","uint",(0x0002 + 0x0040),"ulong_ptr",$HWndSize + ($IntSize * 2))
;(0x0002 + 0x0040) ==> $GHND / $HWndSize + ($IntSize * 2) ==> "INT DataSize;INT DataType;HWND Data"
If @error Or $hMemory[0] = 0 Then Return SetError(2,0,0)
$hLock = DllCall("kernel32.dll","ptr","GlobalLock","handle",$hMemory[0])
$Struct = DllStructCreate("INT DataSize;INT DataType;HWND Data",$hLock[0])
DllStructSetData($Struct,"DataType",7)
DllStructSetData($Struct,"Data",$Value)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory[0])
Return SetError(0,0,$hMemory[0])
Case IsKeyword($Value)
;Default Keyword
$hMemory = DllCall("kernel32.dll","handle","GlobalAlloc","uint",(0x0002 + 0x0040),"ulong_ptr",($IntSize * 3))
;(0x0002 + 0x0040) ==> $GHND / ($IntSize * 3) 3 ==> "INT DataSize;INT DataType;INT Data"
If @error Or $hMemory[0] = 0 Then Return SetError(2,0,0)
$hLock = DllCall("kernel32.dll","ptr","GlobalLock","handle",$hMemory[0])
$Struct = DllStructCreate("INT DataSize;INT DataType;INT Data",$hLock[0])
DllStructSetData($Struct,"DataType",8)
DllStructSetData($Struct,"Data",$Value)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory[0])
Return SetError(0,0,$hMemory[0])
EndSelect
EndFunc

Func MemToValue($hMemory)
$hLock = DllCall("kernel32.dll","ptr","GlobalLock","handle",$hMemory)
If @error Or $hLock[0] = 0 Then Return SetError(1,0,"")
$hLock = $hLock[0]
$Struct = DllStructCreate("INT DataSize;INT DataType",$hLock)
$DataType = DllStructGetData($Struct,"DataType")
If @error Then
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
Return SetError(2,0,"")
EndIf
Switch $DataType
Case 1
$DataSize = DllStructGetData($Struct,"DataSize")
$Struct = DllStructCreate("INT DataSize;INT DataType;WCHAR Data[" & $DataSize & "]",$hLock)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
$Data = DllStructGetData($Struct,"Data")
If @error Then Return SetError(3,0,"")
Return SetError(0,0,$Data)
Case 2
$DataSize = DllStructGetData($Struct,"DataSize")
$Struct = DllStructCreate("INT DataSize;INT DataType;BYTE Data[" & $DataSize & "]",$hLock)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
$Data = DllStructGetData($Struct,"Data")
If @error Then Return SetError(3,0,"")
Return SetError(0,0,$Data)
Case 3
$DataSize = DllStructGetData($Struct,"DataSize")
$Struct = DllStructCreate("INT DataSize;INT DataType;WCHAR Data[" & $DataSize & "]",$hLock)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
$Data = DllStructGetData($Struct,"Data")
If @error Then Return SetError(3,0,"")
Return SetError(0,0,Number($Data))
Case 4
$DataSize = DllStructGetData($Struct,"DataSize")
$Struct = DllStructCreate("INT DataSize;INT DataType;WCHAR Data[" & $DataSize & "]",$hLock)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
$Data = DllStructGetData($Struct,"Data")
If @error Then Return SetError(3,0,"")
Return SetError(0,0,Number($Data))
Case 5
$Struct = DllStructCreate("INT DataSize;INT DataType;BOOL Data",$hLock)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
$Data = DllStructGetData($Struct,"Data")
If @error Then Return SetError(3,0,"")
Return SetError(0,0,$Data == 1)
Case 6
$Struct = DllStructCreate("INT DataSize;INT DataType;PTR Data",$hLock)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
$Data = DllStructGetData($Struct,"Data")
If @error Then Return SetError(3,0,"")
Return SetError(0,0,$Data)
Case 7
$Struct = DllStructCreate("INT DataSize;INT DataType;HWND Data",$hLock)
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
$Data = DllStructGetData($Struct,"Data")
If @error Then Return SetError(3,0,"")
Return SetError(0,0,$Data)
Case 8
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
$Data = DllStructGetData($Struct,"Data")
If @error Then Return SetError(3,0,"")
Return SetError(0,0,Default)
Case Else
DllCall("kernel32.dll","BOOL","GlobalUnlock","handle",$hMemory)
Return SetError(4,0,"")
EndSwitch
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")
If $RE < 1 Or $CE < 1 Then Return SetError(1,0,False)
$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
$Value = GetAt2D($CArrayStruct,$i,$j)
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()
Return SetError(0,0,True)
EndFunc

Examples Of CArray1D

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)

Find_1D.au3

#include "CArray.au3"
$vArray1D = CArray1D(6)
SetAt1D($vArray1D,0,"CHAR")
SetAt1D($vArray1D,1,"WORD")
SetAt1D($vArray1D,2,"INT ")
SetAt1D($vArray1D,3,"BOOL")
SetAt1D($vArray1D,4,"LONG")
SetAt1D($vArray1D,5,"1234")
Display($vArray1D)

$Result = Find1D($vArray1D,"bool")
;Find1D(ByRef $CArray1D,$vValue,$begin = -1,$End = -1,$CaseSensitive = false)
;vValue ==> bool
;begin ==> -1 Default From 0
;End ==> -1 Default To Last RowIndex
;BOOL CaseSensitive ==> Default false
if ($Result <> -1) Then
MsgBox(0,"Results","Found The  bool value in RowIndex " & $Result)
Else
MsgBox(0,"Error","Is not found, the  bool value")
EndIf

Display($vArray1D)
$Result = Find1D($vArray1D,"bOOL",-1,-1,true)
;Find1D(ByRef $CArray1D,$vValue,$begin = -1,$End = -1,$CaseSensitive = false)
;vValue ==> bOOL
;begin ==> -1 Default From 0
;End ==> -1 Default To Last RowIndex
;BOOL CaseSensitive ==> true
if ($Result <> -1) Then
MsgBox(0,"Results","Found The  bOOL value in RowIndex " & $Result)
Else
MsgBox(0,"Error","Is not found, the  bOOL value")
EndIf

Display($vArray1D)
$Result = Find1D($vArray1D,"LONG",0,4,true)
;Find1D(ByRef $CArray1D,$vValue,$begin = -1,$End = -1,$CaseSensitive = false)
;vValue ==> LONG
;begin ==> from RowIndex 0
;End ==> To RowIndex 4
;BOOL CaseSensitive ==> true
if ($Result <> -1) Then
MsgBox(0,"Results","Found The  LONG value in RowIndex " & $Result)
Else
MsgBox(0,"Error","Is not found, the  LONG value")
EndIf

Display($vArray1D)
$Result = Find1D($vArray1D,"LONG",0,2,true)
;Find1D(ByRef $CArray1D,$vValue,$begin = -1,$End = -1,$CaseSensitive = false)
;vValue ==> LONG
;begin ==> from RowIndex 0
;End ==> To RowIndex 2
;BOOL CaseSensitive ==> true
if ($Result <> -1) Then
MsgBox(0,"Results","Found The  LONG value in RowIndex " & $Result,0)
Else
MsgBox(0,"Error","Is not found, the  LONG value")
EndIf
DeleteCArray1D($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($iArray1D)
DeleteCArray1D($vArray1D)

$nArray1D = CArray1D(1)
; 1 ==> Rows Count
For $i = 0 To 10
;SetAtGrow1D(ByRef $CArray1D,$RowIndex,$vValue)
$Rt = SetAtGrow1D($nArray1D,$i,$i)
; i ==> Row Index And vValue
Next
Display($nArray1D)
DeleteCArray1D($nArray1D)

UBoundReDim_1D.au3

#include "CArray.au3"

$iArray1D = CArray1D(0)
; 0 ==> Rows Count
ReDim1D($iArray1D,4);4 ==> Rows Count
; ReDim1D(ByRef $CArray1D,$RowsCount)
Display($iArray1D)
$RowsCount = UBound1D($iArray1D);Get Rows Count
;UBound1D(ByRef $CArray1D)
MsgBox(0,"UBound","RowsCount = " & $RowsCount,0);
DeleteCArray1D($iArray1D)

$jArray1D = CArray1D(5)
;5 ==> Rows Count
ReDim1D($jArray1D,3); 3 ==> Rows Count
Display($jArray1D)
$RowsCount = UBound1D($jArray1D);Get Rows Count
MsgBox(0,"UBound","RowsCount = " & $RowsCount,0);
DeleteCArray1D($jArray1D)

$vArray1D = CArray1D(4) ; 4 ==> Rows Count
SetAt1D($vArray1D,0,"0")
SetAt1D($vArray1D,1,"1")
SetAt1D($vArray1D,2,"2")
SetAt1D($vArray1D,3,"3")
ReDim1D($vArray1D,1); // 1 ==> Rows Count
Display($vArray1D)
$RowsCount = UBound1D($vArray1D);Get Rows Count
MsgBox(0,"UBound","RowsCount = " & $RowsCount,0);
DeleteCArray1D($vArray1D)

Examples Of CArray2D

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 In 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 In 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 In The RowIndex 1 And 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 In 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 In 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 In The RowIndex 1 And 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 = SetAtGrow2D($nArray2D,$i,$j,($i * $j)) ; iArray2D(i,j,(i * j))
;SetAtGrow2D(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(0,0)
; 0 ==> Rows Count ; 0 ==> Column Count
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(0,5)
; 0 ==> Rows Count ; 5 ==> Column Count
ReDim2D($jArray2D,3,5) ; 3 ==> Rows Count ; 5 ==> Columns Count
Display($jArray2D)
DeleteCArray2D($jArray2D)

$nArray2D = CArray2D(5,0)
; 5 ==> Rows Count ; 0 ==> Column Count
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")
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)
Edited by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites



Something about CArray that might be of some interest to some. (if not already known)

http://www.codeproject.com/Articles/255/CArray-A-simple-but-highly-efficient-improvement


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

Something about CArray that might be of some interest to some. (if not already known)

http://www.codeproject.com/Articles/255/...-simple-but-highly-efficient-i

Thanks

My Project C++

CArray_C++.zip

#include <windows.h>
#include <stdio.h>
#include <typeinfo.h>
#include <wchar.h>
#include "Display.h"

template<class DataType,int RowsCount ,int ColsCount>class DimArray2D
{
int iRowsCount,iColsCount;
DataType** Array2D;
int SizeOfType;
public:
DimArray2D(void)
{
iRowsCount = RowsCount;
iColsCount = ColsCount;
if (iRowsCount < 0) iRowsCount = 0;
if (iColsCount < 0) iColsCount = 0;
SizeOfType = sizeof(DataType);
Array2D = new DataType*[iRowsCount];
for (int i = 0; i < iRowsCount; i++)
{
Array2D[i] = new DataType[iColsCount];
RtlZeroMemory(Array2D[i],(iColsCount * SizeOfType));
}
}

void operator()(int RowIndex,int ColuIndex,DataType vValue,BOOL SetAtGrow = false)
{
if (SetAtGrow)
{
int iRowIndex = iRowsCount, iColuIndex = iColsCount;
if (RowIndex > (iRowsCount - 1)) iRowIndex = (RowIndex + 1);
if (ColuIndex > (iColsCount - 1)) iColuIndex = (ColuIndex + 1);
if (RowIndex > (iRowsCount - 1) || ColuIndex > (iColsCount - 1)) ReDim(iRowIndex,iColuIndex);
Array2D[RowIndex][ColuIndex] = vValue;
} else {
Array2D[RowIndex][ColuIndex] = vValue;
}
}

DataType* operator[](int RowIndex)
{
return Array2D[RowIndex];
}

BOOL operator()()
{
return Delete(iRowsCount - 1);
}

int UBound(int Dimension = 1)
{
if (Dimension == 1) return iRowsCount;
if (Dimension == 2) return iColsCount;
return -1;
}

BOOL ReDim(int RowsCount,int ColusCount)
{
if (RowsCount < 0 || ColusCount < 0) return false;
DataType** NewArray = new DataType*[RowsCount];
int pRowsCount = iRowsCount;
int pColusCount = iColsCount;
if (RowsCount < iRowsCount) pRowsCount = RowsCount;
if (ColusCount < iColsCount) pColusCount = ColusCount;
for (int i = 0; i < RowsCount ; i++)
{
NewArray[i] = new DataType[ColusCount];
RtlZeroMemory(NewArray[i],((ColusCount) * SizeOfType));
if (i < pRowsCount)
{
RtlMoveMemory(NewArray[i],Array2D[i],(SizeOfType * pColusCount));
delete [] Array2D[i];
}
}
delete [] Array2D;
Array2D = NewArray;
iRowsCount = RowsCount;
iColsCount = ColusCount;
return true;
}

DataType GetAt(int RowIndex,int ColuIndex)
{
if (RowIndex < 0 ||  RowIndex > (iRowsCount -1) ||
ColuIndex < 0 ||  ColuIndex > (iColsCount -1)) {
SetLastError(1);
return NULL;
}
SetLastError(0);
return Array2D[RowIndex][ColuIndex];
}

BOOL SetAt(int RowIndex,int ColuIndex,DataType vValue)
{
if (RowIndex < 0 ||  RowIndex > (iRowsCount -1) ||  ColuIndex < 0
|| ColuIndex > (iColsCount -1)) return false;
Array2D[RowIndex][ColuIndex] = vValue;
return true;
}

BOOL SetAtGrow(int RowIndex,int ColuIndex,DataType vValue)
{
if (RowIndex < 0 || ColuIndex < 0) return false;
int iRowIndex = iRowsCount, iColuIndex = iColsCount;
if (RowIndex > (iRowsCount - 1)) iRowIndex = (RowIndex + 1);
if (ColuIndex > (iColsCount - 1)) iColuIndex = (ColuIndex + 1);
if (RowIndex > (iRowsCount - 1) || ColuIndex > (iColsCount - 1)) ReDim(iRowIndex,iColuIndex);
Array2D[RowIndex][ColuIndex] = vValue;
return true;
}

BOOL Add(int RowsCount = 1,BOOL RowsEnd = true,int ColsCount = 0,BOOL ColsEnd = true)
{
if (RowsCount < 0 || ColsCount < 0) return false;
int vIndex = 0;
DataType** NewArray = new DataType*[(iRowsCount + RowsCount)];
for (int i = 0; i < (iRowsCount + RowsCount); i++)
{
if (RowsEnd ==  false && i < RowsCount)
{
NewArray[i] = new DataType[iColsCount + ColsCount];
RtlZeroMemory(NewArray[i],((iColsCount + ColsCount) * SizeOfType));
} else {
NewArray[i] = new DataType[iColsCount + ColsCount];
RtlZeroMemory(NewArray[i],((iColsCount + ColsCount) * SizeOfType));
if (ColsEnd == true)
{
if (vIndex < iRowsCount)
{
RtlMoveMemory(NewArray[i],Array2D[vIndex],(SizeOfType * iColsCount));
delete [] Array2D[vIndex];
}
} else {
if (vIndex < iRowsCount)
{
RtlMoveMemory(NewArray[i] + ColsCount,Array2D[vIndex],(SizeOfType * iColsCount));
delete [] Array2D[vIndex];
}
}
vIndex += 1;
}
}
delete [] Array2D;
Array2D = NewArray;
iRowsCount += RowsCount;
iColsCount += ColsCount;
return true;
}

BOOL Insert(int RowIndex = 0,int RowsCount = 1,int ColuIndex = 0,int ColsCount = 0)
{
if (RowIndex < 0 || ColuIndex < 0 || RowIndex > (iRowsCount -1)
|| ColuIndex > (iColsCount - 1)) return false;
int vIndex = 0;
DataType** NewArray = new DataType*[iRowsCount + RowsCount];
for (int i = 0; i < (iRowsCount + RowsCount); i++)
{
NewArray[i] = new DataType[(iColsCount + ColsCount)];
RtlZeroMemory(NewArray[i],((iColsCount + ColsCount) * SizeOfType));
if (i < RowIndex || i > RowIndex + (RowsCount - 1))
{
RtlMoveMemory(NewArray[i],Array2D[vIndex],(SizeOfType * ColuIndex));
RtlMoveMemory(NewArray[i] + (ColuIndex + ColsCount),Array2D[vIndex] + ColuIndex,
SizeOfType * (iColsCount - ColuIndex));
delete [] Array2D[vIndex];
vIndex += 1;
}
}
delete [] Array2D;
Array2D = NewArray;
iRowsCount += RowsCount;
iColsCount += ColsCount;
return true;
}

BOOL Delete(int RowIndex = 0,int RowsCount = 1,int ColuIndex = 0,int ColsCount = 0)
{
if (RowIndex < 0 || ColuIndex < 0 || RowsCount > (iRowsCount - RowIndex)
|| ColsCount > (iColsCount - ColuIndex)) return false;
int vIndex = 0;
DataType** NewArray = new DataType*[(iRowsCount - RowsCount)];
for (int i = 0 ; i < iRowsCount; i++)
{
if (i < RowIndex || i > (RowIndex + (RowsCount - 1)))
{
NewArray[vIndex] = new DataType[(iColsCount - ColsCount)];
RtlZeroMemory(NewArray[vIndex],((iColsCount - ColsCount) * SizeOfType));
RtlMoveMemory(NewArray[vIndex],Array2D[i],(SizeOfType * ColuIndex));
RtlMoveMemory(NewArray[vIndex] + ColuIndex,Array2D[i] + (ColuIndex + ColsCount),
SizeOfType * (iColsCount - (ColuIndex + ColsCount)));
delete [] Array2D[vIndex];
vIndex += 1;
}
}
delete [] Array2D;
Array2D = NewArray;
iRowsCount -= RowsCount;
iColsCount -= ColsCount;
return true;
}

int* Find(DataType vValue,int RowIndex = -1, int ColuIndex = -1,BOOL CaseSensitive = false)
{
int RtIndex[2];
if (RowIndex == -1) RowIndex = (iRowsCount - 1);
if (ColuIndex == -1) ColuIndex = (iColsCount - 1);
if (RowIndex < 0 || RowIndex > (iRowsCount - 1)
|| ColuIndex < 0 || ColuIndex > ((iColsCount -1))) return NULL;
if (typeid(DataType) == typeid(char*) || typeid(DataType) == typeid(WCHAR*))
{
if (typeid(DataType) == typeid(char*))
{
char* cValue = GetCharsA(vValue);
if (!(CaseSensitive)) cValue = StrToUpperA(GetCharsA(vValue));
for (int i = 0; i <= RowIndex; i++)
{
for (int j = 0; j <= ColuIndex; j++)
{
RtIndex[0] = i;
RtIndex[1] = j;
if (!(CaseSensitive))
{
if (strcmp(StrToUpperA(GetCharsA(Array2D[i][j])),cValue) == 0) return RtIndex;
} else {
if (strcmp(GetCharsA(Array2D[i][j]),cValue) == 0) return RtIndex;
}
}}
} else {
WCHAR* cValue = GetCharsW(vValue);
if (!(CaseSensitive)) cValue = StrToUpperW(GetCharsW(vValue));
for (int i = 0; i <= RowIndex; i++)
{
for (int j = 0; j <= ColuIndex; j++)
{
RtIndex[0] = i;
RtIndex[1] = j;
if (!(CaseSensitive))
{
if (wcscmp(StrToUpperW(GetCharsW(Array2D[i][j])),cValue) == 0) return RtIndex;
} else {
if (wcscmp(GetCharsW(Array2D[i][j]),cValue) == 0) return RtIndex;
}
}}
}
} else {
for (int i = 0; i <= RowIndex; i++)
{
for (int j = 0; j <= ColuIndex; j++)
{
RtIndex[0] = i;
RtIndex[1] = j;
if (memcmp(&Array2D[i][j],&vValue,SizeOfType) == 0) return RtIndex;
}}
}
return NULL;
}

DataType** GetBuffer()
{
return Array2D;
}

WCHAR* StrToUpperW(WCHAR* iString)
{
if (iString == NULL) return iString;
int vLen = wcslen(iString);
WCHAR* pString = new WCHAR[vLen + 1];
for (int i = 0 ; i < vLen; i++)
{pString[i] = towupper(iString[i]);}
pString[vLen] = L'\0';
return pString;
}

char* StrToUpperA(char* iString)
{
if (iString == NULL) return iString;
int vLen = strlen(iString);
char* pString = new char[vLen + 1];
for (int i = 0 ; i < vLen; i++)
{pString[i] = toupper(iString[i]);}
pString[vLen] = '\0';
return pString;
}

char* GetCharsA(DataType iString)
{
char** cString = reinterpret_cast<char**>(&iString);
return cString[0];
}

WCHAR* GetCharsW(DataType iString)
{
WCHAR** cString = reinterpret_cast<WCHAR**>(&iString);
return cString[0];
}

BOOL Display(char* Title = "Display Array2D",int LastRowIndex = 1001,int LastColuIndex = 251)
{
//return
//Success: True
//Failure: False
if (iRowsCount == 0 || iColsCount == 0) return false;
wchar_t* StrA = new wchar_t[33], *StrB = new wchar_t[33] , *VALUE = new wchar_t[1000];
HWND TrayWnd = FindWindowW(L"Shell_TrayWnd",L"");
RECT TaslpRect , DesklpRect , ClientRect;
if (TrayWnd) GetWindowRect(TrayWnd,&TaslpRect);
GetWindowRect(GetDesktopWindow(),&DesklpRect);
HMODULE HMOD = GetModuleHandle(0);
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style          = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc    = DisplayProc;
wcex.cbClsExtra     = 0;
wcex.cbWndExtra     = 0;
wcex.hInstance      = HMOD;
wcex.hIcon          = 0;
wcex.hCursor        = 0;
wcex.hbrBackground  = (HBRUSH)GetSysColorBrush(COLOR_3DFACE);
wcex.lpszMenuName   = NULL;
wcex.lpszClassName  = "win32app";
wcex.hIconSm        = 0;
RegisterClassEx(&wcex);
HWND hWnd = CreateWindow("win32app",Title,WS_OVERLAPPEDWINDOW,0,0,1,1,0,0,HMOD,0);
DWORD dwStyle = WS_CHILD | ILVS_EX_GRIDLINES | ILVS_EX_FULLROWSELECT | ILVS_EX_SUBITEMIMAGES | ILVS_EX_FLATSB | ILVS_EX_MULTIWORKAREAS;
hDisplayListView = CreateWindowExW(0,L"SysListView32",L"",WS_CHILD | ILVS_REPORT | ILVS_EDITLABELS,0,0,1,1,hWnd,0,HMOD,0);
SendMessage(hDisplayListView,WM_SETFONT,(WPARAM) GetStockObject(17),(LPARAM) true);
SendMessage(hDisplayListView,ILVM_SETEXTENDEDLISTVIEWSTYLE,0,(LPARAM) dwStyle);
InvalidateRect(hDisplayListView,0,true);
SelectButton = CreateWindowExW(0,L"Button",L"Copy Selected",WS_TABSTOP|WS_VISIBLE|WS_CHILD|BS_NOTIFY,0,0,1,1,hWnd,0,HMOD,0);
if (iRowsCount < LastRowIndex) LastRowIndex = iRowsCount;
if (iColsCount < LastColuIndex) LastColuIndex = iColsCount;
for (int j = 1; j <= LastColuIndex; j++)
{
for (int i = 1; i <= LastRowIndex; i++)
{
delete [] VALUE;
VALUE = new wchar_t[1000];
RtlZeroMemory(VALUE,1000);
if (typeid(DataType) == typeid(char*))
{
char* iString = GetCharsA(Array2D[i - 1][j - 1]);
if (iString != NULL)
{
delete [] VALUE;
VALUE = new wchar_t[strlen(iString) + 1];
swprintf(VALUE,L"%hs",iString);
}
} else if (typeid(DataType) == typeid(WCHAR*))
{
delete [] VALUE;
VALUE = GetCharsW(Array2D[i - 1][j - 1]);
} else if (typeid(DataType) == typeid(char))
{
swprintf(VALUE,L"%c",Array2D[i - 1][j - 1]);
} else if (typeid(DataType) == typeid(WCHAR))
{
swprintf(VALUE,L"%c",Array2D[i - 1][j - 1]);
} else if (typeid(DataType) == typeid(double))
{
swprintf(VALUE,L"%G",Array2D[i - 1][j - 1]);
} else if (typeid(DataType) == typeid(float))
{
swprintf(VALUE,L"%G",Array2D[i - 1][j - 1]);
} else if (typeid(DataType) == typeid(int))
{
swprintf(VALUE,L"%d",Array2D[i - 1][j - 1]);
} else if (typeid(DataType) == typeid(UINT))
{
swprintf(VALUE,L"%u",Array2D[i - 1][j - 1]);
} else if (typeid(DataType) == typeid(long))
{
swprintf(VALUE,L"%d",Array2D[i - 1][j - 1]);
} else if (typeid(DataType) == typeid(DWORD))
{
swprintf(VALUE,L"%u",Array2D[i - 1][j - 1]);
} else if (typeid(DataType) == typeid(short))
{
swprintf(VALUE,L"%hi",Array2D[i - 1][j - 1]);
} else if (typeid(DataType) == typeid(USHORT))
{
swprintf(VALUE,L"%hu",Array2D[i - 1][j - 1]);
} else {
swprintf(VALUE,L"%p",Array2D[i - 1][j - 1]);
}
delete [] StrA;
delete [] StrB;
StrA = new wchar_t[33];
StrB = new wchar_t[33];
RtlZeroMemory(StrA,33);
RtlZeroMemory(StrB,33);
_itow(j - 1,StrB,10);
StrA = StringAddW(StrA,L"Column ");
StrA = StringAddW(StrA,StrB);
if (i == 1 && j == 1) iAddColumn(hDisplayListView,L"Row",70);
if (i == 1) iAddColumn(hDisplayListView,StrA,70);
if (j == 1)
{
delete [] StrA;
delete [] StrB;
StrA = new wchar_t[33];
StrB = new wchar_t[33];
RtlZeroMemory(StrA,33);
RtlZeroMemory(StrB,33);
_itow(i - 1,StrB,10);
StrA = StringAddW(StrA,L"[");
StrA = StringAddW(StrA,StrB);
StrA = StringAddW(StrA,L"]");
AddItem(hDisplayListView,i);
AddSubItem(hDisplayListView,i - 1,StrA,j - 1);
AddSubItem(hDisplayListView,i - 1,VALUE,j);
} else {
AddSubItem(hDisplayListView,i - 1,VALUE,j);
}
}
}
int DH = DesklpRect.bottom - DesklpRect.top;
int DW = DesklpRect.right - DesklpRect.left;
int TH = TaslpRect.bottom - TaslpRect.top;
int TW = TaslpRect.right - TaslpRect.left;
int GUIW = (70 * (LastColuIndex+ 1) + 25);
int GUIH = (25 * (LastRowIndex + 1));
if (GUIW < 250) GUIW = 230;
GUIW += 20;
if (GUIW > DW) GUIW = DW;
GUIH += 20;
if (GUIH < 250) GUIH = 230;
if (GUIH > (DH - TH)) GUIH = (DH - TH);
SetWindowPos(hWnd,0,0,0,GUIW,GUIH,0);
GetClientRect(hWnd,&ClientRect);
int CH = (ClientRect.bottom - ClientRect.top) - 35;
int CW = (ClientRect.right - ClientRect.left) - 5;
SetWindowPos(SelectButton,0,ClientRect.left + 10,ClientRect.top + (CH + 10),CW - 20,20,0);
SetWindowPos(hDisplayListView,0,ClientRect.left + 5,ClientRect.top,CW - 5,CH,0);
ShowWindow(hWnd,5);
ShowWindow(hDisplayListView,5);
ShowWindow(SelectButton,5);
MSG msg;
while (GetMessage(&msg,0,0,0))
{
if (!TranslateAccelerator(msg.hwnd,0, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return true;
}
};

template<class DataType,int RowsCount>class DimArray1D
{
int iRowsCount;
DataType* Array1D;
int SizeOfType;
public:
DimArray1D(void)
{
iRowsCount = RowsCount;
SizeOfType = sizeof(DataType);
if (iRowsCount < 0) iRowsCount = 0;
Array1D = new DataType[iRowsCount];
RtlZeroMemory(Array1D,(iRowsCount * SizeOfType));
}

void operator()(int RowIndex,DataType vValue,BOOL SetAtGrow = false)
{
if (SetAtGrow)
{
if (RowIndex > (iRowsCount - 1))
{
DataType* NewArray = new DataType[(RowIndex + 1)];
RtlZeroMemory(NewArray,((RowIndex + 1) * SizeOfType));
RtlMoveMemory(NewArray,Array1D,(SizeOfType * iRowsCount));
delete [] Array1D;
iRowsCount = (RowIndex + 1);
Array1D = NewArray;
}
Array1D[RowIndex] = vValue;
} else {
Array1D[RowIndex] = vValue;
}
}

DataType operator[](int RowIndex)
{
return Array1D[RowIndex];
}

BOOL operator()(DataType vValue)
{
return Add(vValue);
}

BOOL operator()(void)
{
return DeleteAt(iRowsCount - 1);
}

int UBound()
{
return iRowsCount;
}

BOOL ReDim(int RowsCount)
{
if (RowsCount < 0) return false;
if (RowsCount < iRowsCount) iRowsCount = RowsCount;
DataType* NewArray = new DataType[RowsCount];
RtlZeroMemory(NewArray,(RowsCount * SizeOfType));
RtlMoveMemory(NewArray,Array1D,(SizeOfType * iRowsCount));
delete [] Array1D;
Array1D = NewArray;
iRowsCount = RowsCount;
return true;
}

DataType GetAt(int RowIndex)
{
if (RowIndex < 0 || RowIndex > (iRowsCount -1))
{
SetLastError(1);
return NULL;
}
SetLastError(0);
return Array1D[RowIndex];
}

BOOL SetAt(int RowIndex,DataType vValue)
{
if (RowIndex < 0 || RowIndex > (iRowsCount -1)) return false;
Array1D[RowIndex] = vValue;
return true;
}

BOOL SetAtGrow(int RowIndex,DataType vValue)
{
if (RowIndex < 0) return false;
int iRowIndex = iRowsCount;
if (RowIndex > (iRowsCount - 1)) iRowIndex = (RowIndex + 1);
if (RowIndex > (iRowsCount - 1)) ReDim(iRowIndex);
Array1D[RowIndex] = vValue;
return true;
}

BOOL Add(DataType vValue,BOOL End = true)
{
DataType* NewArray = new DataType[iRowsCount + 1];
RtlZeroMemory(NewArray,((iRowsCount + 1) * SizeOfType));
if (End)
{
RtlMoveMemory(NewArray,Array1D,(SizeOfType * iRowsCount));
NewArray[iRowsCount] = vValue;
} else {
RtlMoveMemory(NewArray + 1,Array1D,(SizeOfType * iRowsCount));
NewArray[0] = vValue;
}
delete [] Array1D;
Array1D = NewArray;
iRowsCount += 1;
return true;
}

BOOL DeleteAt(int RowIndex)
{
if (RowIndex < 0 || RowIndex > (iRowsCount -1)) return false;
int iSize = (SizeOfType * (iRowsCount - (RowIndex + 1)));
DataType* NewArray = new DataType[iRowsCount - 1];
RtlZeroMemory(NewArray,((iRowsCount - 1) * SizeOfType));
RtlMoveMemory(NewArray,Array1D,(SizeOfType * RowIndex));
RtlMoveMemory(NewArray + RowIndex,Array1D + (RowIndex + 1),iSize);
delete [] Array1D;
Array1D = NewArray;
iRowsCount -= 1;
return true;
}

BOOL InsertAt(int RowIndex,DataType vValue)
{
if (RowIndex < 0 || RowIndex > (iRowsCount -1)) return false;
int iSize = (SizeOfType * (iRowsCount - RowIndex));
DataType* NewArray = new DataType[iRowsCount + 1];
RtlZeroMemory(NewArray,((iRowsCount + 1) * SizeOfType));
RtlMoveMemory(NewArray,Array1D,(SizeOfType * RowIndex));
RtlMoveMemory(NewArray + (RowIndex + 1),Array1D + RowIndex,iSize);
delete [] Array1D;
NewArray[RowIndex] = vValue;
Array1D = NewArray;
iRowsCount += 1;
return true;
}

int Find(DataType vValue,int begin = -1, int End = -1,BOOL CaseSensitive = false)
{
if (End == -1) End = (iRowsCount - 1);
if (begin == -1) begin = 0;
if (begin < 0 || begin > (iRowsCount -1) || End < 0
|| End > (iRowsCount -1) || End < begin) return -1;
if (typeid(DataType) == typeid(char*) || typeid(DataType) == typeid(WCHAR*))
{
if (typeid(DataType) == typeid(char*))
{
char* cValue = GetCharsA(vValue);
if (!(CaseSensitive)) cValue = StrToUpperA(GetCharsA(vValue));
for (int i = begin; i <= End; i++)
{
if (!(CaseSensitive))
{
if (strcmp(StrToUpperA(GetCharsA(Array1D[i])),cValue) == 0) return i;
} else {
if (strcmp(GetCharsA(Array1D[i]),cValue) == 0) return i;
}
}
} else {
WCHAR* cValue = GetCharsW(vValue);
if (!(CaseSensitive)) cValue = StrToUpperW(GetCharsW(vValue));
for (int i = begin; i <= End; i++)
{
if (!(CaseSensitive))
{
if (wcscmp(StrToUpperW(GetCharsW(Array1D[i])),cValue) == 0) return i;
} else {
if (wcscmp(GetCharsW(Array1D[i]),cValue) == 0) return i;
}
}
}
} else {
for (int i = begin; i <= End; i++)
{
if (memcmp(&Array1D[i],&vValue,SizeOfType) == 0) return i;
}
}
return -1;
}

DataType* GetBuffer()
{
return Array1D;
}

WCHAR* StrToUpperW(WCHAR* iString)
{
if (iString == NULL) return iString;
int vLen = wcslen(iString);
WCHAR* pString = new WCHAR[vLen + 1];
for (int i = 0 ; i < vLen; i++)
{pString[i] = towupper(iString[i]);}
pString[vLen] = L'\0';
return pString;
}

char* StrToUpperA(char* iString)
{
if (iString == NULL) return iString;
int vLen = strlen(iString);
char* pString = new char[vLen + 1];
for (int i = 0 ; i < vLen; i++)
{pString[i] = toupper(iString[i]);}
pString[vLen] = '\0';
return pString;
}

char* GetCharsA(DataType iString)
{
char** cString = reinterpret_cast<char**>(&iString);
return cString[0];
}

WCHAR* GetCharsW(DataType iString)
{
WCHAR** cString = reinterpret_cast<WCHAR**>(&iString);
return cString[0];
}

BOOL Display(char* Title = "Display Array1D",int LastRowIndex = 250000)
{
if (!(iRowsCount)) return false;
wchar_t* StrA = new wchar_t[33], *StrB = new wchar_t[33] , *VALUE = new wchar_t[1000];
HWND TrayWnd = FindWindowW(L"Shell_TrayWnd",L"");
RECT TaslpRect , DesklpRect , ClientRect;
if (TrayWnd) GetWindowRect(TrayWnd,&TaslpRect);
GetWindowRect(GetDesktopWindow(),&DesklpRect);
HMODULE HMOD = GetModuleHandle(0);
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style          = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc    = DisplayProc;
wcex.cbClsExtra     = 0;
wcex.cbWndExtra     = 0;
wcex.hInstance      = HMOD;
wcex.hIcon          = 0;
wcex.hCursor        = 0;
wcex.hbrBackground  = (HBRUSH)GetSysColorBrush(COLOR_3DFACE);
wcex.lpszMenuName   = NULL;
wcex.lpszClassName  = "win32app";
wcex.hIconSm        = 0;
RegisterClassEx(&wcex);
HWND hWnd = CreateWindow("win32app",Title,WS_OVERLAPPEDWINDOW,0,0,1,1,0,0,HMOD,0);
DWORD dwStyle = WS_CHILD | ILVS_EX_GRIDLINES | ILVS_EX_FULLROWSELECT | ILVS_EX_SUBITEMIMAGES | ILVS_EX_FLATSB | ILVS_EX_MULTIWORKAREAS;
hDisplayListView = CreateWindowExW(0,L"SysListView32",L"",WS_CHILD | ILVS_REPORT | ILVS_EDITLABELS,0,0,1,1,hWnd,0,HMOD,0);
SendMessage(hDisplayListView,WM_SETFONT,(WPARAM) GetStockObject(17),(LPARAM) true);
SendMessage(hDisplayListView,ILVM_SETEXTENDEDLISTVIEWSTYLE,0,(LPARAM) dwStyle);
InvalidateRect(hDisplayListView,0,true);
SelectButton = CreateWindowExW(0,L"Button",L"Copy Selected",WS_TABSTOP|WS_VISIBLE|WS_CHILD|BS_NOTIFY,0,0,1,1,hWnd,0,HMOD,0);
int LastColsIndex = 1;
if (iRowsCount < LastRowIndex) LastRowIndex = iRowsCount;
for (int j = 1; j <= LastColsIndex; j++)
{
for (int i = 1; i <= LastRowIndex; i++)
{
delete [] VALUE;
VALUE = new wchar_t[1000];
RtlZeroMemory(VALUE,1000);
if (typeid(DataType) == typeid(char*))
{
char* iString = GetCharsA(Array1D[i - 1]);
if (iString != NULL)
{
delete [] VALUE;
VALUE = new wchar_t[strlen(iString) + 1];
swprintf(VALUE,L"%hs",iString);
}
} else if (typeid(DataType) == typeid(WCHAR*))
{
delete [] VALUE;
VALUE = GetCharsW(Array1D[i - 1]);
} else if (typeid(DataType) == typeid(char))
{
swprintf(VALUE,L"%c",Array1D[i - 1]);
} else if (typeid(DataType) == typeid(WCHAR))
{
swprintf(VALUE,L"%c",Array1D[i - 1]);
} else if (typeid(DataType) == typeid(double))
{
swprintf(VALUE,L"%G",Array1D[i - 1]);
} else if (typeid(DataType) == typeid(float))
{
swprintf(VALUE,L"%G",Array1D[i - 1]);
} else if (typeid(DataType) == typeid(int))
{
swprintf(VALUE,L"%d",Array1D[i - 1]);
} else if (typeid(DataType) == typeid(UINT))
{
swprintf(VALUE,L"%u",Array1D[i - 1]);
} else if (typeid(DataType) == typeid(long))
{
swprintf(VALUE,L"%d",Array1D[i - 1]);
} else if (typeid(DataType) == typeid(DWORD))
{
swprintf(VALUE,L"%u",Array1D[i - 1]);
} else if (typeid(DataType) == typeid(short))
{
swprintf(VALUE,L"%hi",Array1D[i - 1]);
} else if (typeid(DataType) == typeid(USHORT))
{
swprintf(VALUE,L"%hu",Array1D[i - 1]);
} else {
if (strstr(typeid(DataType).name(),"*") != NULL)
{
swprintf(VALUE,L"%p",Array1D[i - 1]);
} else {
swprintf(VALUE,L"%d",Array1D[i - 1]);
}
}
delete [] StrA;
delete [] StrB;
StrA = new wchar_t[33];
RtlZeroMemory(StrA,33);
StrB = new wchar_t[33];
RtlZeroMemory(StrB,33);
_itow(j - 1,StrB,10);
StrA = StringAddW(StrA,L"Column ");
StrA = StringAddW(StrA,StrB);
if (i == 1 && j == 1) iAddColumn(hDisplayListView,L"Row",70);
if (i == 1) iAddColumn(hDisplayListView,StrA,70);
if (j == 1)
{
delete [] StrA;
delete [] StrB;
StrA = new wchar_t[33];
RtlZeroMemory(StrA,33);
StrB = new wchar_t[33];
RtlZeroMemory(StrB,33);
_itow(i - 1,StrB,10);
StrA = StringAddW(StrA,L"[");
StrA = StringAddW(StrA,StrB);
StrA = StringAddW(StrA,L"]");
AddItem(hDisplayListView,i);
AddSubItem(hDisplayListView,i - 1,StrA,j - 1);
AddSubItem(hDisplayListView,i - 1,VALUE,j);
} else {
AddSubItem(hDisplayListView,i - 1,VALUE,j);
}
}
}
int DH = DesklpRect.bottom - DesklpRect.top;
int DW = DesklpRect.right - DesklpRect.left;
int TH = TaslpRect.bottom - TaslpRect.top;
int TW = TaslpRect.right - TaslpRect.left;
int GUIW = (70 + 25);
int GUIH = (25 * (LastRowIndex + 1));
if (GUIW < 250) GUIW = 230;
GUIW += 20;
if (GUIW > DW) GUIW = DW;
GUIH += 20;
if (GUIH < 250) GUIH = 230;
if (GUIH > (DH - TH)) GUIH = (DH - TH);
SetWindowPos(hWnd,0,0,0,GUIW,GUIH,0);
GetClientRect(hWnd,&ClientRect);
int CH = (ClientRect.bottom - ClientRect.top) - 35;
int CW = (ClientRect.right - ClientRect.left) - 5;
SetWindowPos(SelectButton,0,ClientRect.left + 10,ClientRect.top + (CH + 10),CW - 20,20,0);
SetWindowPos(hDisplayListView,0,ClientRect.left + 5,ClientRect.top,CW - 5,CH,0);
ShowWindow(hWnd,5);
ShowWindow(hDisplayListView,5);
ShowWindow(SelectButton,5);
MSG msg;
while (GetMessage(&msg,0,0,0))
{
if (!TranslateAccelerator(msg.hwnd,0, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return true;
}
};

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0