Jump to content

UEZ

MVPs
  • Posts

    7,354
  • Joined

  • Last visited

  • Days Won

    83

UEZ last won the day on July 8

UEZ had the most liked content!

About UEZ

Profile Information

  • Member Title
    Never say never
  • Location
    Germany
  • Interests
    Computer, watching movies, football (soccer), being lazy :-)

Recent Profile Visitors

9,617 profile views

UEZ's Achievements

  1. I've an experience with safe arrays. Converted from the C code above: Global Const $VT_I4 = 3 Global Const $VT_VARIANT = 12 Global Const $tagSAFEARRAYBOUND = "ulong cElements; long lLbound;" Global Const $tagVARIANT = "ushort vt; ushort r1; ushort r2; ushort r3; int lVal; ptr dummy" Global Const $tagSAFEARRAY = _ "ushort cDims;" & _ ; The number of dimensions. "ushort fFeatures;" & _ ; Flags, see below. "ulong cbElements;" & _ ; The size of an array element. "ulong cLocks;" & _ ; The number of times the array has been locked without a corresponding unlock. "ptr pvData;" & _ ; The data. $tagSAFEARRAYBOUND ; One $tagSAFEARRAYBOUND for each dimension. ; Create a SafeArray with 10 VT_VARIANT elements Func CreateSafeArray() ; Prepare SAFEARRAYBOUND structure Local $bound = DllStructCreate($tagSAFEARRAYBOUND) $bound.cElements = 10 $bound.lLbound = 0 ; Call SafeArrayCreate Local $aRet = DllCall("oleaut32.dll", "ptr", "SafeArrayCreate", "ushort", $VT_VARIANT, "uint", 1, "struct*", $bound) If @error Or IsPtr($aRet[0]) = 0 Then ConsoleWrite("SafeArrayCreate failed" & @CRLF) Return SetError(1, 0, 0) EndIf Local $pArray = $aRet[0] ; Lock/Access SafeArray Local $pData $aRet = DllCall("oleaut32.dll", "long", "SafeArrayAccessData", "ptr", $pArray, "ptr*", 0) If @error Or $aRet[0] <> 0 Then ConsoleWrite("SafeArrayAccessData failed" & @CRLF) DllCall("oleaut32.dll", "long", "SafeArrayDestroy", "ptr", $pArray) Return SetError(2, 0, 0) EndIf $pData = $aRet[2] ; Fill 10 VARIANTs with integer values For $i = 0 To 9 Local $variant = DllStructCreate($tagVARIANT, $pData + ($i * 16)) ;each variant has 16 bytes $variant.vt = $VT_I4 $variant.lVal = $i + 1 Next ; Unaccess array DllCall("oleaut32.dll", "long", "SafeArrayUnaccessData", "ptr", $pArray) Return $pArray ; pointer to the SafeArray EndFunc Global $pSafeArray = CreateSafeArray() Local $tSafeArray = DllStructCreate( $tagSAFEARRAY, $pSafeArray) ConsoleWrite("cDims: " & DllStructGetData( $tSAFEARRAY, "cDims" ) & @Crlf) ConsoleWrite("fFeatures: " & DllStructGetData( $tSAFEARRAY, "fFeatures" ) & @Crlf) ConsoleWrite("cbElements: " & DllStructGetData( $tSAFEARRAY, "cbElements" ) & @Crlf) ConsoleWrite("pvData: " & DllStructGetData( $tSAFEARRAY, "pvData" ) & @Crlf) ConsoleWrite("cElements: " & DllStructGetData( $tSAFEARRAY, "cElements" ) & @Crlf) ConsoleWrite("lLbound: " & DllStructGetData( $tSAFEARRAY, "lLbound" ) & @Crlf)
  2. Just made a quick test for 2D struct array: ;Code by UEZ #AutoIt3Wrapper_UseX64=y #include <WinAPIDiag.au3> #include <Memory.au3> Global Const $iWidth = 1000, $iHeight = 4000 Global Const $iTotal = $iWidth * $iHeight ConsoleWrite("Total: " & $iTotal & @CRLF) Global $t2DArray = DllStructCreate("uint a[" & $iTotal & "]") ;2D array Global $pArray = DllStructGetPtr($t2DArray) Global $x, $y, $t, $index ;2D For $y = 0 To $iHeight - 1 ;0 1 2 3 4 $t = $y * $iWidth ;10 11 12 13 14 For $x = 0 To $iWidth - 1 ;20 21 22 23 24 $index = $t + $x ;30 31 32 33 34 $t2DArray.a(($index + 1)) = $y & $x ; Next ;1D -> 0 1 2 3 4 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 Next Global $fTimer = TimerInit() ;~ Print2DArray($t2DArray, $iWidth, $iHeight) InsertValue2D(99, 0, 0, $t2DArray, $pArray, $iWidth, $iHeight, "uint") ;~ ConsoleWrite(@CRLF & "Result (add 99 at 0, 0):" & @CRLF) ConsoleWrite(TimerDiff($fTimer) & @CRLF) ;~ Print2DArray($t2DArray, $iWidth, $iHeight + 1) DeleteValue2D(2, 2, $t2DArray, $pArray, $iWidth, $iHeight + 1, "uint") ConsoleWrite(TimerDiff($fTimer) & @CRLF) ;~ ConsoleWrite(@CRLF & "Result (del 2, 2 -> 21):" & @CRLF) ;~ Print2DArray($t2DArray, $iWidth, $iHeight) Func InsertValue2D($value, $xPos, $yPos, ByRef $tStruct, ByRef $pArray, $cols, $rows, $type) Local $oldElements = $cols * $rows Local $newRows = $rows + 1 Local $newElements = $cols * $newRows Local $elementSize Switch $type Case "ushort", "short", "word" $elementSize = 2 Case "uint", "int", "float" $elementSize = 4 Case "double", "int64", "uint64" $elementSize = 8 Case Else Return SetError(1, 0, 0) EndSwitch Local $tNew = DllStructCreate($type & " a[" & $newElements & "]") Local $pNew = DllStructGetPtr($tNew) Local $insertIndex = $yPos * $cols + $xPos If $insertIndex < 0 Or $insertIndex > $oldElements Then Return SetError(1, 0, 0) _MemMoveMemory($pArray, $pNew, $insertIndex * $elementSize) $tNew.a($insertIndex + 1) = $value Local $bytesAfter = ($oldElements - $insertIndex) * $elementSize _MemMoveMemory($pArray + ($insertIndex * $elementSize), $pNew + (($insertIndex + 1) * $elementSize), $bytesAfter) $tStruct = $tNew $pArray = $pNew Return 1 EndFunc Func DeleteValue2D($xPos, $yPos, ByRef $tStruct, ByRef $pArray, $cols, $rows, $type) Local $oldElements = $cols * $rows If $rows < 2 Then Return SetError(1, 0, 0) Local $newElements = $oldElements - 1 Local $elementSize Switch $type Case "ushort", "short", "word" $elementSize = 2 Case "uint", "int", "float" $elementSize = 4 Case "double", "int64", "uint64" $elementSize = 8 Case Else Return SetError(2, 0, 0) EndSwitch Local $deleteIndex = $yPos * $cols + $xPos If $deleteIndex < 0 Or $deleteIndex >= $oldElements Then Return SetError(3, 0, 0) Local $tNew = DllStructCreate($type & " a[" & $newElements & "]") Local $pNew = DllStructGetPtr($tNew) _MemMoveMemory($pArray, $pNew, $deleteIndex * $elementSize) Local $bytesAfter = ($oldElements - $deleteIndex - 1) * $elementSize _MemMoveMemory($pArray + (($deleteIndex + 1) * $elementSize), $pNew + ($deleteIndex * $elementSize), $bytesAfter) $tStruct = $tNew $pArray = $pNew Return 1 EndFunc Func Print2DArray($t2DArray, $cols, $rows) Local $x, $y, $index For $y = 0 To $rows - 1 For $x = 0 To $cols - 1 $index = $y * $iWidth + $x ConsoleWrite($t2DArray.a($index + 1) & @TAB) Next ConsoleWrite(@CRLF) Next EndFunc It took 13 seconds to execute insert and delete operation for one element each for an array with 4.000.000 elements. I don't know how long it would take using ASM... I'm pretty rusty when it comes to ASM. ¯\_(ツ)_/¯
  3. Something like that: 1D: ;coded by UEZ #include <WinAPIDiag.au3> #include <Memory.au3> Global $iElements = 2^5 ConsoleWrite("Number of entries: " & $iElements & @CRLF) Global $tArray = DllStructCreate("uint a[" & $iElements & "]") Global $pArray = DllStructGetPtr($tArray) For $i = 1 To $iElements $tArray.a(($i)) = $i Next Global $iPos = Int($iElements * 0.667) ConsoleWrite("Insert to position " & $iPos & @CRLF) InsertValue(123456789, $iPos, $tArray, $pArray, "uint") _WinAPI_DisplayStruct($tArray, "uint a[" & $iElements + 1 & "]") Func InsertValue($value, $iPos, ByRef $tArray, ByRef $pArray, $type) If Not IsDllStruct($tArray) Then Return SetError(1, 0, 0) Local $iUB, $iBytes Switch $type Case "wchar", "short", "ushort", "word" $iBytes = 2 $iUB = DllStructGetSize($tArray) / $iBytes Case "float", "int", "long", "bool", "uint", "ulong" $iBytes = 4 $iUB = DllStructGetSize($tArray) / $iBytes Case "int64", "uint64", "double" $iBytes = 8 $iUB = DllStructGetSize($tArray) / $iBytes Case Else Return SetError(2, 0, 0) EndSwitch If $iPos < 1 Or $iPos > $iUB Then SetError(3, 0, 0) $iUB += 1 Local $tArray_new = DllStructCreate($type & " a[" & $iUB & "]") $pArray = DllStructGetPtr($tArray_new) _MemMoveMemory(DllStructGetPtr($tArray), $pArray, ($iPos - 1) * $iBytes) $tArray_new.a(($iPos)) = $value _MemMoveMemory(DllStructGetPtr($tArray) + ($iPos - 1) * $iBytes, $pArray + $iPos * $iBytes , ($iUB - $iPos) * $iBytes) $tArray = $tArray_new Return 1 EndFunc 2D: #include <WinAPIDiag.au3> #include <Memory.au3> Global Const $iWidth = 5, $iHeight = 4 Global Const $iTotal = $iWidth * $iHeight Global $t2DArray = DllStructCreate("uint a[" & $iTotal & "]") ;2D array Global $pArray = DllStructGetPtr($t2DArray) Global $x, $y, $t, $index ;2D For $y = 0 To $iHeight - 1 ;0 1 2 3 4 $t = $y * $iWidth ;10 11 12 13 14 For $x = 0 To $iWidth - 1 ;20 21 22 23 24 $index = $t + $x ;30 31 32 33 34 $t2DArray.a(($index + 1)) = $y & $x ; Next ;1D -> 0 1 2 3 4 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 Next Print2DArray($t2DArray, $iWidth, $iHeight) InsertValue2D(99, 0, 0, $t2DArray, $pArray, $iWidth, $iHeight, "uint") ConsoleWrite(@CRLF & "Result (add 99 at 0, 0):" & @CRLF) Print2DArray($t2DArray, $iWidth, $iHeight + 1) DeleteValue2D(2, 2, $t2DArray, $pArray, $iWidth, $iHeight + 1, "uint") ConsoleWrite(@CRLF & "Result (del 2, 2 -> 21):" & @CRLF) Print2DArray($t2DArray, $iWidth, $iHeight) Func InsertValue2D($value, $xPos, $yPos, ByRef $tStruct, ByRef $pArray, $cols, $rows, $type) Local $oldElements = $cols * $rows Local $newRows = $rows + 1 Local $newElements = $cols * $newRows Local $elementSize Switch $type Case "ushort", "short", "word" $elementSize = 2 Case "uint", "int", "float" $elementSize = 4 Case "double", "int64", "uint64" $elementSize = 8 Case Else Return SetError(1, 0, 0) EndSwitch Local $tNew = DllStructCreate($type & " a[" & $newElements & "]") Local $pNew = DllStructGetPtr($tNew) Local $insertIndex = $yPos * $cols + $xPos If $insertIndex < 0 Or $insertIndex > $oldElements Then Return SetError(1, 0, 0) _MemMoveMemory($pArray, $pNew, $insertIndex * $elementSize) $tNew.a($insertIndex + 1) = $value Local $bytesAfter = ($oldElements - $insertIndex) * $elementSize _MemMoveMemory($pArray + ($insertIndex * $elementSize), $pNew + (($insertIndex + 1) * $elementSize), $bytesAfter) $tStruct = $tNew $pArray = $pNew Return 1 EndFunc Func DeleteValue2D($xPos, $yPos, ByRef $tStruct, ByRef $pArray, $cols, $rows, $type) Local $oldElements = $cols * $rows If $rows < 2 Then Return SetError(1, 0, 0) Local $newElements = $oldElements - 1 Local $elementSize Switch $type Case "ushort", "short", "word" $elementSize = 2 Case "uint", "int", "float" $elementSize = 4 Case "double", "int64", "uint64" $elementSize = 8 Case Else Return SetError(2, 0, 0) EndSwitch Local $deleteIndex = $yPos * $cols + $xPos If $deleteIndex < 0 Or $deleteIndex >= $oldElements Then Return SetError(3, 0, 0) Local $tNew = DllStructCreate($type & " a[" & $newElements & "]") Local $pNew = DllStructGetPtr($tNew) _MemMoveMemory($pArray, $pNew, $deleteIndex * $elementSize) Local $bytesAfter = ($oldElements - $deleteIndex - 1) * $elementSize _MemMoveMemory($pArray + (($deleteIndex + 1) * $elementSize), $pNew + ($deleteIndex * $elementSize), $bytesAfter) $tStruct = $tNew $pArray = $pNew Return 1 EndFunc Func Print2DArray($t2DArray, $cols, $rows) Local $x, $y, $index For $y = 0 To $rows - 1 For $x = 0 To $cols - 1 $index = $y * $iWidth + $x ConsoleWrite($t2DArray.a($index + 1) & @TAB) Next ConsoleWrite(@CRLF) Next EndFunc
  4. You may use structs and define in structs arrays. With struct arrays you can use the winapi memory functions.
  5. Hi @pixelsearch thank again for your feedback. Regarding 1) my bad. The example 08 doesn't contain a check if creation fails - it just proceeds. Easy to fix: Global $sFile = @ScriptDir & "\TestAnim.webp" Global $iResult = WebP_CreateWebPCreateAnim($aFrames, $sFile) If $iResult < 1 Or @error Then ConsoleWrite($iResult & " / " & @error & @CRLF) _GDIPlus_Shutdown() Exit MsgBox($MB_ICONERROR, "Error", "Something went wrong creating the animation!") EndIf 2) to be honest - I'm too lazy to create a GUI with all parameters. I'm not sure if all the parameters are required or will ever be needed, but I'm happy to include this as Example08.1.au3. It would only make sense if the value range per parameter was listed in the GUI. The ranges should be described in the UDF header.
  6. I found this on my drive: #include <GUIComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> #include <BorderConstants.au3> #include <WinAPI.au3> Global Const $ODT_MENU = 1 Global Const $ODT_LISTBOX = 2 Global Const $ODT_COMBOBOX = 3 Global Const $ODT_BUTTON = 4 Global Const $ODT_STATIC = 5 Global Const $ODT_HEADER = 100 Global Const $ODT_TAB = 101 Global Const $ODT_LISTVIEW = 102 Global Const $ODA_DRAWENTIRE = 1 Global Const $ODA_SELECT = 2 Global Const $ODA_FOCUS = 4 Global Const $ODS_SELECTED = 1 Global Const $ODS_GRAYED = 2 Global Const $ODS_DISABLED = 4 Global Const $ODS_CHECKED = 8 Global Const $ODS_FOCUS = 16 Global Const $ODS_DEFAULT = 32 Global Const $ODS_HOTLIGHT = 64 Global Const $ODS_INACTIVE = 128 Global Const $ODS_NOACCEL = 256 Global Const $ODS_NOFOCUSRECT = 512 Global Const $ODS_COMBOBOXEDIT = 4096 Global Const $clrWindowText = _WinAPI_GetSysColor($COLOR_WINDOWTEXT) Global Const $clrHighlightText = _WinAPI_GetSysColor($COLOR_HIGHLIGHTTEXT) Global Const $clrHighlight = _WinAPI_GetSysColor($COLOR_HIGHLIGHT) Global Const $clrWindow = _WinAPI_GetSysColor($COLOR_WINDOW) Global Const $tagDRAWITEMSTRUCT = _ 'uint CtlType;' & _ 'uint CtlID;' & _ 'uint itemID;' & _ 'uint itemAction;' & _ 'uint itemState;' & _ 'hwnd hwndItem;' & _ 'hwnd hDC;' & _ $tagRECT & _ ';ulong_ptr itemData;' Global Const $tagMEASUREITEMSTRUCT = _ 'uint CtlType;' & _ 'uint CtlID;' & _ 'uint itemID;' & _ 'uint itemWidth;' & _ 'uint itemHeight;' & _ 'ulong_ptr itemData;' Global $iItemWidth, $iItemHeight Global $hGUI Global $ComboBox Global $hBrushNorm = _WinAPI_CreateSolidBrush($clrWindow) Global $hBrushSel = _WinAPI_CreateSolidBrush($clrHighlight) GUIRegisterMsg($WM_MEASUREITEM, '_WM_MEASUREITEM') GUIRegisterMsg($WM_DRAWITEM, '_WM_DRAWITEM') ;GUIRegisterMsg($WM_COMMAND, '_WM_COMMAND') $hGUI = GUICreate('Test', 220, 300) $ComboBox = GUICtrlCreateCombo('', 10, 10, 200, 300, BitOR($WS_CHILD, $CBS_OWNERDRAWVARIABLE, $CBS_HASSTRINGS, $CBS_DROPDOWNLIST)) GUICtrlSetData($ComboBox, "Medabi|V!c†o®|joelson0007-|JScript|Belini|Jonatas-|AutoIt v3|www.autoitbrasil.com-|www.autoitscript.com", "Medabi") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hBrushSel) _WinAPI_DeleteObject($hBrushNorm) GUIDelete() Func _WM_MEASUREITEM($hWnd, $iMsg, $iwParam, $ilParam) Local $stMeasureItem = DllStructCreate($tagMEASUREITEMSTRUCT, $ilParam) If DllStructGetData($stMeasureItem, 1) = $ODT_COMBOBOX Then Local $iCtlType, $iCtlID, $iItemID Local $ComboBoxBox Local $tSize Local $sText $iCtlType = DllStructGetData($stMeasureItem, 'CtlType') $iCtlID = DllStructGetData($stMeasureItem, 'CtlID') $iItemID = DllStructGetData($stMeasureItem, 'itemID') $iItemWidth = DllStructGetData($stMeasureItem, 'itemWidth') $iItemHeight = DllStructSetData($stMeasureItem, "itemHeight", DllStructGetData($stMeasureItem, 'itemHeight') + 4) ;$iItemHeight = DllStructGetData($stMeasureItem, 'itemHeight') $ComboBoxBox = GUICtrlGetHandle($iCtlID) EndIf $stMeasureItem = 0 Return $GUI_RUNDEFMSG EndFunc ;==>_WM_MEASUREITEM Func _WM_DRAWITEM($hWnd, $iMsg, $iwParam, $ilParam) Local $tDIS = DllStructCreate($tagDRAWITEMSTRUCT, $ilParam) Local $iCtlType, $iCtlID, $iItemID, $iItemAction, $iItemState Local $clrForeground, $clrBackground Local $hWndItem, $hDC, $hOldPen, $hOldBrush Local $tRect Local $sText Local $iLeft, $iTop, $iRight, $iBottom $iCtlType = DllStructGetData($tDIS, 'CtlType') $iCtlID = DllStructGetData($tDIS, 'CtlID') $iItemID = DllStructGetData($tDIS, 'itemID') $iItemAction = DllStructGetData($tDIS, 'itemAction') $iItemState = DllStructGetData($tDIS, 'itemState') $hWndItem = DllStructGetData($tDIS, 'hwndItem') $hDC = DllStructGetData($tDIS, 'hDC') $tRect = DllStructCreate($tagRECT) If $iCtlType = $ODT_COMBOBOX And $iCtlID = $ComboBox Then Switch $iItemAction Case $ODA_DRAWENTIRE For $i = 1 To 4 DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i + 7)) Next _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText) Local $iTop = DllStructGetData($tRect, 2), $iBottom = DllStructGetData($tRect, 4) DllStructSetData($tRect, 2, $iTop + 2) DllStructSetData($tRect, 4, $iBottom - 1) If BitAND($iItemState, $ODS_SELECTED) Then $clrForeground = _WinAPI_SetTextColor($hDC, $clrHighlightText) $clrBackground = _WinAPI_SetBkColor($hDC, $clrHighlight) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushSel) Else $clrForeground = _WinAPI_SetTextColor($hDC, $clrWindowText) $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushNorm) EndIf DllStructSetData($tRect, 2, $iTop) DllStructSetData($tRect, 4, $iBottom) If $sText <> "" Then If StringInStr($sText, "-", 0, -1) Then ; Draw a "line" for a separator item If Not BitAND($iItemState, $ODS_COMBOBOXEDIT) Then DllStructSetData($tRect, 2, $iTop + ($iItemHeight)) _WinAPI_DrawEdge($hDC, DllStructGetPtr($tRect), $EDGE_ETCHED, $BF_TOP) EndIf $sText = StringTrimRight($sText, 1) EndIf DllStructSetData($tRect, 2, $iTop + 4) _WinAPI_DrawText($hDC, $sText, $tRect, $DT_LEFT) _WinAPI_SetTextColor($hDC, $clrForeground) _WinAPI_SetBkColor($hDC, $clrBackground) EndIf _WinAPI_SetBkMode($hDC, $TRANSPARENT) Case $ODA_SELECT, $ODA_FOCUS For $i = 1 To 4 DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i + 7)) Next _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText) Local $iTop = DllStructGetData($tRect, 2), $iBottom = DllStructGetData($tRect, 4) DllStructSetData($tRect, 2, $iTop + 2) DllStructSetData($tRect, 4, $iBottom - 1) If BitAND($iItemState, $ODS_SELECTED) Then $clrForeground = _WinAPI_SetTextColor($hDC, $clrHighlightText) $clrBackground = _WinAPI_SetBkColor($hDC, $clrHighlight) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushSel) Else $clrForeground = _WinAPI_SetTextColor($hDC, $clrWindowText) $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrushNorm) EndIf DllStructSetData($tRect, 2, $iTop) DllStructSetData($tRect, 4, $iBottom) If $sText <> "" Then If StringInStr($sText, "-", 0, -1) Then ; Draw a "line" for a separator item If Not BitAND($iItemState, $ODS_COMBOBOXEDIT) Then DllStructSetData($tRect, 2, $iTop + ($iItemHeight)) _WinAPI_DrawEdge($hDC, DllStructGetPtr($tRect), $EDGE_ETCHED, $BF_TOP) EndIf $sText = StringTrimRight($sText, 1) EndIf DllStructSetData($tRect, 2, $iTop + 4) _WinAPI_DrawText($hDC, $sText, $tRect, $DT_LEFT) _WinAPI_SetTextColor($hDC, $clrForeground) _WinAPI_SetBkColor($hDC, $clrBackground) EndIf _WinAPI_SetBkMode($hDC, $TRANSPARENT) EndSwitch EndIf $tRect = 0 Return $GUI_RUNDEFMSG EndFunc ;==>_WM_DRAWITEM Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo If Not IsHWnd($ComboBox) Then $hWndCombo = GUICtrlGetHandle($ComboBox) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $hWndFrom Case $ComboBox, $hWndCombo Switch $iCode Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed _DebugPrint("$CBN_CLOSEUP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_DBLCLK ; Sent when the user double-clicks a string in the list box of a combo box _DebugPrint("$CBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_DROPDOWN ; Sent when the list box of a combo box is about to be made visible _DebugPrint("$CBN_DROPDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_EDITUPDATE ; Sent when the edit control portion of a combo box is about to display altered text _DebugPrint("$CBN_EDITUPDATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_ERRSPACE ; Sent when a combo box cannot allocate enough memory to meet a specific request _DebugPrint("$CBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_KILLFOCUS ; Sent when a combo box loses the keyboard focus _DebugPrint("$CBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box _DebugPrint("$CBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; Select Item ;_GUICtrlComboBox_SetCurSel($ComboBox, _GUICtrlComboBox_GetCurSel($ComboBox)) ; no return value Case $CBN_SELENDCANCEL ; Sent when the user selects an item, but then selects another control or closes the dialog box _DebugPrint("$CBN_SELENDCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_SELENDOK ; Sent when the user selects a list item, or selects an item and then closes the list _DebugPrint("$CBN_SELENDOK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_SETFOCUS ; Sent when a combo box receives the keyboard focus _DebugPrint("$CBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint It's buried somewhere in this forum...
  7. Oops, forgot to remove the manual path to the DLL. Fixed.
  8. Updated to v0.3.8 build 2025-07-04 beta added loop count parameter for the 3 animation functions. Default = 0 which is endless. added WebP_GetImagesDiffFromFile() which can compare two WebP files which same dimension
  9. Yes, that was the reason for that line if Array is only 1D. When you display the animation, you can choose to play it one time, n times or endless but there is also an option to set loop_count. I will add it as an parameter that external players can play it accordingly. Thanks for your feedback!
  10. Hi @pixelsearch The idea was check if array is 2D but you are right, instead of checking permanently the array, one check should be enough -> fixed. I wanted to see if delays are properly added to the animation. There no other reason to slow down the frames. 🙂
  11. Updated to WebP v0.3.7 build 2025-07-03 beta You can now create WebP anim files from WebP image files and you can extract frames from a WebP anim file to WebP image file format. Supported GDIPlus image formats: "bmp", "gif", "jpg", "tif", "png"
  12. In the example I've chosen 10 (out of 100 = nearly no compression). You may see artifacts in the WebP file with 10 as quality. Btw, I don't know why but the WebP animation is one frame less at least for one gif. Maybe depends on the gif file... Anyhow, thanks for testing. 👍
  13. Updated to WebP v0.3.6 build 2025-07-02 beta -> you can convert now GIF animated files to WebP animated files (see Example10.au3 on my 1Drv).
  14. Yes, I forgot to removed these lines for the other functions but I need to add the code also for the other function with callbacks. Currently only function "WebP_CreateWebPCreateAnimFromScreenCapture" in the dll is implemented (example 9) for callback but it should be easy to add also for the other functions. I think tomorrow I will add it to the other functions, too.
  15. Thx for testing. Figured out how callback can be used with Example9 to show progress and abort capturing...
×
×
  • Create New...