Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation since 06/28/2025 in all areas

  1. 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...
    3 points
  2. WildByDesign

    DwmColorBlurMica

    I promised myself that I was not going to make another GUI because the attention to detail drives me a little crazy. 🙃 But here we are. This was especially complicated because I wanted to make a GUI that was 100% receptive to the features that DwmColorBlurMica represents. It had to have transparent controls to show the underlying backdrop material (Mica, Acrylic, Blur, etc.) through the controls. This meant making custom ComboBox because AutoIt ComboBox are not normally transparent. Anyway, I think I am around 50% complete with the GUI. Below is a W.I.P. screenshot of where I am at right now: It works better than I expected. There are color pickers too. I will probably get rid of the menubar. I will likely add a custom transparent statusbar to show all of the Global settings to compare to the per-app settings. Lots of things to consider still. I hate making GUIs.
    3 points
  3. 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"
    3 points
  4. 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
    2 points
  5. There are some great responses and creative ideas here. Thank you all so much. I apologize for my delay in responding. I hope that I don’t seem rude for the delay. I had moved forward with other parts of the GUI while my mind (and ideas) was fresh. Later today I am going to return to this important part of my GUI and I will try the various ideas. Once I get a chance to try them, I will respond here to each of your ideas. As always, I am grateful for your time and your help.
    2 points
  6. following the instructions of argumentum I got this far #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Global $g_idListView Global $g_bListViewVisible = False Global $g_InputCombo _MainGUI() Func _MainGUI() Local $hGUI = GUICreate("fake combo", 364, 250) Local $iX = 65, $iY = 30, $iW = 150, $iH = 21 ; fake combo $g_InputCombo = GUICtrlCreateInput("", $iX, $iY, $iW, $iH) Local $idBtnCombo = GUICtrlCreateButton("🔻", $iX + $iW, $iY - 1, $iH + 2, $iH + 2) ; ListView $g_idListView = GUICtrlCreateListView("", $iX, $iY + $iH, $iW + $iH, 180, BitOR($LVS_NOCOLUMNHEADER, $LVS_REPORT), BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_TRACKSELECT)) GUICtrlSetState($g_idListView, $GUI_HIDE) ; hidden ; Add columns _GUICtrlListView_AddColumn($g_idListView, "", $iW) ; Enable group view _GUICtrlListView_EnableGroupView($g_idListView) ; Group 1 _GUICtrlListView_InsertGroup($g_idListView, -1, 1, "Fruits") _GUICtrlListView_AddItem($g_idListView, "Apple") _GUICtrlListView_SetItemGroupID($g_idListView, _GUICtrlListView_GetItemCount($g_idListView) - 1, 1) _GUICtrlListView_AddItem($g_idListView, "Banana") _GUICtrlListView_SetItemGroupID($g_idListView, _GUICtrlListView_GetItemCount($g_idListView) - 1, 1) ; Group 2 _GUICtrlListView_InsertGroup($g_idListView, -1, 2, "Vegetables") _GUICtrlListView_AddItem($g_idListView, "Carrot") _GUICtrlListView_SetItemGroupID($g_idListView, _GUICtrlListView_GetItemCount($g_idListView) - 1, 2) _GUICtrlListView_AddItem($g_idListView, "Spinach") _GUICtrlListView_SetItemGroupID($g_idListView, _GUICtrlListView_GetItemCount($g_idListView) - 1, 2) ; Group 3 _GUICtrlListView_InsertGroup($g_idListView, -1, 3, "Dairy") _GUICtrlListView_AddItem($g_idListView, "Milk") _GUICtrlListView_SetItemGroupID($g_idListView, _GUICtrlListView_GetItemCount($g_idListView) - 1, 3) ; Register the message handler GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idBtnCombo ; Toggle ListView visibility If Not $g_bListViewVisible Then GUICtrlSetState($g_idListView, $GUI_SHOW + $GUI_FOCUS) $g_bListViewVisible = True Else GUICtrlSetState($g_idListView, $GUI_HIDE) $g_bListViewVisible = False EndIf EndSwitch WEnd EndFunc ;==>_MainGUI ;--------------------------------------------------------------------------------------- Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndListView = GUICtrlGetHandle($g_idListView) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Local $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK Local $iIndex = _GUICtrlListView_GetSelectionMark($g_idListView) ; Get the index of the last selected item ; Ensure a valid item was selected If $iIndex <> -1 Then Local $sItemText = _GUICtrlListView_GetItemText($g_idListView, $iIndex, 0) If $sItemText <> "" Then GUICtrlSetData($g_InputCombo, $sItemText) GUICtrlSetState($g_idListView, $GUI_HIDE) GUICtrlSetState($g_InputCombo, $GUI_FOCUS) $g_bListViewVisible = False EndIf EndIf Return 0 Case $NM_DBLCLK Return 0 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY ;--------------------------------------------------------------------------------------- Edit: Normally it would require handling $WM_KILLFOCUS and keyboard navigation, but the code would grow. Just the central idea
    2 points
  7. 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).
    2 points
  8. One way to launch other tools while a compiled program is running would be to use a tool like this: Scite Plusbar
    2 points
  9. Understand the request, but this is how the internals work in SciTE to be able to capture the output generated by the Script. These are things I won't be trying to change unless it is changed in the Core version supported by Neil.
    2 points
  10. 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.
    2 points
  11. vs. If you would like to pin the script to the taskbar ( or the start menu ), it can be done with a link. This script is an example and demonstration. The way that I go about it, is to have the script and icon with the same name. The easiest way to test this is if the post had it all in a ZIP file so, there: Example AutoIt v3 Script_v2.zip Also, it's easier to find in task manager given that you can see your icon.
    2 points
  12. Jon

    GimageX updates

    I've updated GImageX with the latest version of the ADK. (Dec 2024 version). Don't think the ADK version was the OP's issue. But updated it anyway.
    2 points
  13. This is really nice. Thank you for sharing. I've used listviews and many of my projects but I have never used groups before. While this might not be exactly what I need for my current project, I'm going to keep this script around because I have some other ideas for groups now.
    1 point
  14. I wrote a dll and the wrapper to convert non-animated WebP images to a GDI/GDI+ format / encode any GDI+ supported image to WebP format for use in Autoit. What is WebP? You can find more information about WebP and WebP tools / source codes here: https://developers.google.com/speed/webp Maybe useful for one or the other... 🙂 WebP.au3: #cs Copyright (c) 2025 UEZ The following terms apply to the use of this code (AutoIt scripts and both DLLs), unless otherwise agreed upon in writing with the author: 1. **No commercial use** Any commercial usage - including but not limited to selling, licensing, integrating into commercial software, or using in revenue-generating products - is prohibited. 2. **Modification allowed, for non-commercial use only** You may modify or adapt the code as long as it remains non-commercial. Even in modified versions, the original author must be clearly credited as UEZ. 3. **Attribution required** In any non-commercial distribution or use, clear credit must be given to the original author: UEZ. For exceptions or commercial licensing, please contact: uez at hotmail de #ce ;Version 0.3.8 build 2025-07-04 beta #include-once #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <Memory.au3> #include <MsgBoxConstants.au3> #include <WinAPIGdi.au3> #include <WindowsConstants.au3> #include <WinAPIConstants.au3> #include <WinAPISysWin.au3> Enum $WEBP_PRESET_DEFAULT = 0, _ ; default preset. $WEBP_PRESET_PICTURE, _ ; digital picture, like portrait, inner shot $WEBP_PRESET_PHOTO, _ ; outdoor photograph, with natural lighting $WEBP_PRESET_DRAWING, _ ; hand or line drawing, with high-contrast details $WEBP_PRESET_ICON, _ ; small-sized colorful images $WEBP_PRESET_TEXT ; text-like ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_Ver ; Description ...: Displays the DLL version information in a messagebox window ; Syntax ........: WebP_Ver([$sPath2DLL = ""]) ; Parameters ....: $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir ; Return values .: None ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_Ver($sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found DllCall($sDLL, "none", "WebP_DLL_Version") Return True EndFunc ;==>WebP_Ver ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_Ver2 ; Description ...: Returns the DLL version information ; Syntax ........: WebP_Ver([$sPath2DLL = ""]) ; Parameters ....: $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir ; Return values .: DLL version ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_Ver2($sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found Return DllCall($sDLL, "str", "Web_DLL_Version2")[0] EndFunc ;==>WebP_Ver2 ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_BitmapGetInfo ; Description ...: Gets some rudimentary information about the WebP image ; Syntax ........: WebP_BitmapGetInfo($sFilename[, $sPath2DLL = ""]) ; Parameters ....: $sFilename - file to load ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir ; Return values .: Struct ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_BitmapGetInfo($sFilename, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found If Not FileExists($sFilename) Then Return SetError(2, 0, 0) ;file not found Local $iFileSize = FileGetSize($sFilename), $nBytes Local $tBuffer = DllStructCreate("struct;byte bin[" & $iFileSize & "];endstruct") Local Const $hFile = _WinAPI_CreateFile($sFilename, 2, 2) _WinAPI_ReadFile($hFile, $tBuffer, $iFileSize, $nBytes) _WinAPI_CloseHandle($hFile) If Int(BinaryMid($tBuffer.bin, 1, 4)) <> 1179011410 Or Int(BinaryMid($tBuffer.bin, 9, 6)) <> 88331643929943 Then Return SetError(3, 0, 0) ;header must contain RIFF and WEBPVP Local $tWebPBitstreamFeatures = DllStructCreate("struct;long width; long height; long has_alpha; long has_animation; long format; ulong pad[5];endstruct") Local $iReturn = DllCall($sDLL, "long", "WebP_BitmapGetInfo", "struct*", $tBuffer, "uint", $iFileSize, "struct*", $tWebPBitstreamFeatures) If $iReturn = 0 Then Return SetError(4, 0, 0) Return $tWebPBitstreamFeatures EndFunc ;==>WebP_BitmapGetInfo ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_BitmapCreateGDIp ; Description ...: Converts (decodes) a WebP image from disk to a GDI / GDI+ bitmap handle ; Syntax ........: WebP_BitmasFilename[, $bGDIImage = False[, $sPath2DLL = ""]]) ; Parameters ....: $sFilename - file to load ; $bGDIImage - [optional] a boolean value. Default is False (GDIPlus bitmap handle). If True then output is GDI bitmap handle ; $bCountColors - [optional] a boolean value. Default is False. If True then the colors will be counted and saved in extended. Use @extended to get color count. ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir ; Return values .: GDI / GDIPlus bitmap handle and color count if $bCountColors = True in extended. ; Author ........: UEZ ; Modified ......: ; Remarks .......: For animated WebP images see below! ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_BitmapCreateGDIp($sFilename, $bGDIImage = False, $bCountColors = False, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found If Not FileExists($sFilename) Then Return SetError(2, 0, 0) ;file not found Local $iFileSize = FileGetSize($sFilename), $nBytes Local $tBuffer = DllStructCreate("byte bin[" & $iFileSize & "]") Local Const $hFile = _WinAPI_CreateFile($sFilename, 2, 2) _WinAPI_ReadFile($hFile, $tBuffer, $iFileSize, $nBytes) _WinAPI_CloseHandle($hFile) If Int(BinaryMid($tBuffer.bin, 1, 4)) <> 1179011410 Or Int(BinaryMid($tBuffer.bin, 9, 6)) <> 88331643929943 Then Return SetError(3, 0, 0) ;header must contain RIFF and WEBPVP Local $tColors = DllStructCreate("struct;ulong cc;endstruct") Local Const $hBitmap = DllCall($sDLL, "ptr", "WebP_BitmapCreateGDIp", "struct*", $tBuffer, "uint", $iFileSize, "boolean", $bGDIImage, "boolean", $bCountColors, "struct*", $tColors)[0] If $hBitmap = 0 Then Return SetError(4, 0, 0) Return SetExtended($tColors.cc, $hBitmap) EndFunc ;==>WebP_BitmapCreateGDIp ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_BitmapCreateGDIpFromMem ; Description ...: Converts (decodes) a WebP image from memory to a GDI / GDI+ bitmap handle ; Syntax ........: WebP_BitmapCreateGDIpFromMem($tBuffer[, $iBufferSize = 0[, $bGDIImage = False[, $sPath2DLL = ""]]]) ; Parameters ....: $tBuffer - a dll struct with WebP binary data as content or pointer to the memory data ; $iBufferSize - the size of the binary data (file size) ; $bGDIImage - [optional] a boolean value. Default is False (GDIPlus bitmap handle). If True then output is GDI bitmap handle ; $bCountColors - [optional] a boolean value. Default is False. If True then the colors will be counted and saved in extended. Use @extended to get color count. ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir ; Return values .: GDI / GDIPlus bitmap handle and color count if $bCountColors = True in extended. ; Author ........: UEZ ; Modified ......: ; Remarks .......: Currently only WebP images are supported - no animated WebP images yet! ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_BitmapCreateGDIpFromMem($tBuffer, $iBufferSize = 0, $bGDIImage = False, $bCountColors = False, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found If $iBufferSize = 0 Then Return SetError(2, 0, 0) Local $binMem If IsPtr($tBuffer) Then Local $tMem = DllStructCreate("byte bin[" & $iBufferSize & "]", $tBuffer) $binMem = $tMem.bin Else $binMem = DllStructGetData($tBuffer, 1) EndIf If Int(BinaryMid($binMem, 1, 4)) <> 1179011410 Or Int(BinaryMid($binMem, 9, 6)) <> 88331643929943 Then Return SetError(3, 0, 0) ;header must contain RIFF and WEBPVP Local $tColors = DllStructCreate("struct;ulong cc;endstruct") Local Const $hBitmap = DllCall($sDLL, "ptr", "WebP_BitmapCreateGDIp", "struct*", $tBuffer, "uint", $iBufferSize, "boolean", $bGDIImage, "boolean", $bCountColors, "struct*", $tColors)[0] If $hBitmap = 0 Then Return SetError(4, 0, 0) Return SetExtended($tColors.cc, $hBitmap) EndFunc ;==>WebP_BitmapCreateGDIpFromMem ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_CreateWebPLossySimpleFromBitmap ; Description ...: Converts a GDI+ bitmap to WebP lossy image and save it to HD ; Syntax ........: WebP_CreateWebPLossySimpleFromBitmap($sFilename, $hBitmap[, $iQuality = 75[, $sPath2DLL = ""]]) ; Parameters ....: $sFilename - file to load ; $hBitmap - GDIPlus bitmap handle ; $iQuality - [optional] an integer value. Default is 75. Valid range is 0 - 100. ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir. ; Return values .: 0 for failure, 1 for success. ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_CreateWebPLossySimpleFromBitmap($sFilename, $hBitmap, $iQuality = 75, $sPath2DLL = "") If $sFilename = "" Then Return SetError(1, 0, 0) Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(2, 0, 0) ;DLL not found Local $iReturn = DllCall($sDLL, "long", "WebP_CreateWebPLossySimpleFromBitmap", "str", $sFilename, "ptr", $hBitmap, "float", $iQuality)[0] If $iReturn = 0 Then Return SetError(3, 0, 0) Return 1 EndFunc ;==>WebP_CreateWebPLossySimpleFromBitmap ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_CreateWebPLosslessSimpleFromBitmap ; Description ...: Converts a GDI+ bitmap to WebP lossless image and save it to HD ; Syntax ........: WebP_CreateWebPLosslessSimpleFromBitmap($sFilename, $hBitmap[, $sPath2DLL = ""]) ; Parameters ....: $sFilename - file to load ; $hBitmap - GDIPlus bitmap handle ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir. ; Return values .: 0 for failure, 1 for success. ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_CreateWebPLosslessSimpleFromBitmap($sFilename, $hBitmap, $sPath2DLL = "") If $sFilename = "" Then Return SetError(1, 0, 0) Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(2, 0, 0) ;DLL not found Local $iReturn = DllCall($sDLL, "long", "WebP_CreateWebPLosslessSimpleFromBitmap", "str", $sFilename, "ptr", $hBitmap)[0] If $iReturn = 0 Then Return SetError(3, 0, 0) Return 1 EndFunc ;==>WebP_CreateWebPLosslessSimpleFromBitmap ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_CreateWebPAdvancedFromBitmap ; Description ...: Converts a bitmap to WebP lossy / lossless image and save it to HD ; Syntax ........: WebP_CreateWebPAdvancedFromBitmap($sFilename, $hBitmap[, $WebPPreset = $WEBP_PRESET_DEFAULT[, $lossless = 0[, ; $quality = 75.0[, $method = 4[, $sns_strength = 50[, $filter_sharpness = 0[, $filter_strength = 60[, ; $pass = 1[, $level = 6[, $sPath2DLL = ""]]]]]]]]]]) ; Parameters ....: $sFilename - file to load ; $hBitmap - GDIPlus bitmap handle ; $WebPPreset - [optional] an unknown value. Default is $WEBP_PRESET_DEFAULT. ; $lossless - [optional] an unknown value. Default is 0. 0 for lossy encoding / 1 for lossless.. ; $quality - [optional] an unknown value. Default is 75.0. Valid range is 0 - 100. ; $method - [optional] a map. Default is 4. Valid range is 0 - 6 (0=fast, 6=slower-better). ; $sns_strength - [optional] a string value. Default is 50. Spatial Noise Shaping. 0=off, 100=maximum ; $filter_sharpness - [optional] a floating point value. Default is 0. Range: [0 = off .. 7 = least sharp] ; $filter_strength - [optional] a floating point value. Default is 60. Range: [0 = off .. 100 = strongest] ; $pass - [optional] a pointer value. Default is 1. Number of entropy-analysis passes (in [1..10]). ; $level - [optional] an unknown value. Default is 6. Between 0 (fastest, lowest compression) and 9 (slower, best compression) only valid for lossless = 1! ; $near_lossless - [optional] an unknown value. Default is 100. Near lossless encoding [0 = max loss .. 100 = off (default)]. ; $alpha_compression - [optional] an unknown value. Default is 1. Algorithm for encoding the alpha plane (0 = none,1 = compressed with WebP lossless). Default is 1. ; $alpha_filtering - [optional] an unknown value. Default is 1. Predictive filtering method for alpha plane.0: none, 1: fast, 2: best. Default if 1. ; $alpha_quality - [optional] an unknown value. Default is 100. Between 0 (smallest size) and 100 (lossless). Default is 100. ; $target_size - [optional] an unknown value. Default is 0. If non-zero, set the desired target size in bytes. ; $NoSave - [optional] an unknown value. Default is False. ; $pMem - [optional] a string value. Default is Null. If $NoSave = True then the pointer to the memory which holds the data will be returned. ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir. ; Return values .: negative value for failure, 1 for success or the struct with information (pointers, size) if $NoSave = True ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_CreateWebPAdvancedFromBitmap($sFilename, $hBitmap, $WebPPreset = $WEBP_PRESET_DEFAULT, $lossless = 0, $quality = 75.0, $method = 4, $sns_strength = 50, _ $filter_sharpness = 0, $filter_strength = 60, $pass = 1, $level = 6, $near_lossless = 100, $alpha_compression = 1, $alpha_filtering = 1, $alpha_quality = 100, _ $target_size = 0, $NoSave = False, $sPath2DLL = "") If $sFilename = "" And Not $NoSave Then Return SetError(1, 0, 0) Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(2, 0, 0) ;DLL not found Local $tMem = DllStructCreate("struct;ptr pPic; ptr pWriter; ptr pMemData; uint memsize;endstruct") Local $iReturn = DllCall($sDLL, "long", "WebP_CreateWebPAdvancedFromBitmap", _ "str", $sFilename, _ ;Webp filename "ptr", $hBitmap, _ ;handle to GDI+ bitmap "long", $WebPPreset, _ ;WebPPreset "long", $lossless, _ ;lossless "float", $quality, _ ;quality "long", $method, _ ;method "long", $sns_strength, _ ;sns_strength "long", $filter_sharpness, _ ;filter_sharpness "long", $filter_strength, _ ;filter_strength "long", $pass, _ ;pass "long", $level, _ ;level "long", $near_lossless, _ ;near_lossless "long", $alpha_compression, _ ;alpha_compression "long", $alpha_filtering, _ ;alpha_filtering "long", $alpha_quality, _ ;alpha_quality "long", $target_size, _ ;target_size "bool", $NoSave, _ ; "struct*", $tMem)[0] If $iReturn < 0 Then Return SetError(3, 0, $iReturn) If $NoSave And $tMem.memsize = 0 Then SetError(4, 0, 0) Return $NoSave ? $tMem : $iReturn EndFunc ;==>WebP_CreateWebPAdvancedFromBitmap ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_FreeUp ; Description ...: Release the ressources from $tMem struct ; Syntax ........: WebP_FreeUp(Byref $tMem[, $sPath2DLL = ""]) ; Parameters ....: $tMem - [in/out] a dll struct value. ; $sPath2DLL - [optional] a string value. Default is "". ; Return values .: 1 ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_FreeUp(ByRef $tMem, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found Local $iReturn = DllCall($sDLL, "long", "WebP_FreeUp", "struct*", $tMem)[0] Return $iReturn EndFunc ;==>WebP_FreeUp ; #FUNCTION# ==================================================================================================================== ; Name ..........: BitmapCountColors ; Description ...: Counts the colors used by the bitmap ; Syntax ........: BitmapCountColors($hBitmap) ; Parameters ....: $hBitmap - a handle to a GDI+ bitmap. ; $bGDIImage - [optional] a boolean value. Default is False (GDIPlus bitmap handle). ; Return values .: Number of colors used by the image. ; Author ........: UEZ ; Modified ......: ; Remarks .......: The result may differ from other programs for JPG images depending on the decoder. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func BitmapCountColors($hBitmap = 0, $bGDIImage = False, $sPath2DLL = "") If IsPtr($hBitmap) = 0 Or $hBitmap = 0 Then SetError(1, 0, 0) Local Const $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(2, 0, 0) ;DLL not found Local $iReturn = DllCall($sDLL, "ulong", "BitmapCountColors", "ptr", $hBitmap)[0] If Not $iReturn Or @error Then Return SetError(3, 0, 0) Return $iReturn EndFunc ;==>BitmapCountColors ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_ExtractAnimFramesToDisk ; Description ...: Extracts the frames of a WebP animated file ; Syntax ........: WebP_ExtractAnimFramesToDisk($sFile, $sDestPath = ""[, $sOutputFormat = "webp"[, $sPath2DLL = ""]]) ; Parameters ....: $sFilename - path to webp anim file. ; $sDestPath - destination folder. If empty then script path will be used. ; $sOutputFormat - [optional] a string value. Default is "webp". Any GDI+ supported or WebP image format. ; $sPath2DLL - [optional] a string value. Default is "". ; Return values .: number of extracted frames on success, otherwise error -> -1 to -3 ; Author ........: UEZ ; Modified ......: ; Remarks .......: If output image format is WebP then frames will be saved lossless. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_ExtractAnimFramesToDisk($sFilename, $sDestPath = "", $sOutputFormat = "webp", $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found Local Const $iResult = DllCall($sDLL, "long", "WebP_ExtractAnimFramesToDisk", "str", $sFilename, "str", $sDestPath, "str", StringStripWS($sOutputFormat, $STR_STRIPALL))[0] If $iResult < 1 Then Return SetError(2, 0, $iResult) Return $iResult EndFunc ;==>WebP_ExtractAnimFramesToDisk ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_GetAmountOfAnimFrames ; Description ...: Get the amount of frames from an animated webp file ; Syntax ........: WebP_GetAmountOfAnimFrames($sFilename[, $sPath2DLL = ""]) ; Parameters ....: $sFilename - path to webp anim file. ; $sPath2DLL - [optional] a string value. Default is "". ; Return values .: 0 for failure, otherwise the amount of frames ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_GetAmountOfAnimFrames($sFilename, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found Local Const $iResult = DllCall($sDLL, "uint", "WebP_GetAmountOfAnimFrames", "str", $sFilename)[0] If Not $iResult Or @error Then Return SetError(2, 0, 0) Return $iResult EndFunc ;==>WebP_GetAmountOfAnimFrames ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_ExtractAnimFramesToMem ; Description ...: Extracts all frames from a webp animated file to the memory ; Syntax ........: WebP_ExtractAnimFramesToMem($sFilename, Byref $iUB[, $sPath2DLL = ""]) ; Parameters ....: $sFilename - path to webp anim file. ; $iUB - [in/out] an integer value. Needed to save the amount of data in struct array -> frames * 2 ; $sPath2DLL - [optional] a string value. Default is "". ; Return values .: 0 for failure, otherwise struct array with pointer to the GDI+ image and frame delay ; Author ........: UEZ ; Modified ......: ; Remarks .......: You must dispose all frames when done. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_ExtractAnimFramesToMem($sFilename, ByRef $iUB, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found Local $iFrames = WebP_GetAmountOfAnimFrames($sFilename, $sPath2DLL) If Not $iFrames Or @error Then Return SetError(2, 0, 0) Local $tImgPtr = DllStructCreate((@AutoItX64 ? "int64 array[" : "int array[") & $iFrames * 2 + 2 & "]") Local Const $iResult = DllCall($sDLL, "long", "WebP_ExtractAnimFramesToMem", "str", $sFilename, "ptr*", DllStructGetPtr($tImgPtr))[0] If $iResult < 1 Or @error Then Return SetError(4, $iResult, 0) $iUB = $iFrames * 2 Return $tImgPtr EndFunc ;==>WebP_ExtractAnimFramesToMem ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_CreateWebPCreateAnim ; Description ...: Creates an WebP animation file ; Syntax ........: WebP_CreateWebPCreateAnim($aFilenames, $sOutfile[, $quality = 75.0[, $lossless = 0[, $method = 4[, ; $filter_strength = 60[, $sns_strength = 50[, $pass = 1[, $level = 6[, $filter_sharpness = 0[, ; $near_lossless = 100[, $alpha_compression = 1[, $alpha_filtering = 1[, $alpha_quality = 100[, ; $target_size = 0[, $loop_count = 0[, $WebPPreset = $WEBP_PRESET_DEFAULT[, $iDefaultDelay = 75[, ; $pCallback = 0[, $sPath2DLL = ""]]]]]]]]]]]]]]]]]]) ; Parameters ....: $aFilenames - an 2D array of pathes to the image files and delay per frame. ; $sOutfile - filename of WebP animation output file. ; $quality - [optional] an unknown value. Default is 75.0. Valid range is 0 - 100. ; $lossless - [optional] an unknown value. Default is 0. 0 for lossy encoding / 1 for lossless. ; $method - [optional] a map. Default is 4. Valid range is 0 - 6 (0=fast, 6=slower-better). ; $filter_strength - [optional] a floating point value. Default is 60. Range: [0 = off .. 100 = strongest] ; $sns_strength - [optional] a string value. Default is 50. Spatial Noise Shaping. 0=off, 100=maximum ; $pass - [optional] a pointer value. Default is 1. Number of entropy-analysis passes (in [1..10]). ; $level - [optional] an unknown value. Default is 6. Between 0 (fastest, lowest compression) and 9 (slower, best compression) only valid for lossless = 1! ; $filter_sharpness - [optional] a floating point value. Default is 0. Range: [0 = off .. 7 = least sharp] ; $near_lossless - [optional] a general number value. Default is 100. Near lossless encoding [0 = max loss .. 100 = off (default)]. ; $alpha_compression - [optional] an array of unknowns. Default is 1. Algorithm for encoding the alpha plane (0 = none,1 = compressed with WebP lossless). Default is 1. ; $alpha_filtering - [optional] an array of unknowns. Default is 1. Predictive filtering method for alpha plane.0: none, 1: fast, 2: best. Default if 1. ; $alpha_quality - [optional] an array of unknowns. Default is 100. Between 0 (smallest size) and 100 (lossless). Default is 100. ; $target_size - [optional] a dll struct value. Default is 0. If non-zero, set the desired target size in bytes. ; $loop_count - [optional] an unknown value. Default is 0. 0 = endless. ; $WebPPreset - [optional] an unknown value. Default is $WEBP_PRESET_DEFAULT. ; $iDefaultDelay - [optional] an integer value. Default is 75. Delay in milli seconds. ; $pCallback - [optional] a pointer value. Default is 0. Pointer to a callback address for progress hook. ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir. ; Return values .: 1 on success, otherwise error -> -1 to -12 ; Author ........: UEZ ; Modified ......: ; Remarks .......: All frames must have same image dimension. First image defines the dimension of the animation. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_CreateWebPCreateAnim($aFilenames, $sOutfile, $quality = 75.0, $lossless = 0, $method = 4, $filter_strength = 60, $sns_strength = 50, _ $pass = 1, $level = 6, $filter_sharpness = 0, $near_lossless = 100, $alpha_compression = 1, $alpha_filtering = 1, $alpha_quality = 100, _ $target_size = 0, $loop_count = 0, $WebPPreset = $WEBP_PRESET_DEFAULT, $iDefaultDelay = 75, $pCallback = 0, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found If $sOutfile = "" Then Return SetError(2, 0, 0) If Not IsArray($aFilenames) Or UBound($aFilenames) < 2 Then Return SetError(3, 0, 0) Local $iNumberOfFrames = UBound($aFilenames), $i Local $tArrayFrames = DllStructCreate("ptr ptr[" & $iNumberOfFrames & "]"), $tArrayFramesDelay = DllStructCreate("uint delay[" & $iNumberOfFrames & "]") Local $tArrayAnim[$iNumberOfFrames], $tArrayFrameDelay[$iNumberOfFrames], $aDim, $iW, $iH For $i = 0 To $iNumberOfFrames - 1 If Not FileExists($aFilenames[$i][0]) Then Return SetError(4, 0, 0) $tArrayAnim[$i] = DllStructCreate("char path[" & StringLen($aFilenames[$i][0]) + 1 & "]") $tArrayAnim[$i].path = $aFilenames[$i][0] $tArrayFrames.ptr(($i + 1)) = DllStructGetPtr($tArrayAnim[$i]) $tArrayFramesDelay.delay($i + 1) = UBound($aFilenames, 2) ? ($aFilenames[$i][1] > 0 ? $aFilenames[$i][1] : $iDefaultDelay) : $iDefaultDelay Next Local $tAnim = DllStructCreate("ptr pFrames;ptr pDelays") $tAnim.pFrames = DllStructGetPtr($tArrayFrames) $tAnim.pDelays = DllStructGetPtr($tArrayFramesDelay) If StringRight($sOutfile, 5) <> ".webp" Then $sOutfile &= ".webp" $loop_count = $loop_count < 0 ? 0 : $loop_count Local $iReturn = DllCall($sDLL, "long", "WebP_CreateWebPCreateAnim", _ "struct*", $tAnim, _ ;array of filenames with GDi+ supported images and delay per frame "uint", $iNumberOfFrames, _ ;amount of frames "str", $sOutfile, _ ;amount of frames "long", $lossless, _ ;lossless "float", $quality, _ ;quality "long", $method, _ ;method "long", $sns_strength, _ ;sns_strength "long", $filter_sharpness, _ ;filter_sharpness "long", $filter_strength, _ ;filter_strength "long", $pass, _ ;pass "long", $level, _ ;level "long", $near_lossless, _ ;near_lossless "long", $alpha_compression, _ ;alpha_compression "long", $alpha_filtering, _ ;alpha_filtering "long", $alpha_quality, _ ;alpha_quality "long", $target_size, _ ;target_size "long", $loop_count, _ ;loop count -> 0 = endless "long", $WebPPreset, _ ;WebPPreset "ptr", $pCallback)[0] ;callback pointer for progress status If $iReturn < 1 Then Return SetError(7, 0, $iReturn) ReDim $tArrayAnim[0] ReDim $tArrayFrameDelay[0] Return 1 EndFunc ;==>WebP_CreateWebPCreateAnim ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_CreateWebPCreateAnimFromScreenCapture ; Description ...: Capture the screen to WebP animation file ; Syntax ........: WebP_CreateWebPCreateAnimFromScreenCapture($x, $y, $w, $h, $sec, $sOutfile[, $fps = 30[, $CapCursor = 1[, ; $quality = 75.0[, $lossless = 0[, $method = 4[, $filter_strength = 60[, $sns_strength = 50[, $pass = 1[, ; $level = 6[, $filter_sharpness = 0[, $near_lossless = 100[, $alpha_compression = 1[, ; $alpha_filtering = 1[, $alpha_quality = 100[, $target_size = 0[, $loop_count = 0[, ; $WebPPreset = $WEBP_PRESET_DEFAULT[, $pCallback = 0[, $sPath2DLL = ""]]]]]]]]]]]]]]]]]]]) ; Parameters ....: $x - x position on the screen where to start the capturing. ; $y - y position on the screen where to start the capturing. ; $w - width of the screen to capture. ; $h - height of the screen to capture. ; $sec - seconds to capture ; $sOutfile - filename of WebP animation output file. ; $fps - [optional] a floating point value. Default is 30 fps. ; $CapCursor - [optional] an unknown value. Default is 1. ; $quality - [optional] an unknown value. Default is 75.0. Valid range is 0 - 100. ; $lossless - [optional] an unknown value. Default is 0. 0 for lossy encoding / 1 for lossless. ; $method - [optional] a map. Default is 4. Valid range is 0 - 6 (0=fast, 6=slower-better). ; $filter_strength - [optional] a floating point value. Default is 60. Range: [0 = off .. 100 = strongest] ; $sns_strength - [optional] a string value. Default is 50. Spatial Noise Shaping. 0=off, 100=maximum ; $pass - [optional] a pointer value. Default is 1. Number of entropy-analysis passes (in [1..10]). ; $level - [optional] an unknown value. Default is 6. Between 0 (fastest, lowest compression) and 9 (slower, best compression) only valid for lossless = 1! ; $filter_sharpness - [optional] a floating point value. Default is 0. Range: [0 = off .. 7 = least sharp] ; $near_lossless - [optional] a general number value. Default is 100. Near lossless encoding [0 = max loss .. 100 = off (default)]. ; $alpha_compression - [optional] an array of unknowns. Default is 1. Algorithm for encoding the alpha plane (0 = none,1 = compressed with WebP lossless). Default is 1. ; $alpha_filtering - [optional] an array of unknowns. Default is 1. Predictive filtering method for alpha plane.0: none, 1: fast, 2: best. Default if 1. ; $alpha_quality - [optional] an array of unknowns. Default is 100. Between 0 (smallest size) and 100 (lossless). Default is 100. ; $target_size - [optional] a dll struct value. Default is 0. If non-zero, set the desired target size in bytes. ; $loop_count - [optional] an unknown value. Default is 0. 0 = endless. ; $WebPPreset - [optional] an unknown value. Default is $WEBP_PRESET_DEFAULT. ; $pCallback - [optional] a pointer value. Default is 0. Callback pointer for progress status ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir. ; Return values .: 1 on success, otherwise error -> -1 to -8 ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_CreateWebPCreateAnimFromScreenCapture($x, $y, $w, $h, $sec, $sOutfile, $fps = 30, $CapCursor = 1, $quality = 75.0, $lossless = 0, $method = 4, $filter_strength = 60, $sns_strength = 50, _ $pass = 1, $level = 6, $filter_sharpness = 0, $near_lossless = 100, $alpha_compression = 1, $alpha_filtering = 1, $alpha_quality = 100, _ $target_size = 0, $loop_count = 0, $WebPPreset = $WEBP_PRESET_DEFAULT, $pCallback = 0, $sPath2DLL = "") If $w < 1 Or $h < 1 Or $fps < 1 Or $sec < 1 Then Return SetError(1, 0, 0) Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(2, 0, 0) ;DLL not found $loop_count = $loop_count < 0 ? 0 : $loop_count Local $iReturn = DllCall($sDLL, "long", "WebP_CreateWebPCreateAnimFromScreenCapture", _ "long", $x, _ ;x position of the screen "long", $y, _ ;y position of the screen "ulong", $w, _ ;width of the screen to capture "ulong", $h, _ ;height of the screen to capture "long", $sec, _ ;duration in seconds "ushort", $fps, _ ;fps for capturing "str", $sOutfile, _ ;output file name "ubyte", $CapCursor, _ ;capture cursor "long", $lossless, _ ;lossless "float", $quality, _ ;quality "long", $method, _ ;method "long", $sns_strength, _ ;sns_strength "long", $filter_sharpness, _ ;filter_sharpness "long", $filter_strength, _ ;filter_strength "long", $pass, _ ;pass "long", $level, _ ;level "long", $near_lossless, _ ;near_lossless "long", $alpha_compression, _ ;alpha_compression "long", $alpha_filtering, _ ;alpha_filtering "long", $alpha_quality, _ ;alpha_quality "long", $target_size, _ ;target_size "long", $loop_count, _ ;loop count -> 0 = endless. "long", $WebPPreset, _ ;WebPPreset "ptr", $pCallback)[0] ;callback pointer for progress status If $iReturn < 1 Then Return SetError(3, 0, $iReturn) Return 1 EndFunc ;==>WebP_CreateWebPCreateAnimFromScreenCapture ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_ConvertGIF2WebP ; Description ...: Converts a GIF animation to WebP animation ; Syntax ........: WebP_ConvertGIF2WebP($sGIFAnimFile, $sOutWebPFile[, $quality = 75.0[, $lossless = 0[, $method = 5[, ; $filter_strength = 60[, $sns_strength = 50[, $pass = 3[, $level = 8[, $filter_sharpness = 0[, ; $near_lossless = 100[, $alpha_compression = 1[, $alpha_filtering = 1[, $alpha_quality = 100[, ; $target_size = 0[, $loop_count = 0[, $WebPPreset = $WEBP_PRESET_DEFAULT[, $pCallback = 0[, ; $sPath2DLL = ""]]]]]]]]]]]]]]]]]) ; Parameters ....: $sGIFAnimFile - a string value. ; $sOutWebPFile - a string value. ; $quality - [optional] an unknown value. Default is 75.0. Valid range is 0 - 100. ; $lossless - [optional] an unknown value. Default is 0. 0 for lossy encoding / 1 for lossless. ; $method - [optional] a map. Default is 5. Valid range is 0 - 6 (0=fast, 6=slower-better). ; $filter_strength - [optional] a floating point value. Default is 60. Range: [0 = off .. 100 = strongest] ; $sns_strength - [optional] a string value. Default is 50. Spatial Noise Shaping. 0=off, 100=maximum ; $pass - [optional] a pointer value. Default is 3. Number of entropy-analysis passes (in [1..10]). ; $level - [optional] an unknown value. Default is 8. Between 0 (fastest, lowest compression) and 9 (slower, best compression) only valid for lossless = 1! ; $filter_sharpness - [optional] a floating point value. Default is 0. Range: [0 = off .. 7 = least sharp] ; $near_lossless - [optional] a general number value. Default is 100. Near lossless encoding [0 = max loss .. 100 = off (default)]. ; $alpha_compression - [optional] an array of unknowns. Default is 1. Algorithm for encoding the alpha plane (0 = none,1 = compressed with WebP lossless). Default is 1. ; $alpha_filtering - [optional] an array of unknowns. Default is 1. Predictive filtering method for alpha plane.0: none, 1: fast, 2: best. Default if 1. ; $alpha_quality - [optional] an array of unknowns. Default is 100. Between 0 (smallest size) and 100 (lossless). Default is 100. ; $target_size - [optional] a dll struct value. Default is 0. If non-zero, set the desired target size in bytes. ; $loop_count - [optional] an unknown value. Default is 0. 0 = endless. ; $WebPPreset - [optional] an unknown value. Default is $WEBP_PRESET_DEFAULT. ; $pCallback - [optional] a pointer value. Default is 0. ; $sPath2DLL - [optional] a string value. Default is "". ; Return values .: 1 on success, otherwise error -> -1 to -11 ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_ConvertGIF2WebP($sGIFAnimFile, $sOutWebPFile, $quality = 75.0, $lossless = 0, $method = 5, $filter_strength = 60, $sns_strength = 50, _ $pass = 3, $level = 8, $filter_sharpness = 0, $near_lossless = 100, $alpha_compression = 1, $alpha_filtering = 1, $alpha_quality = 100, _ $target_size = 0, $loop_count = 0, $WebPPreset = $WEBP_PRESET_DEFAULT, $pCallback = 0, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found If $sOutWebPFile = "" Then Return SetError(2, 0, 0) If StringRight($sOutWebPFile, 5) <> ".webp" Then $sOutWebPFile &= ".webp" $loop_count = $loop_count < 0 ? 0 : $loop_count Local $iReturn = DllCall($sDLL, "long", "WebP_ConvertGIF2WebP", _ "str", $sGIFAnimFile, _ ;GIF animated input file "str", $sOutWebPFile, _ ;WebP animation output file "long", $lossless, _ ;lossless "float", $quality, _ ;quality "long", $method, _ ;method "long", $sns_strength, _ ;sns_strength "long", $filter_sharpness, _ ;filter_sharpness "long", $filter_strength, _ ;filter_strength "long", $pass, _ ;pass "long", $level, _ ;level "long", $near_lossless, _ ;near_lossless "long", $alpha_compression, _ ;alpha_compression "long", $alpha_filtering, _ ;alpha_filtering "long", $alpha_quality, _ ;alpha_quality "long", $target_size, _ ;target_size "long", $loop_count, _ ;loop count -> 0 = endless "long", $WebPPreset, _ ;WebPPreset "ptr", $pCallback)[0] ;callback pointer for progress status If $iReturn < 1 Then Return SetError(3, 0, $iReturn) Return 1 EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_GetAnimFileInfo ; Description ...: Get information about a WebP anim file ; Syntax ........: WebP_GetAnimFileInfo($sFilename, Byref $tAnimInfo[, $sPath2DLL = ""]) ; Parameters ....: $sFilename - path to webp anim file. ; $tAnimInfo - [in/out] a dll struct value. Must be "ulong Width;ulong Height;ulong FrameCount;ulong Duration;double FPS" ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir. ; Return values .: 1 on success, otherwise error -> -1 to -6 ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_GetAnimFileInfo($sFilename, ByRef $tAnimInfo, $sPath2DLL = "") If Not FileExists($sFilename) Then Return SetError(1, 0, 0) Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(2, 0, 0) ;DLL not found Local $iReturn = DllCall($sDLL, "long", "WebP_GetAnimFileInfo", "str", $sFilename, "struct*", $tAnimInfo)[0] If @error Or $iReturn < 1 Then SetError(3, 0, $iReturn) Return $iReturn EndFunc ;==>WebP_GetAnimFileInfo ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_GetImagesDiffFromFile ; Description ...: Displays the difference of two WebP images. ; Syntax ........: WebP_GetImagesDiffFromFile($sFilename1, $sFilename2[, $iMetricType = 1[, $sPath2DLL = ""]]) ; Parameters ....: $sFilename1 - a string value. First WebP image filename. ; $sFilename2 - a string value. Second WebP image filename. ; $iMetricType - [optional] an integer value. Default is 1. Valid values 0 - 2. ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir. ; Return values .: array with distortion values, otherwise error ; Author ........: UEZ ; Modified ......: ; Remarks .......: Possible metric type: ; 0: PSNR - Peak signal-to-noise ratio - measures numerical deviation (higher = better). ; Value range Interpretation ; > 50 dB Excellent quality - barely visible ; 40-50 dB Very good quality ; 30-40 dB Good to medium quality ; < 30 dB Clearly visible losses ; 1: SSIM - Structural Similarity Index - takes visual perception into account (0 - 100, closer to 100 = better). ; Value range Interpretation ; 95 - 100 Almost identical / perfect quality ; 90 - 95 Very good quality ; 85 - 90 Good quality ; < 85 Visible structural differences ; 2: LSIM - Local Similarity - more detailed, for local differences (more experimental). Same as SSIM. ; ; Both images must have same dimension! ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_GetImagesDiffFromFile($sFilename1, $sFilename2, $iMetricType = 1, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found If Not FileExists($sFilename1) Then Return SetError(2, 0, 0) If Not FileExists($sFilename2) Then Return SetError(3, 0, 0) $iMetricType = ($iMetricType > 2) ? 2 : ($iMetricType < 0 ? 0 : $iMetricType) Local $tDistortion = DllStructCreate("float d[5]") Local $iReturn = DllCall($sDLL, "long", "WebP_GetImagesDiffFromFile", "str", $sFilename1, "str", $sFilename2, "long", $iMetricType, "ptr*", DllStructGetPtr($tDistortion))[0] If $iReturn < 1 Then SetError(4, 0, $iReturn) Local $aDistortion[5] = [$tDistortion.d((1)), $tDistortion.d((2)), $tDistortion.d((3)), $tDistortion.d((4)), $tDistortion.d((5))] Return $aDistortion EndFunc ;==>WebP_GetImagesDiffFromFile ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: Path2DLL ; Description ...: Return the path to the _WebP_x??.dll ; Author ........: UEZ ; Modified.......: ; Remarks .......: This function is used internally by WebP.au3 ; =============================================================================================================================== Func Path2DLL($sPath2DLL = "") Return $sPath2DLL ? $sPath2DLL : @ScriptDir & (@AutoItX64 ? "\_WebP_x64.dll" : "\_WebP_x86.dll") EndFunc ;==>Path2DLL ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_MarkScreenRegion ; Description ...: Selected area on desktop will be captured and save to clipbord or GDI bitmap handle will be returned. ; Syntax ........: _WinAPI_MarkScreenRegion([$iFillMode = 0]) ; Parameters ....: $iFillMode - [optional] an integer value. Default is 0. ; 0: marked area filled with solid color ; 1: marked area filled with hatch pattern ($HS_DIAGCROSS) ; 2: marked area without any fill pattern / color - only red border ; Return values .: 0 / 1 / -1 / array with coordinates [x, y, w, h] ; Author ........: UEZ ; Version .......: 0.90 build 2025-06-27 ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: no ; =============================================================================================================================== Func _WinAPI_MarkScreenRegion($iFillMode = 0) If @OSBuild > 6299 Then ;https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx DllCall("Shcore.dll", "long", "PROCESS_DPI_AWARENESS", 1) ;PROCESS_SYSTEM_DPI_AWARE = 1 (https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx) Else DllCall("User32.dll", "bool", "SetProcessDPIAware") EndIf Local $iOld = AutoItSetOption("MouseCoordMode", 1) Local Const $hDesktop = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hDesktop) ;should work also on multi screens Local Const $iW = $aFullScreen[2], $iH = $aFullScreen[3] Local Const $hGUI_MarkScreen = GUICreate("", $iW, $iH, $aFullScreen[0], $aFullScreen[1], $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) GUISetState(@SW_SHOW, $hGUI_MarkScreen) Local Const $hDC = _WinAPI_GetDC($hGUI_MarkScreen) Local Const $hGfxDC = _WinAPI_CreateCompatibleDC($hDC) Local Const $hBitmapGDI = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local $hObjOld = _WinAPI_SelectObject($hGfxDC, $hBitmapGDI) Local $tSize = DllStructCreate($tagSIZE) $tSize.x = $iW $tSize.y = $iH Local $tSource = DllStructCreate($tagPOINT) Local $tBlend = DllStructCreate($tagBLENDFUNCTION) $tBlend.Alpha = 0xFF $tBlend.Format = 1 Local $tDest = DllStructCreate($tagPOINT), $pPoint = DllStructGetPtr($tDest) $tDest.x = $aFullScreen[0] $tDest.y = $aFullScreen[1] Local Const $hPen = _WinAPI_CreatePen($PS_SOLID, 1, 0x0000FF) Local Const $hPen_Orig = _WinAPI_SelectObject($hGfxDC, $hPen) Local $hBrush, $iAlpha2, $iFlag $iFillMode = $iFillMode > 2 ? 2 : $iFillMode < 0 ? 0 : $iFillMode Switch $iFillMode Case 0 $hBrush = _WinAPI_CreateBrushIndirect($BS_SOLID, 0x808080) $iAlpha2 = 0xA0 $iFlag = $ULW_ALPHA Case 1 $hBrush = _WinAPI_CreateBrushIndirect($BS_HATCHED, 0x808000, $HS_DIAGCROSS) $iAlpha2 = 0x30 $iFlag = $ULW_ALPHA Case 2 $hBrush = _WinAPI_CreateBrushIndirect($BS_HOLLOW, 0x000000) $iAlpha2 = 0xFF ;not needed $iFlag = $ULW_COLORKEY EndSwitch Local $hBrush_Orig = _WinAPI_SelectObject($hGfxDC, $hBrush) Local $aMPos[5], $aMPos_old[4], $tRECT = _WinAPI_CreateRect(0, 0, 0, 0) Do GUISetCursor(16, 1, $hGUI_MarkScreen) $aMPos = GUIGetCursorInfo($hGUI_MarkScreen) $aMPos_old[0] = $aMPos[0] $aMPos_old[1] = $aMPos[1] $aMPos_old[2] = MouseGetPos(0) $aMPos_old[3] = MouseGetPos(1) Switch $aMPos[2] Case 0 ;display crosshair _WinAPI_BitBlt($hGfxDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $CAPTUREBLT) _WinAPI_DrawLine($hGfxDC, $tDest.x, $aMPos[1], $iW, $aMPos[1]) _WinAPI_DrawLine($hGfxDC, $aMPos[0], $tDest.y, $aMPos[0], $iH) _WinAPI_UpdateLayeredWindow($hGUI_MarkScreen, $hDC, $tDest, $tSize, $hGfxDC, $tSource, 0, $tBlend, $ULW_COLORKEY) Case 1 ; $tBlend.Alpha = $iAlpha2 While $aMPos[2] ;mark region GUISetCursor(14, 1, $hGUI_MarkScreen) ;WinGetHandle(AutoItWinGetTitle())) $aMPos = GUIGetCursorInfo($hGUI_MarkScreen) _WinAPI_BitBlt($hGfxDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $CAPTUREBLT) ;clear bitmap ;draw rectangle $tRECT.Left = $aMPos_old[0] $tRECT.Top = $aMPos_old[1] $tRECT.Right = $aMPos[0] $tRECT.Bottom = $aMPos[1] _WinAPI_Rectangle($hGfxDC, $tRECT) If $iFillMode <> 2 Then _WinAPI_InvertRect($hGfxDC, $tRECT) _WinAPI_UpdateLayeredWindow($hGUI_MarkScreen, $hDC, $tDest, $tSize, $hGfxDC, $tSource, 0, $tBlend, $iFlag) Sleep(10) WEnd _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_ReleaseDC($hGUI_MarkScreen, $hDC) _WinAPI_DeleteDC($hGfxDC) _WinAPI_DeleteObject($hBitmapGDI) _WinAPI_SelectObject($hGfxDC, $hPen_Orig) _WinAPI_DeleteObject($hPen) _WinAPI_SelectObject($hGfxDC, $hBrush_Orig) _WinAPI_DeleteObject($hBrush) GUIDelete($hGUI_MarkScreen) AutoItSetOption("MouseCoordMode", $iOld) Local $aCoords[4] = [($aMPos[0] > $aMPos_old[2] ? $aMPos_old[2] : $aMPos[0]), ($aMPos[1] > $aMPos_old[3] ? $aMPos_old[3] : $aMPos[1]), Abs($tRECT.Right - $tRECT.Left) + 1, Abs($tRECT.Bottom - $tRECT.Top) + 1] Return $aCoords EndSwitch Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_ReleaseDC($hGUI_MarkScreen, $hDC) _WinAPI_DeleteDC($hGfxDC) _WinAPI_DeleteObject($hBitmapGDI) _WinAPI_SelectObject($hGfxDC, $hPen_Orig) _WinAPI_DeleteObject($hPen) GUIDelete($hGUI_MarkScreen) AutoItSetOption("MouseCoordMode", $iOld) Return -1 EndSwitch Until False EndFunc ;==>_WinAPI_MarkScreenRegion WebP Advanced Encoder GUI: ;Coded by UEZ build 2025-06-05 #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_HiDpi=n #AutoIt3Wrapper_Version=p #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe ;/rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #pragma compile(Icon, WebP_logo_2010_by_Simo99.ico) #pragma compile(FileVersion, 0.9.9.1) #pragma compile(ProductVersion, 3.3.16.1) #pragma compile(CompanyName, "UEZ Software Development") #pragma compile(ProductName, "WebP Advanced Encoder GUI") AutoItSetOption("MustDeclareVars", 1) #include <Array.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiMenu.au3> #include <GuiStatusBar.au3> #include <Memory.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> #include <WinAPISysWin.au3> #include <WinAPITheme.au3> #include <WindowsConstants.au3> #include "WebP.au3" Break(0) If @OSBuild < 10240 Then MsgBox($MB_ICONWARNING, "Warning", "Your Windows version is not support!", 30) If WebP_Ver2() < "0.3.1" Then Exit MsgBox($MB_ICONERROR, "ERROR", "DLL Version v0.3.1+ required!", 30) Global Const $ver = "v0.99.1", $build = "build 2025-06-05" #Region TichySID Global Const $tagIMAGE_DOS_HEADER = 'WORD e_magic;WORD e_cblp;WORD e_cp;WORD e_crlc;WORD e_cparhdr;WORD e_minalloc;WORD e_maxalloc;WORD e_ss;WORD e_sp;WORD e_csum;WORD e_ip;WORD e_cs;WORD e_lfarlc;WORD e_ovno;WORD e_res[4];WORD e_oemid;WORD e_oeminfo;WORD e_res2[10];LONG e_lfanew;' Global Const $tagIMAGE_FILE_HEADER = 'WORD Machine;WORD NumberOfSections;DWORD TimeDateStamp;DWORD PointerToSymbolTable;DWORD NumberOfSymbols;WORD SizeOfOptionalHeader;WORD Characteristics;' Global $tagIMAGE_OPTIONAL_HEADER = 'WORD Magic;BYTE MajorLinkerVersion;BYTE MinorLinkerVersion;DWORD SizeOfCode;DWORD SizeOfInitializedData;DWORD SizeOfUninitializedData;DWORD AddressOfEntryPoint;DWORD BaseOfCode;DWORD BaseOfData;PTR ImageBase;DWORD SectionAlignment;DWORD FileAlignment;WORD MajorOperatingSystemVersion;WORD MinorOperatingSystemVersion;WORD MajorImageVersion;WORD MinorImageVersion;WORD MajorSubsystemVersion;WORD MinorSubsystemVersion;DWORD Win32VersionValue;DWORD SizeOfImage;DWORD SizeOfHeaders;DWORD CheckSum;WORD Subsystem;WORD DllCharacteristics;PTR SizeOfStackReserve;PTR SizeOfStackCommit;PTR SizeOfHeapReserve;PTR SizeOfHeapCommit;DWORD LoaderFlags;DWORD NumberOfRvaAndSizes;' If @AutoItX64 Then $tagIMAGE_OPTIONAL_HEADER = 'WORD Magic;BYTE MajorLinkerVersion;BYTE MinorLinkerVersion;DWORD SizeOfCode;DWORD SizeOfInitializedData;DWORD SizeOfUninitializedData;DWORD AddressOfEntryPoint;DWORD BaseOfCode;PTR ImageBase;DWORD SectionAlignment;DWORD FileAlignment;WORD MajorOperatingSystemVersion;WORD MinorOperatingSystemVersion;WORD MajorImageVersion;WORD MinorImageVersion;WORD MajorSubsystemVersion;WORD MinorSubsystemVersion;DWORD Win32VersionValue;DWORD SizeOfImage;DWORD SizeOfHeaders;DWORD CheckSum;WORD Subsystem;WORD DllCharacteristics;PTR SizeOfStackReserve;PTR SizeOfStackCommit;PTR SizeOfHeapReserve;PTR SizeOfHeapCommit;DWORD LoaderFlags;DWORD NumberOfRvaAndSizes;' Global Const $tagIMAGE_NT_HEADER = 'DWORD Signature;' & $tagIMAGE_FILE_HEADER & $tagIMAGE_OPTIONAL_HEADER Global Const $tagIMAGE_SECTION_HEADER = 'CHAR Name[8];DWORD VirtualSize;DWORD VirtualAddress;DWORD SizeOfRawData;DWORD PointerToRawData;DWORD PointerToRelocations;DWORD PointerToLinenumbers;WORD NumberOfRelocations;WORD NumberOfLinenumbers;DWORD Characteristics;' Global Const $tagIMAGE_DATA_DIRECTORY = 'DWORD VirtualAddress;DWORD Size;' Global Const $tagIMAGE_BASE_RELOCATION = 'DWORD VirtualAddress;DWORD SizeOfBlock;' Global Const $tagIMAGE_IMPORT_DESCRIPTOR = 'DWORD OriginalFirstThunk;DWORD TimeDateStamp;DWORD ForwarderChain;DWORD Name;DWORD FirstThunk;' Global Const $tagIMAGE_IMPORT_BY_NAME = 'WORD Hint;char Name[1];' Global Const $tagIMAGE_EXPORT_DIRECTORY = 'DWORD Characteristics;DWORD TimeDateStamp;WORD MajorVersion;WORD MinorVersion;DWORD Name;DWORD Base;DWORD NumberOfFunctions;DWORD NumberOfNames;DWORD AddressOfFunctions;DWORD AddressOfNames;DWORD AddressOfNameOrdinals;' Global $_KERNEL32DLL = DllOpen('kernel32.dll') Global $_MFHookPtr, $_MFHookBak, $_MFHookApi = 'LocalCompact' Global Const $tagModule = 'PTR ExportList;PTR CodeBase;PTR ImportList;PTR DllEntry;DWORD Initialized;' Global Const $SID_MEMORY = 1 Global Const $SID_NON_DEFAULT = 2 Global $hTitchysidDll, $iSubsongCount = 0 #EndRegion ; enum _PROCESS_DPI_AWARENESS -> https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx Global Enum $DPI_AWARENESS_INVALID = -1, $PROCESS_DPI_UNAWARE = 0, $PROCESS_SYSTEM_DPI_AWARE, $PROCESS_PER_MONITOR_DPI_AWARE ;https://docs.microsoft.com/en-us/windows/desktop/hidpi/dpi-awareness-context Global Enum $Context_UnawareGdiScaled = -5, $Context_PerMonitorAwareV2, $Context_PerMonitorAware, $Context_SystemAware, $Context_Unaware ; enum _MONITOR_DPI_TYPE Global Enum $MDT_EFFECTIVE_DPI = 0, $MDT_ANGULAR_DPI, $MDT_RAW_DPI Global Const $MDT_DEFAULT = $MDT_EFFECTIVE_DPI Global Const $SM_CXPADDEDBORDER = 92 _GDIPlus_Startup() ;~ Global $aDPI = _WinAPI_GetDpiForMonitor() ;_GDIPlus_GraphicsGetDPIRatio() Global $aDPI = [1, 1] Global $hGUI_About, $iFPS = 0, $iShowFPS = 0, $bExit, $bGUIBgColor = 0xFF808080 #Region GUI Global Const $SC_DRAGMOVE = 0xF012, $iW = 322, $iH = 694 Global Const $hGUI = GUICreate("WAE GUI " & $ver & " Beta by UEZ", $iW, $iH, @DesktopWidth - $iW - 8, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_APPWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) GUISetFont(10 * $aDPI[0], 400, 0, "Arial Narrow") Global Const $Title = GUICtrlCreateLabel("WebP Advanced Encoder GUI", 5, 8, 310, 41) GUICtrlSetFont(-1, 21 * $aDPI[0], 400, 0, "Arial Narrow") Global Const $icLoad = GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -127, 8, 60, 32, 32, BitOR($GUI_SS_DEFAULT_ICON, $WS_BORDER)) GUICtrlSetTip(-1, "Load a GDI+ supported image") Global Const $icSave = GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -259, 56, 60, 32, 32, BitOR($GUI_SS_DEFAULT_ICON, $WS_BORDER)) GUICtrlSetTip(-1, "Save compressed image in WebP format.") Global Const $icReset = GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -239, 104, 60, 32, 32, BitOR($GUI_SS_DEFAULT_ICON, $WS_BORDER)) GUICtrlSetTip(-1, "Reset image position if image was moved (only for images larger than preview window).") GUICtrlCreateLabel("", 0, 106, $iW - 2, 2, $SS_ETCHEDHORZ) Global Const $lbPresets = GUICtrlCreateLabel("Presets", 10, 125, 39, 20) Global Const $cbPreset = GUICtrlCreateCombo("Default", 120, 120, $iW - 177, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)), $hcbPreset = GUICtrlGetHandle($cbPreset) GUICtrlSetData(-1, "Picture|Photo|Drawing|Icon|Text") Global Const $chkbLossless = GUICtrlCreateCheckbox("&Lossless", 120, 152, 97, 17) GUICtrlSetTip(-1, "Enable lossless compression. Default: lossy.") Global Const $lbEncoding = GUICtrlCreateLabel("Encoding", 10, 152, 48, 20) Global Const $lbQuality = GUICtrlCreateLabel("Quality", 10, 176, 36, 20) Global Const $slQuality = GUICtrlCreateSlider(116, 176, $iW - 164, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslQuality = GUICtrlGetHandle($slQuality) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetData(-1, 75) GUICtrlSetTip(-1, "Between 0 and 100. 0 gives the smallest size and 100 the largest.") Global Const $ipQuality = GUICtrlCreateInput("", $iW - 48, 172, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slQuality)) Global Const $lbMethod = GUICtrlCreateLabel("Method", 10, 210, 39, 20) Global Const $slMethod = GUICtrlCreateSlider(116, 210, $iW - 164, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslMethod = GUICtrlGetHandle($slMethod) GUICtrlSetLimit(-1, 6, 0) GUICtrlSetData(-1, 4) GUICtrlSetTip(-1, "Quality/speed trade-off (0=fast, 6=slower-better.") Global Const $ipMethod = GUICtrlCreateInput("", $iW - 48, 206, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slMethod)) Global Const $lbSNS_Strength = GUICtrlCreateLabel("SNS-Strength", 10, 242, 66, 20) Global Const $slSNS_Strength = GUICtrlCreateSlider(116, 244, $iW - 164, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslSNS_Strength = GUICtrlGetHandle($slSNS_Strength) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetData(-1, 50) GUICtrlSetTip(-1, "Spatial Noise Shaping. 0=off, 100=maximum.") Global Const $ipSSN_Strength = GUICtrlCreateInput("", $iW - 48, 240, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slSNS_Strength)) Global Const $lbFilterSharpness = GUICtrlCreateLabel("Filter Sharpness", 10, $iW - 48, 81, 20) Global Const $slFilter_Sharpness = GUICtrlCreateSlider(116, 278, $iW - 164, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslFilter_Sharpness = GUICtrlGetHandle($slFilter_Sharpness) GUICtrlSetLimit(-1, 7, 0) GUICtrlSetTip(-1, "Range: [0 = off .. 7 = least sharp].") Global Const $ipFilter_Sharpness = GUICtrlCreateInput("", $iW - 48, 274, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slFilter_Sharpness)) Global Const $lbFilter_Strength = GUICtrlCreateLabel("Filter Strenght", 010, 304, 69, 20) Global Const $slFilter_Strength = GUICtrlCreateSlider(116, 312, $iW - 164, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslFilter_Strength = GUICtrlGetHandle($slFilter_Strength) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetData(-1, 60) GUICtrlSetTip(-1, "Range: [0 = off .. 100 = strongest]") Global Const $ipFilter_Strength = GUICtrlCreateInput("", $iW - 48, 308, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slFilter_Strength)) Global Const $lbPass = GUICtrlCreateLabel("Pass", 10, 344, 27, 20) Global Const $slPass = GUICtrlCreateSlider(116, 346, $iW - 164, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslPass = GUICtrlGetHandle($slPass) GUICtrlSetLimit(-1, 10, 1) GUICtrlSetData(-1, 6) GUICtrlSetTip(-1, "Number of entropy-analysis passes (in [1..10]).") Global Const $ipPass = GUICtrlCreateInput("", $iW - 48, 342, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slPass)) Global Const $lbNear_Lossless = GUICtrlCreateLabel("Near Lossless", 10, 378, 80, 20) Global Const $slNear_Lossless = GUICtrlCreateSlider(116, 380, $iW - 164, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslNear_Lossless = GUICtrlGetHandle($slNear_Lossless) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetData(-1, 60) GUICtrlSetTip(-1, "Specify the level of near-lossless image preprocessing. The range is 0 (maximum preprocessing) to 100 (no preprocessing, the default).") Global Const $ipNear_Lossless = GUICtrlCreateInput("", $iW - 48, 374, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slNear_Lossless)) Global Const $lbLevel = GUICtrlCreateLabel("Level", 10, 411, 30, 20) Global Const $slLevel = GUICtrlCreateSlider(116, 414, $iW - 164, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslLevel = GUICtrlGetHandle($slLevel) GUICtrlSetLimit(-1, 9, 0) GUICtrlSetData(-1, 6) GUICtrlSetTip(-1, "Switch on lossless compression mode with the specified level between 0 and 9, with level 0 being the fastest, 9 being the slowest.") Global Const $ipLevel = GUICtrlCreateInput("", $iW - 48, 410, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slLevel)) Global Const $lbAlpha_Compression = GUICtrlCreateLabel("Alpha Compression", 10, 444, 96, 20) Global Const $chkbAlpha_Compression = GUICtrlCreateCheckbox("&Enable", 120, 444, 97, 17) GUICtrlSetState(-1, $GUI_CHECKED) Global Const $lbAlpha_Filtering = GUICtrlCreateLabel("Alpha Filtering", 10, 478, 71, 20) Global Const $slAlpha_Filtering = GUICtrlCreateSlider(114, 482, $iW - 164, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslAlpha_Filtering = GUICtrlGetHandle($slAlpha_Filtering) GUICtrlSetLimit(-1, 2, 0) GUICtrlSetData(-1, 1) GUICtrlSetTip(-1, "Predictive filtering method for alpha plane. 0: none, 1: fast, 2: best. Default if 1.") Global Const $ipAlpha_Filtering = GUICtrlCreateInput("", $iW - 48, 478, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slAlpha_Filtering)) Global Const $lbAlpha_Quality = GUICtrlCreateLabel("Alpha Quality", 8, 516, 66, 20) Global Const $slAlpha_Quality = GUICtrlCreateSlider(114, 516, $iW - 164, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslAlpha_Quality = GUICtrlGetHandle($slAlpha_Quality) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetData(-1, 100) GUICtrlSetTip(-1, "Between 0 (smallest size) and 100 (lossless).") Global Const $ipAlpha_Quality = GUICtrlCreateInput("", $iW - 48, 512, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slAlpha_Quality)) Global Const $lbTarget_Size = GUICtrlCreateLabel("Target Size", 10, 552, 58, 20) Global Const $ipTarget_Size = GUICtrlCreateInput("0", 120, 550, $iW - 177, 24, $ES_NUMBER) GUICtrlSetTip(-1, "If non-zero, set the desired target size in bytes (lossy mode only!).") Global Const $chkbCountColors = GUICtrlCreateCheckbox("&Count Colors", 10, 590, 87, 17) Global Const $lbColorOriginal = GUICtrlCreateLabel("Source:", 101, 590, 38, 20) Global Const $ipColorOriginal = GUICtrlCreateInput("0", 142, 588, 60, 24, BitOR($ES_NUMBER, $ES_READONLY)) Global Const $lbColorWebP = GUICtrlCreateLabel("WebP:", 215, 590, 32, 20) Global Const $ipColorWebP = GUICtrlCreateInput("0", 250, 588, 60, 24, BitOR($ES_NUMBER, $ES_READONLY)) Global Const $btnShow = GUICtrlCreateButton("Show Original Image", 10, 630, 123, 25) GUICtrlSetTip(-1, "Press lmb and hold it to display original image.") Global Const $btnApply = GUICtrlCreateButton("&Apply Settings", 188, 630, 123, 25) Global Const $StatusBar = _GUICtrlStatusBar_Create($hGUI), $iSBColor = 0xE9CFEC _WinAPI_SetWindowTheme($StatusBar, "", "") _GUICtrlStatusBar_SetText($StatusBar, " Welcome to 'WebP Advanced Encoder GUI' ٩(●̮̮̃•̃)۶") _GUICtrlStatusBar_SetBkColor($StatusBar, $iSBColor) Global Const $hGUI_Image = GUICreate("", 0, 0, -1, -1, $WS_EX_TOOLWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_APPWINDOW)) GUISetBkColor(BitAND(0xFFFFFF, $bGUIBgColor), $hGUI_Image) Global Const $iPic_WebP = GUICtrlCreatePic("", 0, 0, 0, 0), $hPic_WebP = GUICtrlGetHandle($iPic_WebP) ;~ Global Const $iW_Zoom = @DesktopWidth * 0.25, $iH_Zoom = @DesktopHeight * 0.25 ;~ Global Const $hGUI_Image_Zoom = GUICreate("", $iW_Zoom, $iH_Zoom, 0, 0, $WS_POPUP) Global Const $dw = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME), $dh = _WinAPI_GetSystemMetrics($SM_CYDLGFRAME) + _WinAPI_GetSystemMetrics($SM_CYSIZE) + 1 Global Enum $idAbout = 5000, $idResetPicPos, $idResetValues Global Const $hMenu_Sys = _GUICtrlMenu_GetSystemMenu($hGUI) _GUICtrlMenu_AppendMenu($hMenu_Sys, $MF_SEPARATOR, 0, 0) _GUICtrlMenu_AppendMenu($hMenu_Sys, $MF_STRING, $idAbout, "About") Global Const $hImage_Icon = _GDIPlus_BitmapCreateFromMemory(_WebP_Icon()) Global Const $hIcon = _GDIPlus_HICONCreateFromBitmap($hImage_Icon) _WinAPI_SetClassLongEx($hGUI, -34, $hIcon) _GDIPlus_ImageDispose($hImage_Icon) GUISetState(@SW_HIDE, $hGUI_Image) GUISetState(@SW_SHOW, $hGUI) ;~ GUISetState(@SW_SHOW, $hGUI_Image_Zoom) _WinAPI_SetProcessDpiAwarenessContext($Context_PerMonitorAwareV2, $hGUI, 2) Global Const $iDummy_About = GUICtrlCreateDummy(), $iDummy_Return = GUICtrlCreateDummy() Global $sFileLoad, $hImage, $hImage_GDI, $hHBitmap, $aDim, $aPixelFormat, $pMemData, $pMemData_Size, $tMem, $mp, $sFileSave, $hFile, $nBytes, $nBytes, $iResetPosX, $iResetPosY, _ $hImage_tmp GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES") GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL") #EndRegion GUI Global $aGUIGetMsg, $aMPos1, $aMPos2, $iMPx, $iMPy, $iMPx_p = 0, $iMPy_p = 0, $bBigger = False, $iResult, $old_cursor, $bNew = False While 1 $mp = GUIGetCursorInfo($hGUI) If $hImage And $mp[2] And $mp[4] = $btnShow Then _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_WebP, $STM_SETIMAGE, $IMAGE_BITMAP, $hImage_GDI)) While $mp[2] $mp = GUIGetCursorInfo($hGUI) Sleep(10) WEnd _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_WebP, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) EndIf $mp = GUIGetCursorInfo($hGUI_Image) $aMPos1 = MouseGetPos() If $mp[4] = $iPic_WebP And $mp[2] And $bBigger And WinActive($hGUI_Image) Then While $mp[2] $mp = GUIGetCursorInfo($hGUI_Image) Sleep(10) $aMPos2 = MouseGetPos() $iMPx = $iMPx_p + $aMPos2[0] - $aMPos1[0] $iMPy = $iMPy_p + $aMPos2[1] - $aMPos1[1] ControlMove($hGUI_Image, "", $iPic_WebP, $iMPx, $iMPy) WEnd $iMPx_p = $iMPx $iMPy_p = $iMPy EndIf $aGUIGetMsg = GUIGetMsg(1) Switch $aGUIGetMsg[1] Case $hGUI Switch $aGUIGetMsg[0] Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_DROPFILES, "") GUIRegisterMsg($WM_LBUTTONDOWN, "") GUIRegisterMsg($WM_COMMAND, "") GUIRegisterMsg($WM_CONTEXTMENU, "") GUIRegisterMsg($WM_SYSCOMMAND, "") GUIRegisterMsg($WM_HSCROLL, "") ;~ If IsDllStruct($tMem) Then WebP_FreeUp($tMem) _WinAPI_DestroyIcon($hIcon) If $hImage_tmp Then _GDIPlus_ImageDispose($hImage_tmp) If $hImage Then _GDIPlus_ImageDispose($hImage) If $hHBitmap Then _WinAPI_DeleteObject($hHBitmap) If $hImage_GDI Then _WinAPI_DeleteObject($hImage_GDI) If $hGUI_Image Then GUIDelete($hGUI_Image) _GDIPlus_Shutdown() GUIDelete($hGUI_Image) GUIDelete($hGUI) DllClose($_KERNEL32DLL) Exit Case $btnApply, $iDummy_Return If $hImage Then CompressAndDisplay($hImage) EndIf Case $icLoad $sFileLoad = FileOpenDialog("Select an image to compress", "", "Images (*.jpg;*.bmp;*.png;*.gif;*.tif;*webp)") If @error Then ContinueLoop LoadImage($sFileLoad) Case $icSave If $hImage Then $sFileSave = FileSaveDialog("Save WebP Image", "", "WebP Image (*.webp)", BitOR($FD_PATHMUSTEXIST, $FD_PROMPTOVERWRITE), StringRegExpReplace($sFileLoad, ".+\\(.+)\..*", "$1") & ".webp", $hGUI) If @error Then ContinueLoop $hFile = _WinAPI_CreateFile($sFileSave, 1) $iResult = _WinAPI_WriteFile($hFile, $tMem.pMemData, $tMem.memsize, $nBytes) _WinAPI_CloseHandle($hFile) If Not $iResult Then MsgBox($MB_ICONERROR, "ERROR", "Unable to save WebP image to disk!", 30, $hGUI) Else MsgBox($MB_ICONINFORMATION, "Information", "WebP image successfully save to disk", 10, $hGUI) EndIf EndIf Case $icReset ResetImage() Case $slAlpha_Filtering GUICtrlSetData($ipAlpha_Filtering, GUICtrlRead($slAlpha_Filtering)) Case $slAlpha_Quality GUICtrlSetData($ipAlpha_Quality, GUICtrlRead($slAlpha_Quality)) Case $slFilter_Sharpness GUICtrlSetData($ipFilter_Sharpness, GUICtrlRead($slFilter_Sharpness)) Case $slFilter_Strength GUICtrlSetData($ipFilter_Strength, GUICtrlRead($slFilter_Strength)) Case $slLevel GUICtrlSetData($ipLevel, GUICtrlRead($slLevel)) Case $slMethod GUICtrlSetData($ipMethod, GUICtrlRead($slMethod)) Case $slNear_Lossless GUICtrlSetData($ipNear_Lossless, GUICtrlRead($slNear_Lossless)) Case $slPass GUICtrlSetData($ipPass, GUICtrlRead($slPass)) Case $slQuality GUICtrlSetData($ipQuality, GUICtrlRead($slQuality)) Case $slSNS_Strength GUICtrlSetData($ipSSN_Strength, GUICtrlRead($slSNS_Strength)) Case $iDummy_About AutoItSetOption("GUIOnEventMode", 1) GDIPlus_About(11 * $aDPI[0], -12, 24.5) AutoItSetOption("GUIOnEventMode", 0) Case $btnShow If BitAND(WinGetState($hGUI_Image), $WIN_STATE_VISIBLE) = $WIN_STATE_VISIBLE Then WinActivate($hGUI_Image) EndSwitch Case $hGUI_Image Switch $aGUIGetMsg[0] Case $GUI_EVENT_CLOSE EndSwitch EndSwitch WEnd Func ResetImage() If $bBigger Then $iMPx_p = $iResetPosX $iMPy_p = $iResetPosY ControlMove($hGUI_Image, "", $iPic_WebP, $iMPx_p, $iMPy_p) EndIf EndFunc Func LoadImage($sFileLoad) If $hImage_tmp Then _GDIPlus_ImageDispose($hImage_tmp) If $hImage Then _GDIPlus_ImageDispose($hImage) If $hImage_GDI Then _WinAPI_DeleteObject($hImage_GDI) If StringRight($sFileLoad, 5) = ".webp" Then If WebP_GetAmountOfAnimFrames($sFileLoad) > 0 Then Return MsgBox($MB_ICONERROR, "ERROR", "WebP animated image cannot be loaded!", 30, $hGUI) $hImage_tmp = WebP_BitmapCreateGDIp($sFileLoad) If @error Or $hImage_tmp = 0 Then Return MsgBox($MB_ICONERROR, "ERROR", "Unable to decode WebP image!", 30, $hGUI) EndIf Else $hImage_tmp = _GDIPlus_ImageLoadFromFile($sFileLoad) If @error Or $hImage_tmp = 0 Then Return MsgBox($MB_ICONERROR, "ERROR", "Unknown image format!", 30, $hGUI) EndIf EndIf $aPixelFormat = _GDIPlus_ImageGetPixelFormat($hImage_tmp) ;Local Const $aImageRawFormat = _GDIPlus_ImageGetRawFormat($hImage_tmp) If BitAND(GUICtrlRead($chkbCountColors), $GUI_CHECKED) Then GUICtrlSetData($ipColorOriginal, BitmapCountColors($hImage_tmp)) Else GUICtrlSetData($ipColorOriginal, 0) EndIf ;~ If $hImage_tmp Then ConsoleWrite("Original color count: " & BitmapCountColors($hImage_tmp) & @CRLF) $aDim = _GDIPlus_ImageGetDimension($hImage_tmp) $hImage = _GDIPlus_BitmapCreateFromScan0($aDim[0], $aDim[1]) Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage) If $aPixelFormat[0] = 2498570 Then _GDIPlus_GraphicsClear($hGfx, $bGUIBgColor) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_tmp, 0, 0, $aDim[0], $aDim[1]) _GDIPlus_GraphicsDispose($hGfx) $hImage_GDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $bNew = True _WinAPI_LockWindowUpdate($hGUI) CompressAndDisplay($hImage, $aPixelFormat[1]) _WinAPI_LockWindowUpdate(0) EndFunc ;==>LoadImage Func CompressAndDisplay($hImage, $sFormat = "") Local $aDim = _GDIPlus_ImageGetDimension($hImage) If $hHBitmap Then _WinAPI_DeleteObject($hHBitmap) $pMemData = 0 $pMemData_Size = 0 Local $iPreset = GUICtrlRead($cbPreset) Switch $iPreset Case "Default" $iPreset = 0 Case "Picture" $iPreset = 1 Case "Photo" $iPreset = 2 Case "Drawing" $iPreset = 3 Case "Icon" $iPreset = 4 Case "Text" $iPreset = 5 EndSwitch ;~ If IsDllStruct($tMem) Then WebP_FreeUp($tMem) $old_cursor = MouseGetCursor() GUISetCursor(15, 1, $hGUI) _GUICtrlStatusBar_SetBkColor($StatusBar, 192) Local $iCallback = DllCallbackRegister("Progress", "long", "long;ptr"), $hCallback = DllCallbackGetPtr($iCallback) Sleep(10) Local $end, $fTimer = TimerInit() $tMem = WebP_CreateWebPAdvancedFromBitmap("", $hImage, _ $iPreset, _ BitAND(GUICtrlRead($chkbLossless), $GUI_CHECKED), _ GUICtrlRead($slQuality), _ GUICtrlRead($slMethod), _ GUICtrlRead($slSNS_Strength), _ GUICtrlRead($slFilter_Sharpness), _ GUICtrlRead($slFilter_Strength), _ GUICtrlRead($slPass), _ GUICtrlRead($slLevel), _ GUICtrlRead($slNear_Lossless), _ BitAND(GUICtrlRead($chkbAlpha_Compression), $GUI_CHECKED), _ GUICtrlRead($slAlpha_Filtering), _ GUICtrlRead($slAlpha_Quality), _ GUICtrlRead($ipTarget_Size), _ True, _ ;hold the compressed image in memory only, no save to HD! $hCallback) $end = TimerDiff($fTimer) DllCallbackFree($hCallback) ToolTip("") _GUICtrlStatusBar_SetBkColor($StatusBar, $iSBColor) GUISetCursor($old_cursor, 1, $hGUI) Local $iColorsWebp = 0 If IsDllStruct($tMem) Then _GUICtrlStatusBar_SetText($StatusBar, "WebP size: " & Round($tMem.memsize / 1024, 2) & " kb / encoded in " & Round($end, 2) & " ms.") $hHBitmap = WebP_BitmapCreateGDIpFromMem($tMem.pMemData, $tMem.memsize, True, BitAND(GUICtrlRead($chkbCountColors), $GUI_CHECKED)) If @error Then Return MsgBox($MB_ICONERROR, "ERROR", "Unable to compress image", 30, $hGUI) $iColorsWebp = @extended GUICtrlSetData($ipColorWebP, $iColorsWebp) If BitAND(GUICtrlRead($chkbCountColors), $GUI_CHECKED) And GUICtrlRead($ipColorOriginal) = "0" Then GUICtrlSetData($ipColorOriginal, BitmapCountColors($hImage_tmp)) ;~ ConsoleWrite("WebP image color count: " & @extended & @CRLF) Local $aTaskbar = WinGetPos("[CLASS:Shell_TrayWnd;INSTANCE:1]", ""), $tbw = 0, $tbh = 0 If $aTaskbar[2] > $aTaskbar[3] Then $tbh = $aTaskbar[3] ELse $tbw = $aTaskbar[2] EndIf Local Const $minw = 384, $minh = $minw * 10 / 16 Local $maxw = Min($aDim[0] + $dw, @DesktopWidth * 0.95), $maxh = Min($aDim[1] + $dh, @DesktopHeight * 0.95), $iNewW = 0, $iNewH = 0 If $aDim[0] + $dw > @DesktopWidth * 0.95 Or $aDim[1] + $dh > @DesktopHeight * 0.95 Then $bBigger = True Else $bBigger = False EndIf If $bNew Then $iNewW = Max($minw, $maxw) $iNewH = Max($minh, $maxh) WinMove($hGUI_Image, "", (@DesktopWidth - $iNewW - (@DesktopWidth - $iW > $iNewW ? $iW : 0)) / 2 - $tbw, (@DesktopHeight - $iNewH - $tbh) / 2, $iNewW, $iNewH) WinSetTitle($hGUI_Image, "", StringRegExpReplace($sFileLoad, ".+\\(.*)", "$1") & " / " & $aDim[0] & "x" & $aDim[1] & " px / " & $sFormat & " / " & Round(FileGetSize($sFileLoad) / 1024, 2) & " kb") $iNewH -= $dh ;_WinAPI_GetSystemMetrics($SM_CXBORDER) + _WinAPI_GetSystemMetrics($SM_CYSIZE) + _WinAPI_GetSystemMetrics($SM_CXPADDEDBORDER) * 2 $iMPx_p = ($iNewW - $aDim[0]) / 2 $iMPy_p = ($iNewH - $aDim[1] - 4) / 2 $iResetPosX = $iMPx_p $iResetPosY = $iMPy_p GUICtrlSetPos($iPic_WebP, $iMPx_p, $iMPy_p, $iNewW - 1, $iNewH - 1) $bNew = False EndIf _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_WebP, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) Local Const $iWC_State = WinGetState($hGUI_Image) If $iWC_State <> 7 Or $iWC_State <> 5 Then WinSetState($hGUI_Image, "", @SW_SHOW) WinActivate($hGUI_Image) EndIf WinActivate($hGUI) Else MsgBox($MB_ICONERROR, "ERROR", "DLL encode error " & $tMem, 30) EndIf EndFunc ;==>CompressAndDisplay Func Progress($progress, $ptr) ToolTip($progress & "%", MouseGetPos(0) - 40, MouseGetPos(1)) Return 1 EndFunc Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam Switch $lParam Case $hslAlpha_Filtering GUICtrlSetData($ipAlpha_Filtering, GUICtrlRead($slAlpha_Filtering)) Case $hslAlpha_Quality GUICtrlSetData($ipAlpha_Quality, GUICtrlRead($slAlpha_Quality)) Case $hslFilter_Sharpness GUICtrlSetData($ipFilter_Sharpness, GUICtrlRead($slFilter_Sharpness)) Case $hslFilter_Strength GUICtrlSetData($ipFilter_Strength, GUICtrlRead($slFilter_Strength)) Case $hslLevel GUICtrlSetData($ipLevel, GUICtrlRead($slLevel)) Case $hslMethod GUICtrlSetData($ipMethod, GUICtrlRead($slMethod)) Case $hslNear_Lossless GUICtrlSetData($ipNear_Lossless, GUICtrlRead($slNear_Lossless)) Case $hslPass GUICtrlSetData($ipPass, GUICtrlRead($slPass)) Case $hslQuality GUICtrlSetData($ipQuality, GUICtrlRead($slQuality)) Case $hslSNS_Strength GUICtrlSetData($ipSSN_Strength, GUICtrlRead($slSNS_Strength)) EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_HSCROLL Func WM_DROPFILES($hWnd, $iMsg, $wParam, $lParam) Local $i = 1 Local $aFileList = _WinAPI_DragQueryFileEx($wParam) Do If StringInStr(FileGetAttrib($aFileList[$i]), "D") Then _ArrayDelete($aFileList, $i) Else $i += 1 EndIf Until $i = UBound($aFileList) $aFileList[0] = UBound($aFileList) - 1 $sFileLoad = $aFileList[1] _WinAPI_DragFinish($wParam) LoadImage($sFileLoad) Return 0 EndFunc ;==>WM_DROPFILES# Func WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Func WM_SYSCOMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $ilParam Switch BitAND($iwParam, 0x0000FFFF) Case $idAbout GUICtrlSendToDummy($iDummy_About) EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_SYSCOMMAND Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Switch $iwParam Case 1 GUICtrlSendToDummy($iDummy_Return) Return 0 Case $idResetPicPos ResetImage() Return 0 Case $idResetValues GUICtrlSetData($slAlpha_Filtering, 1) GUICtrlSetData($ipAlpha_Filtering, 1) GUICtrlSetData($slAlpha_Quality, 100) GUICtrlSetData($ipAlpha_Quality, 100) GUICtrlSetData($slFilter_Sharpness, 0) GUICtrlSetData($ipFilter_Sharpness, 0) GUICtrlSetData($slFilter_Strength, 60) GUICtrlSetData($ipFilter_Strength, 60) GUICtrlSetData($slLevel, 6) GUICtrlSetData($ipLevel, 6) GUICtrlSetData($slMethod, 4) GUICtrlSetData($ipMethod, 4) GUICtrlSetData($slNear_Lossless, 60) GUICtrlSetData($ipNear_Lossless, 60) GUICtrlSetData($slPass, 6) GUICtrlSetData($ipPass, 6) GUICtrlSetData($slQuality, 75) GUICtrlSetData($ipQuality, 75) GUICtrlSetData($slSNS_Strength, 50) GUICtrlSetData($ipSSN_Strength, 50) GUICtrlSetData($ipTarget_Size, 0) GUICtrlSetState($chkbAlpha_Compression, $GUI_CHECKED) GUICtrlSetState($chkbLossless, $GUI_UNCHECKED) _SendMessage($hcbPreset, $CB_SETCURSEL, 0) Return 0 EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_COMMAND Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $hWnd Case $hGUI Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Reset values to default", $idResetValues) If $bBigger Then _GUICtrlMenu_InsertMenuItem($hMenu, 1, 0) _GUICtrlMenu_InsertMenuItem($hMenu, 2, "Reset image position", $idResetPicPos) EndIf _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return True EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_CONTEXTMENU Func Max($a, $b) If $a > $b Then Return $a Return $b EndFunc Func Min($a, $b) If $a < $b Then Return $a Return $b EndFunc Func GDIPlus_About($iFontsize = 10, $dx = 0, $dy = 0, $iSpeed = 333, $sFont = "MV Boli") If @AutoItX64 = 0 Then Local $binSIDSound = _Chip_Sound() _SIDStartup() _SIDOpen($binSIDSound) EndIf Local Const $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ About Window" Local Const $fPi = ACos(-1), $fRad = $fPi / 180, $fDeg = 180 / $fPi #Region text Local $sText = _ " WebP Advanced Encoder GUI ²" & _ " " & $ver & " beta " & _ " " & $build & " " & _ " " & _ " Coded by UEZ ;-) " & _ " " & _ "Credits to: " & _ " " & _ "* Google for the WebP API " & _ " and static libraries " & _ "* wakillon for TichySID " & _ " and Stat-Mat for the DLL " & _ "* Soren Lund for SID Tune " & _ "* Ward for Mem call code " & _ " " & _ "-------------------------- " & _ " " & _ "Greetings fly out to: " & _ " " & _ " All Autoit users " & _ " around the globe " & _ " " & _ " " & _ " Press ESC to exit. " & _ " " & _ " " & _ "-------------------------- " & _ " " & _ "NO ..--+++--.. WAR " & _ " .-' | `-. " & _ " +' | `+ " & _ " ' | ` " & _ " ' | ` " & _ ": | : " & _ ": +'|`+ : " & _ ". +' | `+ ; " & _ " + +' | `+ + " & _ " `. +' | `+ .' " & _ " `._ | _.' " & _ "Peace `--.._|_..--' :-) " #EndRegion $bExit = False $hGUI_About = GUICreate($sTitle, $iW, $iH, 0, 0, $WS_POPUP, $WS_EX_NOPARENTNOTIFY, $hGUI) _WinAPI_SetParent($hGUI_About, $hGUI) WinSetTrans($hGUI_About, "", 0xD8) GUISetState(@SW_SHOWNA, $hGUI_About) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI_About) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrush_Clr = _GDIPlus_HatchBrushCreate(18, 0xF0B0B0E0, 0xF0F0F0FF), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xF0808080), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 100, 24) $iFPS = 0 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") Local $iLen = StringLen($sText), $iColums = StringInStr($sText, "²"), $i, $u, $s, $r, $iChar_Space, $x, $y, $t = 0, $f, $b = 0, $a = 512, $iCharCol = 0x101030 $sText = StringReplace($sText, "²", " ") Local $aChars = StringSplit($sText, "", 2) Local $hFormat_char = _GDIPlus_StringFormatCreate(), $hFamily_char = _GDIPlus_FontFamilyCreate($sFont), $hFont_char = _GDIPlus_FontCreate($hFamily_char, $iFontsize, 1), _ $tLayout_char = _GDIPlus_RectFCreate(), $hBrush_char = _GDIPlus_BrushCreateSolid(0xFF000000 + $iCharCol) Local Const $iMilliSeconds = 5 AdlibRegister("CalcFPS", 1000) Do DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush_Clr, "float", 0, "float", 0, "float", $iW, "float", $iH) ;erase canvas background For $i = 0 To UBound($aChars) - 1 If $aChars[$i] <> " " Then $f = $t - $i / $iSpeed $s = $f > 2 ? 2 : $f $s = $s > 0 ? $s : 0 $r = (2 - $s) * $iColums * $iColums $iChar_Space = $s / 5.1 * $iColums $tLayout_char.x = $dx + $r / 2 * Sin($t + $i) + Mod($i, $iColums) * $iChar_Space $tLayout_char.y = $dy + $r / 3 * Cos($t + $i) + Int($i / $iColums) * $iChar_Space * 1.3333 DllCall($__g_hGDIPDll, "int", "GdipDrawString", "handle", $hCanvas, "wstr", $aChars[$i], "int", -1, "handle", $hFont_char, "struct*", $tLayout_char, "handle", $tLayout_char, "handle", $hBrush_char) EndIf Next $t += 0.025 DllCall($__g_hGDIPDll, "int", "GdipDrawString", "handle", $hCanvas, "wstr", "FPS: " & $iShowFPS, "int", -1, "handle", $hFont_FPS, "struct*", $tLayout_FPS, "handle", $hFormat_FPS, "handle", $hBrush_FPS) DllCall("gdi32.dll", "bool", "BitBlt", "handle", $hDC, "int", 0, "int", 0, "int", $iW, "int", $iH, "handle", $hDC_backbuffer, "int", 0, "int", 0, "dword", $SRCCOPY) $iFPS += 1 If $bExit Then ExitLoop If $r = 0 Then $b = 1 If $b Then $a -= 5 If $a < 256 Then DllCall($__g_hGDIPDll, "int", "GdipSetSolidFillColor", "handle", $hBrush_char, "dword", BitShift(Max(0, $a), -24) + $iCharCol) If $a <= -50 Then $b = 0 $a = 384 DllCall($__g_hGDIPDll, "int", "GdipSetSolidFillColor", "handle", $hBrush_char, "dword", 0xFF000000 + $iCharCol) $t = 0 EndIf EndIf DllCall($_KERNEL32DLL, "dword", "SleepEx", "dword", $iMilliSeconds, "bool", True) Until False AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_FontDispose($hFont_char) _GDIPlus_FontFamilyDispose($hFamily_char) _GDIPlus_StringFormatDispose($hFormat_char) _GDIPlus_BrushDispose($hBrush_char) _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI_About, $hDC) GUIDelete($hGUI_About) If @AutoItX64 = 0 Then _SIDStop() _SIDClose() _SIDShutdown() $binSIDSound = 0 EndIf EndFunc ;==>GDIPlus_About Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 EndFunc ;==>CalcFPS Func _GDIPlus_GraphicsGetDPIRatio($iDPIDef = 96) Local $hGfx = _GDIPlus_GraphicsCreateFromHWND(0) If @error Then Return SetError(1, @extended, 0) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetDpiX", "handle", $hGfx, "float*", 0) If @error Then Return SetError(2, @extended, 0) Local $iDPI = $aResult[2] _GDIPlus_GraphicsDispose($hGfx) Local $aResults[2] = [$iDPIDef / $iDPI, $iDPI / $iDPIDef] Return $aResults EndFunc ;==>_GDIPlus_GraphicsGetDPIRatio Func _WinAPI_GetDpiForMonitor($dpiType = $MDT_DEFAULT, $iDPIDef = 96) Local $aMonitors = _WinAPI_EnumDisplayMonitors() Local $x, $y Local $aRet = DllCall("Shcore.dll", "long", "GetDpiForMonitor", "long", $aMonitors[1][0], "int", $dpiType, "uint*", $x, "uint*", $y) If @error Or Not IsArray($aRet) Then Return SetError(1, 0, 0) Local $aDPI[2] = [$iDPIDef / $aRet[3], $aRet[3] / $iDPIDef] Return $aDPI EndFunc ;==>_WinAPI_GetDpiForMonitor Func _WinAPI_SetDPIAwareness($hGUI = 0) Switch @OSBuild Case 6000 To 9199 If Not DllCall("user32.dll", "bool", "SetProcessDPIAware") Then Return SetError(1, 0, 0) Return 1 Case 9200 To 13999 _WinAPI_SetProcessDpiAwareness($PROCESS_PER_MONITOR_DPI_AWARE) If @error Then Return SetError(1, 0, 0) Return 1 Case @OSBuild > 13999 #cs Context_Unaware = ((DPI_AWARENESS_CONTEXT)(-1)), Context_SystemAware = ((DPI_AWARENESS_CONTEXT)(-2)), Context_PerMonitorAware = ((DPI_AWARENESS_CONTEXT)(-3)), Context_PerMonitorAwareV2 = ((DPI_AWARENESS_CONTEXT)(-4)), Context_UnawareGdiScaled = ((DPI_AWARENESS_CONTEXT)(-5)) #ce _WinAPI_SetProcessDpiAwarenessContext($Context_PerMonitorAwareV2, $hGUI) If @error Then Return SetError(3, @error, 0) Return 1 EndSwitch Return -1 EndFunc ;==>_WinAPI_SetDPIAwareness Func _WinAPI_SetProcessDpiAwareness($DPIAware) ;https://docs.microsoft.com/en-us/windows/desktop/api/shellscalingapi/nf-shellscalingapi-setprocessdpiawareness DllCall("Shcore.dll", "long", "SetProcessDpiAwareness", "int", $DPIAware) If @error Then Return SetError(1, 0, 0) Return 1 EndFunc ;==>_WinAPI_SetProcessDpiAwareness ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext Func _WinAPI_SetProcessDpiAwarenessContext($DPIAwareContext = $Context_PerMonitorAware, $hGUI = 0, $iMode = 1) ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext $DPIAwareContext = ($DPIAwareContext < -5) ? -5 : ($DPIAwareContext > -1) ? -1 : $DPIAwareContext $iMode = ($iMode < 1) ? 1 : ($iMode > 3) ? 3 : $iMode Switch $iMode Case 1 Local $hDC = _WinAPI_GetDC($hGUI) Local $aResult1 = DllCall("user32.dll", "ptr", "GetDpiFromDpiAwarenessContext", "ptr", $hDC) If @error Or Not IsArray($aResult1) Then Return SetError(11, 0, 0) _WinAPI_ReleaseDC(0, $hDC) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult1[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(12, 0, 0) Case 2 ;~ If Not $hGUI Then $hGUI = WinGetHandle(AutoItWinGetTitle()) Local $aResult2 = DllCall("user32.dll", "int", "GetWindowDpiAwarenessContext", "ptr", $hGUI) If @error Or Not IsArray($aResult2) Then Return SetError(21, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult2[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(22, 0, 0) Case 3 Local $aResult31 = DllCall("user32.dll", "ptr", "GetThreadDpiAwarenessContext") If @error Or Not IsArray($aResult31) Then Return SetError(31, 0, 0) Local $aResult32 = DllCall("user32.dll", "ptr", "GetAwarenessFromDpiAwarenessContext", "ptr", $aResult31[0]) If @error Or Not IsArray($aResult32) Then Return SetError(32, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetThreadDpiAwarenessContext", "int", $aResult32[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(33, 0, 0) EndSwitch Return 1 EndFunc ;==>_WinAPI_SetProcessDpiAwarenessContext ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2020-06-05 Func _Chip_Sound($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Chip_Sound $Chip_Sound &= 'UFNJRAACAHwAABAAEAMAAQABAAAAAENvbW1vZG9yZSA2NAAAAAAAAAAAAAAAAAAAAAAAAAAAU/hyZW4gTHVuZCAoSmVmZikAAAAAAAAAAAAAAAAAAAAyMDA0IFZpcnV6L0NhbWVsb3QAAAAAAAAAAAAAAAAAAAAUAAAAAAAQTH0RTOoRTA0SrZaJkpWarS0oAykgCgUGBi8WCRIVGi0BAAAAAAAAAAABAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFic4S19ziqG61PAOLU5xlr3nE0J0qeAbWpviLHvOJ4XoUcE3tDfEV/WcTgnQo4JuaG6Ir+s5nBOhRgTc0NwQXtZyOCZCjAi4oLggvKzkcEyEGBBwQHBAeFjI4JgIMCAuAQEBAQEBAQEBAQECAgICAgICAwMDAwMEBAQEBQUFBgYGBwcICAkJCgoLDA0NDg8QERITFBUXGBobHR8gIiQnKSsuMTQ3Oj5BRUlOUldcYmhudXyDi5Ocpa+5xNDd6vj9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzRkAAAAAACAaAAAAAABlGgAAAAAAAAAAAA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q/CX8J/wq/Cz8J/+eYBjAYvvBY/vC+8Nn+8Rj+8X7xvtgSshi+8dgSsj+Sshi+8dgSsj+nxvJavvKYD9m+/+eYBjAYvvBY/vC+8Nn+8Rj+8X7y2H7zPtgSshi+8dgSsj+Sshi+8dgSsj+nz/KYvuXYwCHYQCQYwAAhWEA/w==' Local $bString = _WinAPI_Base64Decode($Chip_Sound) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\Commodore_64.sid", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Chip_Sound Func _WebP_Icon($bSaveBinary = False, $sSavePath = @ScriptDir) Local $WebP_Icon $WebP_Icon &= 'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAMkElEQVR4XsRZe3BU1Rn/vnPvPpNsdsnCIgkkFogoElIpFAMZmUIC5SVpBcb6ACMNFAYUi5RRKUgFNWTEDgyKBEHoA4y1ZkKxHQYspfJ0SpGEplIeCXntJvtIsu+993yF3EDGMs3eO67hd3fuP/fuOb/f9zrfOReoV8TkGBFdrwvo7oXFi5bNmjN59pzJi55dZh4OX5y91P3CXQUDFeAxZu0HhSu8BUtbpyxu/eFz3nsyIRZWnsG3BM5VDR1HgMJPFA16PdizojZHxOaI9ssM2NLAZuvX9UiEbweMqTJub9MTkcKvualRFwJPS9DvFUHGtuZrDsz+5Usbc76b7XL7BCYAECQIBKBnzO1vnD+3qKAwX3FFL2KQiP7/UAgAH+4/WLx81urSSdljfX6PBMBMKfK16v6t7iudkXpZAkBIJAhQAMbg/Q2wY/PvSn72uGJKRNTmAYXXwgUlVWd2vvVRvn1wm68FqCvkIkHMGtU0wpQmiiMQdZBwyLIhhRcUmJbM/8lXl2vLyl5FRMWgGjzQ7pbuy7XlTPEvWTM1xp3tLgmRKVYgAg5AMgEov8QDiawOUcB7X11emWWaWXWwSlsI/any2MyiSau35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ogLM+fm5tAIoXEYclGBubi547nIgNzc34AUF+eDPLMqjn8XTEfHr8Pfnx0rHYPWzMZH+7xRKT0+XLPj4+AAvKioSEDiLcnJyMGZkZBC4trZGorZei4uLgaDHSQ4MDw8DRyNmB/z8/KS5Ozs7UhE3dZUU' $WebP_Icon &= 'dYoCg0jWiy8N4qtO1yedn7MFnU4nWTg9PSUL2H8EtgYqDqpdOrqoQ5iQkICxpaXF7i5bWloKXtuapMeDZmdngeClX+scKVSEzYTDyhburHh6emrtokB5/5L2y8PDQ2GPuJuxk2j/7BvTxcWFeuPSbs1SW6uvr5csoPygILg/nJycxMXFIQc40rR1p6Sk9PT0EKil5eVlbIVYh8bGRpwpJAX04tTUVOIRv9ra2vLy8oGBAefOOXJfRnNDk0DL6ejokA5z941kB8bGxv7722msAxF4B6D0K05KGJl3MJ01mXGS+F6BAzmbZQv3eQXkG4Xdi4RQ7jehbOCAgyP3P94Red6jcQCLAAAAAElFTkSuQmCC' Local $bString = _WinAPI_Base64Decode($WebP_Icon) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\WebP_logo_2010_64x64_Simo99.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_WebP_Icon Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode #Region TichySID Func _SIDClose() Local $aRet = MemoryDllCall($hTitchysidDll, 'int', 'SIDClose') If @error Then Return SetError(@error, 0, 0) Return $aRet[0] EndFunc ;==>_SIDClose Func _SIDOpen($Sid, $iSubsong = 1) Local $bSid If Not IsBinary($Sid) Then If Not FileExists($Sid) Then Return SetError(2, 0, 0) Local $hFileOpen = FileOpen($Sid, 0) If $hFileOpen = -1 Then Return SetError(-1, 0, 0) $bSid = FileRead($hFileOpen) FileClose($hFileOpen) Else $bSid = $Sid EndIf Local $tSid = DllStructCreate('byte[' & BinaryLen($bSid) & ']') DllStructSetData($tSid, 1, $bSid) Local $sType = BinaryToString(BinaryMid($bSid, 1, 4), 1) ConsoleWrite('-->-- Sid File Type : ' & $sType & @CRLF) Local $iVersion = Execute(BinaryMid($bSid, 5, 2)) ConsoleWrite('-->-- Sid File Version : ' & $iVersion & @CRLF) $iSubsongCount = Int(StringTrimLeft(BinaryMid($bSid, 15, 2), 2)) ConsoleWrite('-->-- SubsongCount : ' & $iSubsongCount & @CRLF) $iSubsong = $iSubsong - 1 If $iSubsong < 0 Then $iSubsong = 0 If $iSubsong > $iSubsongCount Then $iSubsong = 0 ConsoleWrite('-->-- Subsong : ' & $iSubsong & @CRLF) Local $aRet = MemoryDllCall($hTitchysidDll, 'int', 'SIDOpen', 'ptr', DllStructGetPtr($tSid), 'int', DllStructGetSize($tSid), 'int', $SID_MEMORY, 'int', $SID_NON_DEFAULT, 'int', $iSubsong) If @error Then Return SetError(@error, 0, 0) $tSid = 0 $bSid = 0 Return $aRet[0] EndFunc ;==>_SIDOpen Func _SIDShutdown() MemoryDllClose($hTitchysidDll) $hTitchysidDll = 0 EndFunc ;==>_SIDShutdown Func _SIDStartup() $hTitchysidDll = MemoryDllOpen(TitchySIDdll()) If $hTitchysidDll = -1 Then Return SetError(1, 0, 0) Return SetError(0, 0, $hTitchysidDll) EndFunc ;==>_SIDStartup Func _SIDStop() Local $aRet = MemoryDllCall($hTitchysidDll, 'int', 'SIDStop') If @error Then Return SetError(@error, 0, 0) Return $aRet[0] EndFunc ;==>_SIDStop Func TitchySIDdll() ;only x86 :-( Local $sFileBin = 'cbsATVqQAAMAAACCBAAw//8AALgAOC0BAEAEOBkAsAAMDh8Aug4AtAnNIbgAAUzNIVRoaXMAIHByb2dyYW0AIGNhbm5vdCAAYmUgcnVuIGkAbiBET1MgbW+AZGUuDQ0KJASGADvpjpN/iODAQQUDg6jywHwAB/EQl/PAZQAHUmljBmgBFwVzUEUAAEyAAQQA9O0oVQUTAOAADiELAQUMpAASAAzMAgegEAADfjAECQELABoB5wEABQcA/iCAfgQGgxwAFIEVhgMDA2BgMgAAvoEDgCc84RmKEAMAnKCdDgCAK4JYGA8udGV4dIADftYBRoEBgXUGYgRlAE8uAHJkYXRhAAAeNwHqgX2BERaLE4DtQC5xAxMAW8NAPQF7AT8aAc4JwC5yZWxvY7gAAGjBB8A2whMczgn+QrE8PwA/AD8APwA/ADcAAFWL7IPE6FZXADPJvoRCABC/ASA5EOtzUQ+3RgACJf8PAADB4AAQiUcED7YVmwEAA9Pqg+IBiFcACQ+2TgXB6QRAiwSNCEAA4AMKDLpI4AChAoDhDw9AtwRKiUcOoAEGAaYBFg+2RgYk8ACJRxKKRgSIR0AID7cG9yXgRhAAiQdZQYPGB4MAxyyD+QNyiL+BYRAPtkcWweBgDgBPFYPhBwPB90QlBCAFuQCAoIXBAHYBkYlHGTPJCLEE64AKRxjT6ACD4AGA+Qd1AwCD8AGIRDkZQQCD+Qhy5WaD5gAPiXchuD0KAAIAAAkXwOkE9+EAuTMzAQAryMEA6QiJTyUzwImARfyLRQzpYSBbADPJiU3wiU3sCIhN6yIg6c0BAAAAUYsHAUcagQBnGv///w8zwAD2RwgIdA2JR4AaiUcjx0cngAIAAIpF6/7IPACAcwKwAohF+wAEIAJ0ILksoCr34QK+wQgD8ItGGosADjvBcwn3JzMI0vfxoAeLRxozAMk7RwR3Av7JAIhN+MHoE4hFAPrR6IhF+cHo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ApOBw2N3IAAxXwADhwAAt0AGvdMwDTi9kA0HrdTcDUK90d0WD8AP0BFfMADPYAaPYBRNUrStnwANj5ABHS+AHUT/IB/AD1HtEyRKywWLEuAjAzgHIgAGhwAQswABAwKTA/MEcwAHswjzClMBIxAFkxCTK8MvIyAIAzjTO+M/MzAA40XDShNCQ2AEo2dTadNqI2AKs2uDbINvI2AAc3Ejc9PJM8AME82jwqPUg9AE49kz34PQU+ACU+1z5MP3Y/sJ4/uj8ABkAmNGAAAgRwBiAwbDByMAB4MH4whDCKMACQMJYwnDCiMACoMK4wtDC6MIDAMMYwzDDSP2H/DwAPAA8ADwAPAA8ADwAPAP8PAA8ADwAPAA8ADwAPAA8A/w8ADwAPAA8ADwAPAA8ADwD/DwAPAA8ADwAPAA8ADwAPAP8PAA8ADwAPAA8ADwAPAA8A/w8ADwAPAA8ADwAPAA8ABAA=' $sFileBin = Binary(_WinAPI_Base64Decode($sFileBin)) $sFileBin = Binary(_LzntDecompress($sFileBin)) Return SetError(0, 0, $sFileBin) EndFunc ;==>TitchySIDdll Func _LzntDecompress($bBinary) $bBinary = Binary($bBinary) Local $tInput = DllStructCreate('byte[' & BinaryLen($bBinary) & ']') DllStructSetData($tInput, 1, $bBinary) Local $tBuffer = DllStructCreate('byte[' & 16 * DllStructGetSize($tInput) & ']') Local $a_Call = DllCall('ntdll.dll', 'int', 'RtlDecompressBuffer', 'ushort', 2, 'ptr', DllStructGetPtr($tBuffer), 'dword', DllStructGetSize($tBuffer), 'ptr', DllStructGetPtr($tInput), 'dword', DllStructGetSize($tInput), 'dword*', 0) If @error Or $a_Call[0] Then Return SetError(1, 0, '') Local $tOutput = DllStructCreate('byte[' & $a_Call[6] & ']', DllStructGetPtr($tBuffer)) Return SetError(0, 0, DllStructGetData($tOutput, 1)) EndFunc ;==>_LzntDecompress Func API_FreeLibrary($Module) Local $Ret = DllCall($_KERNEL32DLL, 'bool', 'FreeLibrary', 'handle', $Module) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_FreeLibrary Func API_GetProcAddress($Module, $Procname) If IsNumber($Procname) Then Local $Ret = DllCall($_KERNEL32DLL, 'ptr', 'GetProcAddress', 'handle', $Module, 'int', $Procname) Else Local $Ret = DllCall($_KERNEL32DLL, 'ptr', 'GetProcAddress', 'handle', $Module, 'str', $Procname) EndIf If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_GetProcAddress Func API_IsBadReadPtr($Ptr, $Len) Local $Ret = DllCall($_KERNEL32DLL, 'int', 'IsBadReadPtr', 'ptr', $Ptr, 'UINT_PTR', $Len) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_IsBadReadPtr Func API_LoadLibrary($Filename) Local $Ret = DllCall($_KERNEL32DLL, 'handle', 'LoadLibraryW', 'wstr', $Filename) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_LoadLibrary Func API_lstrlenA($Address) Local $Ret = DllCall($_KERNEL32DLL, 'int', 'lstrlenA', 'ptr', $Address) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_lstrlenA Func API_lstrlenW($Address) Local $Ret = DllCall($_KERNEL32DLL, 'int', 'lstrlenW', 'ptr', $Address) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_lstrlenW Func API_VirtualProtect($Address, $Size, $Protection) Local $Ret = DllCall($_KERNEL32DLL, 'bool', 'VirtualProtect', 'ptr', $Address, 'dword_ptr', $Size, 'dword', $Protection, 'dword*', 0) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_VirtualProtect Func API_ZeroMemory($Address, $Size) Local $Ret = DllCall($_KERNEL32DLL, 'none', 'RtlZeroMemory', 'ptr', $Address, 'dword_ptr', $Size) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_ZeroMemory Func MemLib_BuildImportTable($CodeBase, $PEHeader) Local Const $IMAGE_DIRECTORY_ENTRY_IMPORT = 1 Local Const $SizeOfPtr = DllStructGetSize(DllStructCreate('ptr', 1)) Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) Local $SizeOfDataDirectory = DllStructGetSize(DllStructCreate($tagIMAGE_DATA_DIRECTORY)) Local $ImportDirectoryPtr = $PEHeader + DllStructGetSize($IMAGE_NT_HEADER) + $IMAGE_DIRECTORY_ENTRY_IMPORT * $SizeOfDataDirectory Local $ImportDirectory = DllStructCreate($tagIMAGE_DATA_DIRECTORY, $ImportDirectoryPtr) Local $ImportSize = DllStructGetData($ImportDirectory, 'Size') Local $ImportVirtualAddress = DllStructGetData($ImportDirectory, 'VirtualAddress') Local $SizeOfImportDir = DllStructGetSize(DllStructCreate($tagIMAGE_IMPORT_DESCRIPTOR)) Local $ImportList = '' If $ImportSize > 0 Then Local $ImportDescPtr = $CodeBase + $ImportVirtualAddress While 1 If API_IsBadReadPtr($ImportDescPtr, $SizeOfImportDir) Then ExitLoop Local $ImportDesc = DllStructCreate($tagIMAGE_IMPORT_DESCRIPTOR, $ImportDescPtr) Local $NameOffset = DllStructGetData($ImportDesc, 'Name') If $NameOffset = 0 Then ExitLoop Local $Name = Peek('str', $CodeBase + $NameOffset) Local $OriginalFirstThunk = DllStructGetData($ImportDesc, 'OriginalFirstThunk') Local $FirstThunk = DllStructGetData($ImportDesc, 'FirstThunk') Local $Handle = API_LoadLibrary($Name) If $Handle Then $ImportList &= $Handle & ',' Local $FuncRef = $CodeBase + $FirstThunk Local $ThunkRef = $CodeBase + $OriginalFirstThunk If $OriginalFirstThunk = 0 Then $ThunkRef = $FuncRef While 1 Local $Ref = Peek('ptr', $ThunkRef) If $Ref = 0 Then ExitLoop If BitAND(Peek('byte', $ThunkRef + $SizeOfPtr - 1), 0x80) Then Local $Ptr = API_GetProcAddress($Handle, BitAND($Ref, 0xffff)) Else Local $IMAGE_IMPORT_BY_NAME = DllStructCreate($tagIMAGE_IMPORT_BY_NAME, $CodeBase + $Ref) Local $NamePtr = DllStructGetPtr($IMAGE_IMPORT_BY_NAME, 2) Local $FuncName = Peek('str', $NamePtr) Local $Ptr = API_GetProcAddress($Handle, $FuncName) EndIf If $Ptr = 0 Then Return SetError(1, 0, False) Poke('ptr', $FuncRef, $Ptr) $ThunkRef += $SizeOfPtr $FuncRef += $SizeOfPtr WEnd Else Return SetError(1, 0, False) EndIf $ImportDescPtr += $SizeOfImportDir WEnd EndIf Return $ImportList EndFunc ;==>MemLib_BuildImportTable Func MemLib_CopySections($CodeBase, $PEHeader, $DllDataPtr) Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) Local $SizeOfFileHeader = DllStructGetPtr($IMAGE_NT_HEADER, 'Magic') - $PEHeader Local $SizeOfOptionalHeader = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfOptionalHeader') Local $NumberOfSections = DllStructGetData($IMAGE_NT_HEADER, 'NumberOfSections') Local $SectionAlignment = DllStructGetData($IMAGE_NT_HEADER, 'SectionAlignment') Local $SectionPtr = $PEHeader + $SizeOfFileHeader + $SizeOfOptionalHeader For $i = 1 To $NumberOfSections Local $Section = DllStructCreate($tagIMAGE_SECTION_HEADER, $SectionPtr) Local $VirtualAddress = DllStructGetData($Section, 'VirtualAddress') Local $SizeOfRawData = DllStructGetData($Section, 'SizeOfRawData') Local $PointerToRawData = DllStructGetData($Section, 'PointerToRawData') If $SizeOfRawData = 0 Then Local $Dest = _MemVirtualAlloc($CodeBase + $VirtualAddress, $SectionAlignment, $MEM_COMMIT, $PAGE_READWRITE) API_ZeroMemory($Dest, $SectionAlignment) Else Local $Dest = _MemVirtualAlloc($CodeBase + $VirtualAddress, $SizeOfRawData, $MEM_COMMIT, $PAGE_READWRITE) _MemMoveMemory($DllDataPtr + $PointerToRawData, $Dest, $SizeOfRawData) EndIf DllStructSetData($Section, 'VirtualSize', $Dest - $CodeBase) $SectionPtr += DllStructGetSize($Section) Next EndFunc ;==>MemLib_CopySections Func MemLib_FinalizeSections($CodeBase, $PEHeader) Local Const $IMAGE_SCN_MEM_EXECUTE = 0x20000000 Local Const $IMAGE_SCN_MEM_READ = 0x40000000 Local Const $IMAGE_SCN_MEM_WRITE = 0x80000000 Local Const $IMAGE_SCN_MEM_NOT_CACHED = 0x4000000 Local Const $IMAGE_SCN_CNT_INITIALIZED_DATA = 64 Local Const $IMAGE_SCN_CNT_UNINITIALIZED_DATA = 128 Local Const $PAGE_WRITECOPY = 0x0008 Local Const $PAGE_EXECUTE_WRITECOPY = 0x0080 Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) Local $SizeOfFileHeader = DllStructGetPtr($IMAGE_NT_HEADER, 'Magic') - $PEHeader Local $SizeOfOptionalHeader = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfOptionalHeader') Local $NumberOfSections = DllStructGetData($IMAGE_NT_HEADER, 'NumberOfSections') Local $SectionAlignment = DllStructGetData($IMAGE_NT_HEADER, 'SectionAlignment') Local $SectionPtr = $PEHeader + $SizeOfFileHeader + $SizeOfOptionalHeader For $i = 1 To $NumberOfSections Local $Section = DllStructCreate($tagIMAGE_SECTION_HEADER, $SectionPtr) Local $Characteristics = DllStructGetData($Section, 'Characteristics') Local $SizeOfRawData = DllStructGetData($Section, 'SizeOfRawData') Local $Executable = (BitAND($Characteristics, $IMAGE_SCN_MEM_EXECUTE) <> 0) Local $Readable = (BitAND($Characteristics, $IMAGE_SCN_MEM_READ) <> 0) Local $Writeable = (BitAND($Characteristics, $IMAGE_SCN_MEM_WRITE) <> 0) Local $ProtectList[8] = [$PAGE_NOACCESS, $PAGE_EXECUTE, $PAGE_READONLY, $PAGE_EXECUTE_READ, $PAGE_WRITECOPY, $PAGE_EXECUTE_WRITECOPY, $PAGE_READWRITE, $PAGE_EXECUTE_READWRITE] Local $Protect = $ProtectList[$Executable + $Readable * 2 + $Writeable * 4] If BitAND($Characteristics, $IMAGE_SCN_MEM_NOT_CACHED) Then $Protect = BitOR($Protect, $PAGE_NOCACHE) Local $Size = $SizeOfRawData If $Size = 0 Then If BitAND($Characteristics, $IMAGE_SCN_CNT_INITIALIZED_DATA) Then $Size = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfInitializedData') ElseIf BitAND($Characteristics, $IMAGE_SCN_CNT_UNINITIALIZED_DATA) Then $Size = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfUninitializedData') EndIf EndIf If $Size > 0 Then Local $PhysicalAddress = $CodeBase + DllStructGetData($Section, 'VirtualSize') API_VirtualProtect($PhysicalAddress, $Size, $Protect) EndIf $SectionPtr += DllStructGetSize($Section) Next EndFunc ;==>MemLib_FinalizeSections Func MemLib_FreeLibrary($ModulePtr) If Not MemLib_Vaild($ModulePtr) Then Return 0 Local $Module = DllStructCreate($tagModule, $ModulePtr) Local $CodeBase = DllStructGetData($Module, 'CodeBase') Local $DllEntry = DllStructGetData($Module, 'DllEntry') Local $Initialized = DllStructGetData($Module, 'Initialized') Local $ImportListPtr = DllStructGetData($Module, 'ImportList') Local $ExportListPtr = DllStructGetData($Module, 'ExportList') If $Initialized And $DllEntry Then Local $Success = MemoryFuncCall('bool', $DllEntry, 'ptr', $CodeBase, 'dword', 0, 'ptr', 0) DllStructSetData($Module, 'Initialized', 0) EndIf If $ExportListPtr Then _MemGlobalFree($ExportListPtr) If $ImportListPtr Then Local $ImportList = StringSplit(Peek('str', $ImportListPtr), ',') For $i = 1 To $ImportList[0] If $ImportList[$i] Then API_FreeLibrary($ImportList[$i]) Next _MemGlobalFree($ImportListPtr) EndIf If $CodeBase Then _MemVirtualFree($CodeBase, 0, $MEM_RELEASE) DllStructSetData($Module, 'CodeBase', 0) DllStructSetData($Module, 'ExportList', 0) _MemGlobalFree($ModulePtr) Return 1 EndFunc ;==>MemLib_FreeLibrary Func MemLib_GetExportList($CodeBase, $PEHeader) Local Const $IMAGE_DIRECTORY_ENTRY_EXPORT = 0 Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) Local $SizeOfDataDirectory = DllStructGetSize(DllStructCreate($tagIMAGE_DATA_DIRECTORY)) Local $ExportDirectoryPtr = $PEHeader + DllStructGetSize($IMAGE_NT_HEADER) + $IMAGE_DIRECTORY_ENTRY_EXPORT * $SizeOfDataDirectory Local $ExportDirectory = DllStructCreate($tagIMAGE_DATA_DIRECTORY, $ExportDirectoryPtr) Local $ExportSize = DllStructGetData($ExportDirectory, 'Size') Local $ExportVirtualAddress = DllStructGetData($ExportDirectory, 'VirtualAddress') Local $ExportList = '' If $ExportSize > 0 Then Local $IMAGE_EXPORT_DIRECTORY = DllStructCreate($tagIMAGE_EXPORT_DIRECTORY, $CodeBase + $ExportVirtualAddress) Local $NumberOfNames = DllStructGetData($IMAGE_EXPORT_DIRECTORY, 'NumberOfNames') Local $NumberOfFunctions = DllStructGetData($IMAGE_EXPORT_DIRECTORY, 'NumberOfFunctions') Local $AddressOfFunctions = DllStructGetData($IMAGE_EXPORT_DIRECTORY, 'AddressOfFunctions') If $NumberOfNames = 0 Or $NumberOfFunctions = 0 Then Return '' Local $NameRef = $CodeBase + DllStructGetData($IMAGE_EXPORT_DIRECTORY, 'AddressOfNames') Local $Ordinal = $CodeBase + DllStructGetData($IMAGE_EXPORT_DIRECTORY, 'AddressOfNameOrdinals') For $i = 1 To $NumberOfNames Local $Ref = Peek('dword', $NameRef) Local $Idx = Peek('word', $Ordinal) Local $FuncName = Peek('str', $CodeBase + $Ref) If $Idx <= $NumberOfFunctions Then Local $Addr = $CodeBase + Peek('dword', $CodeBase + $AddressOfFunctions + $Idx * 4) $ExportList &= $FuncName & Chr(1) & $Addr & Chr(1) EndIf $NameRef += 4 $Ordinal += 2 Next EndIf Return $ExportList EndFunc ;==>MemLib_GetExportList Func MemLib_GetProcAddress($ModulePtr, $FuncName) Local $ExportPtr = Peek('ptr', $ModulePtr) If Not $ExportPtr Then Return 0 Local $ExportList = Peek('str', $ExportPtr) Local $Match = StringRegExp($ExportList, '(?i)' & $FuncName & '\001([^\001]*)\001', 3) If Not @error Then Return Ptr($Match[0]) Return 0 EndFunc ;==>MemLib_GetProcAddress Func MemLib_LoadLibrary($DllBinary) $DllBinary = Binary($DllBinary) Local $DllData = DllStructCreate('byte[' & BinaryLen($DllBinary) & ']') Local $DllDataPtr = DllStructGetPtr($DllData) DllStructSetData($DllData, 1, $DllBinary) Local $IMAGE_DOS_HEADER = DllStructCreate($tagIMAGE_DOS_HEADER, $DllDataPtr) If DllStructGetData($IMAGE_DOS_HEADER, 'e_magic') <> 0x5A4D Then Return SetError(1, 0, 0) EndIf Local $PEHeader = $DllDataPtr + DllStructGetData($IMAGE_DOS_HEADER, 'e_lfanew') Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) If DllStructGetData($IMAGE_NT_HEADER, 'Signature') <> 0x4550 Then Return SetError(1, 0, 0) EndIf Switch DllStructGetData($IMAGE_NT_HEADER, 'Magic') Case 0x10B If @AutoItX64 Then Return SetError(2, 0, 0) Case 0x20B If Not @AutoItX64 Then Return SetError(2, 0, 0) EndSwitch Local $ImageBase = DllStructGetData($IMAGE_NT_HEADER, 'ImageBase') Local $SizeOfImage = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfImage') Local $SizeOfHeaders = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfHeaders') Local $AddressOfEntryPoint = DllStructGetData($IMAGE_NT_HEADER, 'AddressOfEntryPoint') Local $ModulePtr = _MemGlobalAlloc(DllStructGetSize(DllStructCreate($tagModule)), $GPTR) If $ModulePtr = 0 Then Return SetError(3, 0, 0) Local $Module = DllStructCreate($tagModule, $ModulePtr) Local $CodeBase = _MemVirtualAlloc($ImageBase, $SizeOfImage, $MEM_RESERVE, $PAGE_READWRITE) If $CodeBase = 0 Then $CodeBase = _MemVirtualAlloc(0, $SizeOfImage, $MEM_RESERVE, $PAGE_READWRITE) If $CodeBase = 0 Then Return SetError(3, 0, 0) DllStructSetData($Module, 'CodeBase', $CodeBase) _MemVirtualAlloc($CodeBase, $SizeOfImage, $MEM_COMMIT, $PAGE_READWRITE) Local $Base = _MemVirtualAlloc($CodeBase, $SizeOfHeaders, $MEM_COMMIT, $PAGE_READWRITE) _MemMoveMemory($DllDataPtr, $Base, $SizeOfHeaders) MemLib_CopySections($CodeBase, $PEHeader, $DllDataPtr) Local $LocationDelta = $CodeBase - $ImageBase If $LocationDelta <> 0 Then MemLib_PerformBaseRelocation($CodeBase, $PEHeader, $LocationDelta) Local $ImportList = MemLib_BuildImportTable($CodeBase, $PEHeader) If @error Then MemLib_FreeLibrary($ModulePtr) Return SetError(2, 0, 0) EndIf Local $ExportList = MemLib_GetExportList($CodeBase, $PEHeader) Local $ImportListPtr = _MemGlobalAlloc(StringLen($ImportList) + 2, $GPTR) Local $ExportListPtr = _MemGlobalAlloc(StringLen($ExportList) + 2, $GPTR) DllStructSetData($Module, 'ImportList', $ImportListPtr) DllStructSetData($Module, 'ExportList', $ExportListPtr) If $ImportListPtr = 0 Or $ExportListPtr = 0 Then MemLib_FreeLibrary($ModulePtr) Return SetError(3, 0, 0) EndIf Poke('str', $ImportListPtr, $ImportList) Poke('str', $ExportListPtr, $ExportList) MemLib_FinalizeSections($CodeBase, $PEHeader) Local $DllEntry = $CodeBase + $AddressOfEntryPoint DllStructSetData($Module, 'DllEntry', $DllEntry) DllStructSetData($Module, 'Initialized', 0) If $AddressOfEntryPoint Then Local $Success = MemoryFuncCall('bool', $DllEntry, 'ptr', $CodeBase, 'dword', 1, 'ptr', 0) If Not $Success[0] Then MemLib_FreeLibrary($ModulePtr) Return SetError(4, 0, 0) EndIf DllStructSetData($Module, 'Initialized', 1) EndIf Return $ModulePtr EndFunc ;==>MemLib_LoadLibrary Func MemLib_PerformBaseRelocation($CodeBase, $PEHeader, $LocationDelta) Local Const $IMAGE_DIRECTORY_ENTRY_BASERELOC = 5 Local Const $IMAGE_REL_BASED_HIGHLOW = 3 Local Const $IMAGE_REL_BASED_DIR64 = 10 Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) Local $SizeOfDataDirectory = DllStructGetSize(DllStructCreate($tagIMAGE_DATA_DIRECTORY)) Local $RelocDirectoryPtr = $PEHeader + DllStructGetSize($IMAGE_NT_HEADER) + $IMAGE_DIRECTORY_ENTRY_BASERELOC * $SizeOfDataDirectory Local $RelocDirectory = DllStructCreate($tagIMAGE_DATA_DIRECTORY, $RelocDirectoryPtr) Local $RelocSize = DllStructGetData($RelocDirectory, 'Size') Local $RelocVirtualAddress = DllStructGetData($RelocDirectory, 'VirtualAddress') If $RelocSize > 0 Then Local $Relocation = $CodeBase + $RelocVirtualAddress While 1 Local $IMAGE_BASE_RELOCATION = DllStructCreate($tagIMAGE_BASE_RELOCATION, $Relocation) Local $VirtualAddress = DllStructGetData($IMAGE_BASE_RELOCATION, 'VirtualAddress') Local $SizeOfBlock = DllStructGetData($IMAGE_BASE_RELOCATION, 'SizeOfBlock') If $VirtualAddress = 0 Then ExitLoop Local $Dest = $CodeBase + $VirtualAddress Local $Entries = ($SizeOfBlock - 8) / 2 Local $RelInfo = DllStructCreate('word[' & $Entries & ']', $Relocation + 8) For $i = 1 To $Entries Local $Info = DllStructGetData($RelInfo, 1, $i) Local $Type = BitShift($Info, 12) If $Type = $IMAGE_REL_BASED_HIGHLOW Or $Type = $IMAGE_REL_BASED_DIR64 Then Local $Addr = DllStructCreate('ptr', $Dest + BitAND($Info, 0xFFF)) DllStructSetData($Addr, 1, DllStructGetData($Addr, 1) + $LocationDelta) EndIf Next $Relocation += $SizeOfBlock WEnd EndIf EndFunc ;==>MemLib_PerformBaseRelocation Func MemLib_Vaild($ModulePtr) Local $ModuleSize = DllStructGetSize(DllStructCreate($tagModule)) If API_IsBadReadPtr($ModulePtr, $ModuleSize) Then Return False Local $Module = DllStructCreate($tagModule, $ModulePtr) Local $CodeBase = DllStructGetData($Module, 'CodeBase') If Not $CodeBase Then Return False Return True EndFunc ;==>MemLib_Vaild Func MemoryDllCall($Module, $RetType, $FuncName, $Type1 = '', $Param1 = 0, $Type2 = '', $Param2 = 0, $Type3 = '', $Param3 = 0, $Type4 = '', $Param4 = 0, $Type5 = '', $Param5 = 0, $Type6 = '', $Param6 = 0, $Type7 = '', $Param7 = 0, $Type8 = '', $Param8 = 0, $Type9 = '', $Param9 = 0, $Type10 = '', $Param10 = 0, $Type11 = '', $Param11 = 0, $Type12 = '', $Param12 = 0, $Type13 = '', $Param13 = 0, $Type14 = '', $Param14 = 0, $Type15 = '', $Param15 = 0, $Type16 = '', $Param16 = 0, $Type17 = '', $Param17 = 0, $Type18 = '', $Param18 = 0, $Type19 = '', $Param19 = 0, $Type20 = '', $Param20 = 0) Local $Ret, $OpenFlag = False Local Const $MaxParams = 20 If (@NumParams < 3) Or (@NumParams > $MaxParams * 2 + 3) Or (Mod(@NumParams, 2) = 0) Then Return SetError(4, 0, 0) If Not IsPtr($Module) Then $OpenFlag = True $Module = MemoryDllOpen($Module) If @error Then Return SetError(1, 0, 0) EndIf Local $Addr = MemLib_GetProcAddress($Module, $FuncName) If Not $Addr Then Return SetError(3, 0, 0) Poke('ptr', $_MFHookPtr + 1 + @AutoItX64, $Addr) Switch @NumParams Case 3 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi) Case 5 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1) Case 7 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2) Case 9 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3) Case 11 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3, $Type4, $Param4) Case 13 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3, $Type4, $Param4, $Type5, $Param5) Case Else Local $DllCallStr = 'DllCall ( $_KERNEL32DLL, $RetType, $_MFHookApi', $n = 1 For $i = 5 To @NumParams Step 2 $DllCallStr &= ', $Type' & $n & ', $Param' & $n $n += 1 Next $DllCallStr &= ' )' $Ret = Execute($DllCallStr) EndSwitch Local $Err = @error If $OpenFlag Then MemoryDllClose($Module) Return SetError($Err, 0, $Ret) EndFunc ;==>MemoryDllCall Func MemoryDllClose($Module) MemLib_FreeLibrary($Module) EndFunc ;==>MemoryDllClose Func MemoryDllOpen($DllBinary) If Not IsDllStruct($_MFHookBak) Then MemoryFuncInit() Local $Module = MemLib_LoadLibrary($DllBinary) If @error Then Return SetError(@error, 0, -1) Return $Module EndFunc ;==>MemoryDllOpen Func MemoryFuncCall($RetType, $Address, $Type1 = '', $Param1 = 0, $Type2 = '', $Param2 = 0, $Type3 = '', $Param3 = 0, $Type4 = '', $Param4 = 0, $Type5 = '', $Param5 = 0, $Type6 = '', $Param6 = 0, $Type7 = '', $Param7 = 0, $Type8 = '', $Param8 = 0, $Type9 = '', $Param9 = 0, $Type10 = '', $Param10 = 0, $Type11 = '', $Param11 = 0, $Type12 = '', $Param12 = 0, $Type13 = '', $Param13 = 0, $Type14 = '', $Param14 = 0, $Type15 = '', $Param15 = 0, $Type16 = '', $Param16 = 0, $Type17 = '', $Param17 = 0, $Type18 = '', $Param18 = 0, $Type19 = '', $Param19 = 0, $Type20 = '', $Param20 = 0) If Not IsDllStruct($_MFHookBak) Then MemoryFuncInit() Poke('ptr', $_MFHookPtr + 1 + @AutoItX64, $Address) Local $Ret Switch @NumParams Case 2 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi) Case 4 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1) Case 6 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2) Case 8 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3) Case 10 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3, $Type4, $Param4) Case 12 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3, $Type4, $Param4, $Type5, $Param5) Case Else Local $DllCallStr = 'DllCall($_KERNEL32DLL, $RetType, $_MFHookApi', $n = 1 For $i = 4 To @NumParams Step 2 $DllCallStr &= ', $Type' & $n & ', $Param' & $n $n += 1 Next $DllCallStr &= ')' $Ret = Execute($DllCallStr) EndSwitch Return SetError(@error, 0, $Ret) EndFunc ;==>MemoryFuncCall Func MemoryFuncInit() Local $KernelHandle = API_LoadLibrary('kernel32.dll') API_FreeLibrary($KernelHandle) Local $HookPtr = API_GetProcAddress($KernelHandle, $_MFHookApi) Local $HookSize = 7 + @AutoItX64 * 5 $_MFHookPtr = $HookPtr $_MFHookBak = DllStructCreate('byte[' & $HookSize & ']') If Not API_VirtualProtect($_MFHookPtr, $HookSize, $PAGE_EXECUTE_READWRITE) Then Return False DllStructSetData($_MFHookBak, 1, Peek('byte[' & $HookSize & ']', $_MFHookPtr)) If @AutoItX64 Then Poke('word', $_MFHookPtr, 0xB848) Poke('word', $_MFHookPtr + 10, 0xE0FF) Else Poke('byte', $_MFHookPtr, 0xB8) Poke('word', $_MFHookPtr + 5, 0xE0FF) EndIf Return True EndFunc ;==>MemoryFuncInit Func Peek($Type, $Ptr) If $Type = 'str' Then $Type = 'char[' & API_lstrlenA($Ptr) & ']' ElseIf $Type = 'wstr' Then $Type = 'wchar[' & API_lstrlenW($Ptr) & ']' EndIf Return DllStructGetData(DllStructCreate($Type, $Ptr), 1) EndFunc ;==>Peek Func Poke($Type, $Ptr, $Value) If $Type = 'str' Then $Type = 'char[' & (StringLen($Value) + 1) & ']' ElseIf $Type = 'wstr' Then $Type = 'wchar[' & (StringLen($Value) + 1) & ']' EndIf DllStructSetData(DllStructCreate($Type, $Ptr), 1, $Value) EndFunc ;==>Poke #EndRegion Download UDF, DLLs and examples on my 1Drv: WebP (to download all marked files, you must login first, otherwise 1by1 only)
    1 point
  15. Oops, forgot to remove the manual path to the DLL. Fixed.
    1 point
  16. Hellooo Just to let you know : example 11 throws an error with the 4th parameter found in the actual script (as it corresponds to your config) Global $aResult = WebP_GetImagesDiffFromFile($aFiles[0] & "\" & $aFiles[1], $aFiles[0] & "\" & $aFiles[2], 2, "c:\_BZ25LN\Coding\FreeBASIC\__UEZ\_Graphical Stuff\WebP\WebP-dll.dll") Of course it works fine without the 4th parameter : Global $aResult = WebP_GetImagesDiffFromFile($aFiles[0] & "\" & $aFiles[1], $aFiles[0] & "\" & $aFiles[2], 2)
    1 point
  17. So my secret guess was wrong on this 1st point I thought that maybe, while scripting it, you'd allow a 1D array to be used too, containing only the filenames, something like this in example 8 alt : ;~ Global $aFrames[UBound($aFiles) - 2][2] ;~ For $i = 2 To UBound($aFiles) - 1 ;~ $aFrames[$i - 2][0] = $aFiles[1] & "\" & $aFiles[$i] ;~ $aFrames[$i - 2][1] = $iGDelay + $i * 2 ;~ Next Global $aFrames[UBound($aFiles) - 2] For $i = 2 To UBound($aFiles) - 1 $aFrames[$i - 2] = $aFiles[1] & "\" & $aFiles[$i] Next Of course it requires to alter/duplicate a couple of lines in Func WebP_CreateWebPCreateAnim, to take care of the possibility that the array may be 1D In this case, your original line shows it power again, accepting that the array is 1D or 2D : $tArrayFramesDelay.delay($i + 1) = UBound($aFilenames, 2) ? ($aFilenames[$i][1] > 0 ? $aFilenames[$i][1] : $iDefaultDelay) : $iDefaultDelay Just for fun, I tested this yesterday (1D array in example 8 and in Func WebP_CreateWebPCreateAnim), everything worked nicely and the default delay of 75ms between frames was applied. I wanted to see if delays are properly added to the animation. There no other reason to slow down the frames. 🙂 Yesss, my secret guess was right on this second point For the record, here is how an old version of Animation Shop (bundled with PaintShop Pro) handles the delays while creating an animated gif : We just indicated a global delay applied between all frames (10/100th seconds in the pic, that's 100ms) . This correspond to your $iDefaultDelay = 75 in the function. When the animation is done, there's a possibility to alter one/several/all delays : for example I changed the delay of frame 2 to 150ms in the pic above (see "Frame;2 Delay:15") . Applied to your function, this corresponds to the delays the user may indicate in the 2D array (last column) So that's a good reason for using a 2D array. You can alter some important delays when needed. Try to do it with a 1D array ! Thanks for all your work and have a great evening
    1 point
  18. I will send you the code later in the evening for the GUI that I am working on so that you can see the code and also play with the functionality. This will help with context. I just won’t be at my PC for a few hours because it’s too nice outside right now.
    1 point
  19. I load my main combo box from an array of about 15-20 items but it could be more or less depending on user configuration. I also loaded that same array into a menubar during testing. So I could use that same function to load the array into the context menu like you suggested. I will try this tonight and see how it goes.
    1 point
  20. Story time: I love my parents but I needed to move out and I told a woman I loved her, she told me she loved me to. My parents whom I loved used to do my laundry and in her case, it was the same. We divorced because we did not find in each other the love we got from our parents. If we were to share more we would have realized that we were looking for an attendant, ..some one to cook and clean after ourselves 🤪 The more you share, ex: I want this towards solving this, brings about context PS: the story is fictional, mostly
    1 point
  21. You can add the & to a number or Fkey... It all depends on how many items you're thinking of. Since you wanted dividers I thought that maybe with submenus..., don't know. You only said so much.
    1 point
  22. The 2nd example of GUICtrlCreateContextMenu don't look bad. Edit: With the _GUICtrlMenu_* functions you can do a lot. Do look at them if you feel the built in are not enough.
    1 point
  23. 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. 🙂
    1 point
  24. Using Melba23 post here as a guide (Thanks for the enlightenment) I managed to get this far A Autocomplete selector for existing tags #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <WinAPI.au3> #include <GuiListBox.au3> ; Global Variables Global $g_hMainGUI Global $g_idEditInputTags Global $g_idListboxSuggestions Global $g_hListboxSuggestionsHWND Global $g_aAvailableTags Global $g_iCurrentSuggestionIndex = -1 ; Dummy control IDs for accelerators (Listbox Navigation Key) Global $g_idAccelUp, $g_idAccelDown, $g_idAccelEnter, $g_idAccelEscape ; Load all unique tags from database $g_aAvailableTags = _GetAllUniqueTags() If @error Then MsgBox(16, "Error", "Failed to load unique tags from database.") _CreateGUI() ; Create Main GUI Exit ;--------------------------------------------------------------------------------------- Func _GetAllUniqueTags() ; This function should retrieve your actual unique tags from a database or file. ; For demonstration, it reads words from a text file. Local $sString = StringLower(FileRead("C:\Program Files (x86)\AutoIt3\SciTE\SciTE Jump\License.txt")) ; matches sequences of letters that are at least 4 characters long Local $aWords = StringRegExp($sString, '[a-zA-Z]{4,}', 3) $aWords = _ArrayUnique($aWords) ; This removes the count element from the array returned by StringRegExp with flag 3. If UBound($aWords) > 0 Then _ArrayDelete($aWords, 0) _ArraySort($aWords) Return $aWords EndFunc ;==>_GetAllUniqueTags ;--------------------------------------------------------------------------------------- Func _CreateGUI() $g_hMainGUI = GUICreate("Main GUI", 700, 300) GUICtrlCreateLabel("Title:", 10, 20, 50, 20) Local $idTitle = GUICtrlCreateInput("", 70, 20, 600, 25) GUICtrlCreateLabel("Tags:", 10, 60, 50, 20) $g_idEditInputTags = GUICtrlCreateInput("", 70, 60, 600, 25, $ES_AUTOVSCROLL) GUICtrlSetLimit($g_idEditInputTags, 250) Local $aPos = ControlGetPos($g_hMainGUI, "", $g_idEditInputTags) If @error Then Exit MsgBox(16, "Error", "Failed to get position of Tags input control. Exiting.") ; Suggestions Listbox $g_idListboxSuggestions = GUICtrlCreateList("", $aPos[0], $aPos[1] + $aPos[3], $aPos[2], 150, BitOR($LBS_NOTIFY, $WS_VSCROLL, $WS_BORDER, $WS_TABSTOP)) GUICtrlSetState($g_idListboxSuggestions, $GUI_HIDE) $g_hListboxSuggestionsHWND = GUICtrlGetHandle($g_idListboxSuggestions) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND_Handler") GUIRegisterMsg($WM_MOUSEWHEEL, "_WM_MOUSEWHEEL_Handler") $g_idAccelUp = GUICtrlCreateDummy() $g_idAccelDown = GUICtrlCreateDummy() $g_idAccelEnter = GUICtrlCreateDummy() $g_idAccelEscape = GUICtrlCreateDummy() Local $AccelKeys[4][2] = [ _ ["{UP}", $g_idAccelUp], _ ["{DOWN}", $g_idAccelDown], _ ["{ENTER}", $g_idAccelEnter], _ ["{ESCAPE}", $g_idAccelEscape] _ ] GUISetAccelerators($AccelKeys) Local $idExit = GUICtrlCreateButton("Exit", 300, 250, 100, 30) GUISetState(@SW_SHOW) Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE, $idExit ExitLoop Case $g_idAccelUp _ListboxNavigationKey($g_idAccelUp) Case $g_idAccelDown _ListboxNavigationKey($g_idAccelDown) Case $g_idAccelEnter _ListboxNavigationKey($g_idAccelEnter) Case $g_idAccelEscape _ListboxNavigationKey($g_idAccelEscape) EndSwitch WEnd GUIDelete($g_hMainGUI) EndFunc ;==>_CreateGUI ;--------------------------------------------------------------------------------------- Func _ApplySelectedTag($sSelectedTag) If $sSelectedTag = "" Then Return Local $sCurrentTags = GUICtrlRead($g_idEditInputTags) If @error Then Return Local $iLastCommaPos = StringInStr($sCurrentTags, ",", 0, -1) ; Find the last comma Local $sPrefixToKeep = "" If $iLastCommaPos > 0 Then $sPrefixToKeep = StringLeft($sCurrentTags, $iLastCommaPos) $sPrefixToKeep = StringStripWS($sPrefixToKeep, $STR_STRIPTRAILING) & " " EndIf Local $sNewTags = $sPrefixToKeep & $sSelectedTag & ", " GUICtrlSetData($g_idEditInputTags, $sNewTags) If @error Then Return _HideSuggestions() GUICtrlSetState($g_idEditInputTags, $GUI_FOCUS) If @error Then Return _WinAPI_PostMessage(GUICtrlGetHandle($g_idEditInputTags), $EM_SETSEL, StringLen($sNewTags), StringLen($sNewTags)) $g_iCurrentSuggestionIndex = -1 EndFunc ;==>_ApplySelectedTag ;--------------------------------------------------------------------------------------- Func _ShowSuggestions($sCurrentInput) Local $sTrimmedInput = StringStripWS($sCurrentInput, $STR_STRIPLEADING + $STR_STRIPTRAILING) If $sTrimmedInput = "" Then Return _HideSuggestions() Local $aInputParts = StringSplit($sTrimmedInput, ",", $STR_NOCOUNT) Local $sLastPart = "" If UBound($aInputParts) > 0 Then $sLastPart = StringStripWS($aInputParts[UBound($aInputParts) - 1], $STR_STRIPLEADING + $STR_STRIPTRAILING) Else $sLastPart = $sTrimmedInput EndIf If $sLastPart = "" Then Return _HideSuggestions() Local $aFilteredSuggestions[0] Local $iCount = 0 Local $iLenLastPart = StringLen($sLastPart) For $sTag In $g_aAvailableTags If $sTag <> "" And StringLen($sTag) >= $iLenLastPart And StringLeft($sTag, $iLenLastPart) = $sLastPart Then _ArrayAdd($aFilteredSuggestions, $sTag) $iCount += 1 EndIf Next If $iCount > 0 Then GUICtrlSendMsg($g_idListboxSuggestions, $LB_RESETCONTENT, 0, 0) For $sSuggestion In $aFilteredSuggestions If $sSuggestion <> "" Then GUICtrlSendMsg($g_idListboxSuggestions, $LB_ADDSTRING, 0, $sSuggestion) EndIf Next GUICtrlSetState($g_idListboxSuggestions, $GUI_SHOW) GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETCURSEL, 0, 0) GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETTOPINDEX, 0, 0) $g_iCurrentSuggestionIndex = 0 Else _HideSuggestions() EndIf EndFunc ;==>_ShowSuggestions ;--------------------------------------------------------------------------------------- Func _HideSuggestions() GUICtrlSetState($g_idListboxSuggestions, $GUI_HIDE) GUICtrlSendMsg($g_idListboxSuggestions, $LB_RESETCONTENT, 0, 0) $g_iCurrentSuggestionIndex = -1 EndFunc ;==>_HideSuggestions ;--------------------------------------------------------------------------------------- Func _ListboxNavigationKey($idKey) If Not BitAND(GUICtrlGetState($g_idListboxSuggestions), $GUI_SHOW) Then Return Local $iCount = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCOUNT, 0, 0) If $iCount = 0 Then Return Switch $idKey Case $g_idAccelUp If $g_iCurrentSuggestionIndex <= 0 Then $g_iCurrentSuggestionIndex = $iCount - 1 Else $g_iCurrentSuggestionIndex -= 1 EndIf GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETCURSEL, $g_iCurrentSuggestionIndex, 0) GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETTOPINDEX, $g_iCurrentSuggestionIndex, 0) Case $g_idAccelDown If $g_iCurrentSuggestionIndex >= $iCount - 1 Then $g_iCurrentSuggestionIndex = 0 Else $g_iCurrentSuggestionIndex += 1 EndIf GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETCURSEL, $g_iCurrentSuggestionIndex, 0) GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETTOPINDEX, $g_iCurrentSuggestionIndex, 0) Case $g_idAccelEnter Local $iIndex = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCURSEL, 0, 0) If $iIndex <> $LB_ERR Then Local $sSelectedTag = _GUICtrlListBox_GetText($g_idListboxSuggestions, $iIndex) If $sSelectedTag <> "" Then _ApplySelectedTag($sSelectedTag) EndIf Else _HideSuggestions() EndIf $g_iCurrentSuggestionIndex = -1 Case $g_idAccelEscape _HideSuggestions() $g_iCurrentSuggestionIndex = -1 EndSwitch EndFunc ;==>_ListboxNavigationKey ;--------------------------------------------------------------------------------------- Func _WM_COMMAND_Handler($hWnd, $iMsg, $wParam, $lParam) Local $iControlID = _WinAPI_LoWord($wParam) Local $iNotificationCode = _WinAPI_HiWord($wParam) Switch $iMsg Case $WM_COMMAND Switch $iControlID Case $g_idEditInputTags Switch $iNotificationCode Case $EN_CHANGE Local $sCurrentInput = GUICtrlRead($g_idEditInputTags) _ShowSuggestions($sCurrentInput) Case $EN_KILLFOCUS Sleep(50) Local $hFocusedWindow = _WinAPI_GetFocus() Local $hListboxSuggestionsHandle = GUICtrlGetHandle($g_idListboxSuggestions) Local $hEditInputTagsHandle = GUICtrlGetHandle($g_idEditInputTags) If $hFocusedWindow <> $hListboxSuggestionsHandle And $hFocusedWindow <> $hEditInputTagsHandle Then _HideSuggestions() Local $sCurrentTags = GUICtrlRead($g_idEditInputTags) If StringRight($sCurrentTags, 2) = ", " Then GUICtrlSetData($g_idEditInputTags, StringTrimRight($sCurrentTags, 2)) ElseIf StringRight($sCurrentTags, 1) = "," Then GUICtrlSetData($g_idEditInputTags, StringTrimRight($sCurrentTags, 1)) EndIf EndIf EndSwitch Case $g_idListboxSuggestions Switch $iNotificationCode Case $LBN_SELCHANGE Local $iIndex = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCURSEL, 0, 0) If $iIndex <> $LB_ERR Then Local $sSelectedTag = _GUICtrlListBox_GetText($g_idListboxSuggestions, $iIndex) If $sSelectedTag <> "" Then _ApplySelectedTag($sSelectedTag) EndIf EndIf Case $LBN_DBLCLK Local $iIndex = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCURSEL, 0, 0) If $iIndex <> $LB_ERR Then Local $sSelectedTag = _GUICtrlListBox_GetText($g_idListboxSuggestions, $iIndex) If $sSelectedTag <> "" Then _ApplySelectedTag($sSelectedTag) EndIf EndIf EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND_Handler ;--------------------------------------------------------------------------------------- Func _WM_MOUSEWHEEL_Handler($hWnd, $iMsg, $wParam, $lParam) ; Using GUIGetCursorInfo to find the control under the mouse Local $aCursorInfo = GUIGetCursorInfo($g_hMainGUI) ; Check if the mouse is over the suggestions ListBox and if the ListBox is visible If Not @error And IsArray($aCursorInfo) And UBound($aCursorInfo) >= 5 And $aCursorInfo[4] = $g_idListboxSuggestions And BitAND(GUICtrlGetState($g_idListboxSuggestions), $GUI_SHOW) Then Local $iDelta = _WinAPI_HiWord($wParam) ; How much the wheel turned (120 for a "click" up, -120 for a "click" down) Local $iNumLinesToScroll = 1 ; We scroll one line at a time with the wheel Local $iCurrentSelection = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCURSEL, 0, 0) Local $iTotalItems = GUICtrlSendMsg($g_idListboxSuggestions, $LB_GETCOUNT, 0, 0) If $iTotalItems <= 0 Then Return 1 ; No items, nothing to scroll or select If $iDelta > 0 Then ; Scroll Up (wheel up) If $iCurrentSelection > 0 Then $g_iCurrentSuggestionIndex = $iCurrentSelection - $iNumLinesToScroll If $g_iCurrentSuggestionIndex < 0 Then $g_iCurrentSuggestionIndex = 0 Else $g_iCurrentSuggestionIndex = 0 ; Already at the top EndIf Else ; Scroll Down (wheel down) If $iCurrentSelection < $iTotalItems - 1 Then $g_iCurrentSuggestionIndex = $iCurrentSelection + $iNumLinesToScroll If $g_iCurrentSuggestionIndex >= $iTotalItems Then $g_iCurrentSuggestionIndex = $iTotalItems - 1 Else $g_iCurrentSuggestionIndex = $iTotalItems - 1 ; Already at the bottom EndIf EndIf ; We define the new option GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETCURSEL, $g_iCurrentSuggestionIndex, 0) ; Also, make the selected element visible (if it isn't already) GUICtrlSendMsg($g_idListboxSuggestions, $LB_SETTOPINDEX, $g_iCurrentSuggestionIndex, 0) Return 1 ; Message has been handled EndIf Return $GUI_RUNDEFMSG ; Let AutoIt handle the message for other controls EndFunc ;==>_WM_MOUSEWHEEL_Handler Please, every comment is appreciated! leave your comments and experiences here! Thank you very much
    1 point
  25. <delete> oops I just saw, IronFine had the same approach above
    1 point
  26. ..there are the .nim files for you to read and compile the .dll yourself @mutleey. Other than that who knows what's real and what is an illusion.
    1 point
  27. @UEZ hello. I got 2 questions if you don't mind : 1) Func WebP_CreateWebPCreateAnim As $aFilenames must be 2D, could the following line in the function use a simpler syntax ? ; $tArrayFramesDelay.delay($i + 1) = UBound($aFilenames, 2) ? ($aFilenames[$i][1] > 0 ? $aFilenames[$i][1] : $iDefaultDelay) : $iDefaultDelay $tArrayFramesDelay.delay($i + 1) = $aFilenames[$i][1] > 0 ? $aFilenames[$i][1] : $iDefaultDelay 2) Concerning this line in example 8 : $aFrames[$i - 2][1] = $iGDelay + $i * 2 Could you please explain the need of "$i * 2" which will slowly increase the delay between each frame ? For example, using the 10 "crow" pics to create a WebP animation, here are the delays in the structure : 64 ms after frame 1 (60 + 2*2) 82 ms after frame 10 (60 + 11*2) If not mistaken, when an animation got 50 frames, it would add 100ms during the last frames, 200ms if 100 frames etc... Thanks
    1 point
  28. Yes, I just looked at webdriver, new to me and not keen, at least this week. You have given me confirmation 'ping' is not working and another option to explore. Many thanks for that. I will post further as time allows.
    1 point
  29. hmm, maybe Send a Ctrl+A ( to select all text ), then Ctrl+C ( to copy the selected text ) and if "allow for www.bridgewebs.com. If you do not" is in the text, it could be said that the page loaded. Otherwise you'd have to learn how to work with a webdriver.
    1 point
  30. You have something like this in mind? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiImageList.au3> Global $mainGUI = GUICreate("Custom Dropdown ListView", 300, 150) Global $btnSelect = GUICtrlCreateButton("Select option", 50, 40, 200, 30) Global $lblSelected = GUICtrlCreateLabel("Selected: None", 50, 90, 200, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $btnSelect ShowCustomDropdown() EndSwitch WEnd Func ShowCustomDropdown() Local $childGUI = GUICreate("", 220, 150, WinGetPos($mainGUI)[0] + 50, WinGetPos($mainGUI)[1] + 70, _ $WS_POPUP, $WS_EX_TOOLWINDOW, $mainGUI) Local $dummyBegin = GUICtrlCreateDummy() Local $lv = GUICtrlCreateListView("Option 0", 0, 0, 220, 150, BitOR($LVS_REPORT, $LVS_SINGLESEL)) GUICtrlSendMsg($lv, $LVM_SETCOLUMNWIDTH, 0, 200) Local $items[6] = ["Option 1", "Option 2", "---", "Option 3", "---", "Option 4"] For $i = 0 To UBound($items) - 1 Local $itemID = GUICtrlCreateListViewItem($items[$i], $lv) If $items[$i] = "---" Then GUICtrlSetColor($itemID, 0x888888) GUICtrlSetBkColor($itemID, 0xF0F0F0) EndIf Next Local $dummyEnd = GUICtrlCreateDummy() GUISetState(@SW_SHOW, $childGUI) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE GUIDelete($childGUI) ExitLoop Case $dummyBegin To $dummyEnd If GUICtrlRead($msg) <> "---" Then GUICtrlSetData($lblSelected, "Selected: " & GUICtrlRead($msg)) GUIDelete($childGUI) ExitLoop EndIf EndSwitch WEnd EndFunc ;==>ShowCustomDropdown
    1 point
  31. Without subclassing the control you only try to revert to the old entry, when the user selects it: #include <GUIConstantsEx.au3> $hGUI = GUICreate("ComboBox with Fake Separator", 300, 200) $hCombo = GUICtrlCreateCombo("", 50, 50, 200) GUICtrlSetData($hCombo, "Option 1|Option 2|----------|Option 3|Option 4") GUISetState() Local $prevSelection = "Option 1" GUICtrlSetData($hCombo, $prevSelection) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case Else Local $sel = GUICtrlRead($hCombo) If $sel = "----------" Then GUICtrlSetData($hCombo, $prevSelection) Else $prevSelection = $sel EndIf EndSwitch WEnd
    1 point
  32. Upsa, that was not about the flicker at all 🙂. For that I learned that input controls do not flicker as labels do, maybe the update of these is slower? #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}","_Exit") GUICreate("Example") $c_Label = GUICtrlCreateLabel("",10,10,100,20) $c_Input = GUICtrlCreateInput("",10,40,100,20, $ES_READONLY, $WS_EX_TRANSPARENT) GUISetState(@SW_SHOW) While Sleep(10) $iTimer = TimerInit() GUICtrlSetData($c_Label,$iTimer) GUICtrlSetData($c_Input,$iTimer) WEnd Func _Exit() Exit EndFunc
    1 point
  33. Try this one: Func IsValidCredential($sUsername, $sPassword, $sDomain) Local $LOGON32_LOGON_NETWORK = 3 Local $LOGON32_PROVIDER_DEFAULT = 0 Local $aRet = DllCall("advapi32.dll", "bool", "LogonUserW", _ "wstr", $sUsername, _ "wstr", $sDomain, _ "wstr", $sPassword, _ "dword", $LOGON32_LOGON_NETWORK, _ "dword", $LOGON32_PROVIDER_DEFAULT, _ "ptr*", 0) If @error Then ConsoleWrite("DLL call error: " & @error & @CRLF) Return False EndIf If $aRet[0] Then ; Optional: close handle DllCall("kernel32.dll", "bool", "CloseHandle", "ptr", $aRet[6]) Return True Else Return False EndIf EndFunc $user=InputBox("username","username") $dom=InputBox("domain","domain") $pwd=InputBox("password","password","","*") If IsValidCredential($user, $pwd, $dom) Then MsgBox(64, "OK", "credentials accepted") Else MsgBox(16, "Failure", "credentials rejected") EndIf
    1 point
  34. You're welcome, it's the least we can do for you Just curious : example 8 creates a WebP animation from 4 possible types of image files : "images (*.jpg;*.png;*.bmp;*.gif)" Do you think it would be possible to add this 5th type of image file, if not too complicated ? "images (*.jpg;*.png;*.bmp;*.gif;*.webp)" Thanks
    1 point
  35. Hello everyone, I'm pleased to share a UDF I developed to work with IWICImagingFactory from the Windows Imaging Component (WIC), focused exclusively on reading and writing image metadata. 🔍 Why this UDF? IWICImagingFactory is a powerful API but can also be particularly confusing when working with metadata. Its layers of abstraction, data formats, and interface complexity can easily distract you from your goals without a clear structure. 🧩 Key Features: 🔄 Read and write metadata using WIC interfaces (IWICMetadataQueryReader, IWICMetadataQueryWriter) 💾 Supports common formats (JPEG, PNG, TIFF, etc.) 🧠 Built using an object-oriented model via AutoItObject to encapsulate complexity and avoid side effects ⚠️ Full support for PROPVARIANT and VARIANT types, essential for COM interaction 🔗 Handles the WIC metadata query language (e.g., /app1/ifd/exif:{ushort=36867} for Date Taken) 📜 Works with WIC-compliant hierarchical metadata queries 🧠 Prerequisites / Recommended Knowledge Solid understanding of COM programming in AutoIt Familiarity with PROPVARIANT/VARIANT (types, conversion, init/cleanup) Knowledge of WIC metadata schema and hierarchy Comfortable with object-oriented programming in AutoIt (using AutoItObject) 🧪 Why use an object-oriented approach? IWICImagingFactory is as flexible as it is tricky. Exploring it directly can lead to unexpected behaviors or technical detours. The object-oriented approach helps contain this complexity, structure features properly, and avoid common pitfalls when dealing with raw COM interfaces. 📁 What’s Included in the UDF A main object WICImageMeta (or similar) that encapsulates the image, reader/writer, and associated interfaces Straightforward methods like .ReadMeta($sPath), .WriteMeta($sPath, $vValue, $sType), .Save($sDest), etc. Automatic resource management (Release, Cleanup) Examples for reading/writing EXIF, XMP, and other metadata 📷 Quick Usage Example #include <MsgBoxConstants.au3> #include <WinAPI.au3> #include <Array.au3> #include "IWICImagingMetadata.au3" ; This is your custom UDF for WIC metadata ; Path to a test image (replace with your own file path) Local $sFilename = @DesktopDir & "\screenshot.png" ; === 1. Create the WIC Imaging Factory === ; This is the entry point for all WIC operations Local $oFactory = _WIC_ImagingFactory() If Not IsObj($oFactory) Then MsgBox(0, "Error", "Failed to create WIC Imaging Factory") Exit EndIf ; === 2. Create a decoder from the image file === ; This will analyze the image format and prepare for frame extraction Local $oDecoder = $oFactory.createDecoderFromFileName($sFilename) If Not IsObj($oDecoder) Then MsgBox(0, "Error", "Failed to create image decoder: @error=" & @error) $oFactory = 0 Exit EndIf ; === 3. Get the first frame of the image === ; Most still images have a single frame; this retrieves it from the decoder Local $oFrame = $oFactory.createBitmapFrameDecode($oDecoder) If Not IsObj($oFrame) Then MsgBox($MB_ICONERROR, "Error", "Failed to retrieve image frame: @error=" & @error) $oDecoder = 0 $oFactory = 0 Exit EndIf ; === 4. Get a metadata query reader from the frame === ; This reader allows you to query metadata values using WIC metadata paths Local $oQueryReader = $oFactory.getMetadataQueryReader($oFrame) If Not IsObj($oQueryReader) Then MsgBox(0, "Error", "Failed to get metadata query reader: @error=" & @error) $oFrame = 0 $oDecoder = 0 $oFactory = 0 Exit EndIf ; === 5. Enumerate available metadata names === ; This step is crucial to explore what metadata is actually present. ; It returns an array of metadata query paths that can be used. Local $aNames = $oFactory.enumerateMetaDataNames($oQueryReader) If @error Then ConsoleWrite("Error: Failed to enumerate metadata names: @error=" & @error & @CRLF) Else ConsoleWrite("Available metadata names: " & _ArrayToString($aNames, "|") & @CRLF) EndIf ; === 6. Read a specific metadata value === ; In this case, we're trying to read a textual field: "Creation Time" in a PNG tEXt chunk Local $sQuery = "/tEXt/{str=Creation Time}" Local $vData = $oFactory.queryMetadataByName($oQueryReader, $sQuery) If Not @error Then ConsoleWrite("Metadata read: " & $sQuery & " = " & $vData & @CRLF) Else ConsoleWrite("Error: Failed to read " & $sQuery & " : @error=" & @error & @CRLF) EndIf ; === NOTE === ; If your query selects a metadata **block**, then `vData` may be another IWICMetadataQueryReader object. ; In that case, you must call `queryMetadataByName` again, passing this sub-reader to reach nested values. 💬 Conclusion If you've worked with image metadata using WIC before, you know it's a technical challenge. This UDF aims to simplify the process while preserving full control for those who need fine-grained access. Feel free to try it out, give feedback, or suggest improvements. Enjoy digging into the hidden data of your images! 📸 IWICImagingMetadata.au3
    1 point
  36. Hi Jos, a feature request for SciTE from my side. When I run code in SciTE, all entries under "Tools" except the last 5 are greyed out. Would it be possible to leave those enabled, which do not interfere with the current code execution? Especially for running "AU3Info" I don't know how many times I had to abort the current execution, start AU3Info and then run the code again 🙂, because I forgot to start AU3Info early. Maybe it makes sense to leave some others enabled too, e.g. Open Explorer in Scriptdir, Codewizard and Koda? Best Regards
    1 point
  37. Yes it is working. The 10s output file "Captured.webp" displays in the GUI, then loops until we close the GUI. It displays same in IrfanView.
    1 point
  38. Hello @UEZ Just downloaded all your files (including the Frames subfolder containing 10 png files to create the animation). Somes files were updated 3 hours ago, lucky me to download the brand new release just now Example 8 worked fine and the created animation "TestAnim.webp" displayed without any issue. Well done
    1 point
  39. Here you should find one way how to embed your font (Display Font from Memory):
    1 point
  40. WildByDesign

    DwmColorBlurMica

    Microsoft insists that the false positive is removed from the compiled binary and is no longer detected by Windows Defender. VirusTotal shows it. But apparently Windows Defender itself does not detect it and we're good to go. First post has been updated with version 1.0.3. This version is mostly a bug-fix release with a fix for Windows Terminal losing border color after being minimized. And a regression where border colors, if not set in custom rules, were not properly falling back to the global set value. That was a weird bug that took me forever to understand how/why it was happening but finally fixed it. I also made some changes that made the overall performance even better. Several functions were made to be more efficient. Less loops. I also made a special function Func _ColorBorderOnly($hWnd, $sClassName, $sName) to handle the border coloring in the Foreground Case only. Prior to that, the border stuff was going through the main coloring function and therefore a lot of extra stuff that was not necessary in the Foreground Case. So this also made things much more efficient.
    1 point
  41. I haven't touched AutoIt in over a year, so I'm a bit rusty. Here is an attempt to incorporate the Get/Set property into @trancexx ObjectFromTag code, similar to the AutoItObject UDF. Example 1: #include "ObjFromTag_v1a UDF.au3" Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") __Example1() Func __Example1() ConsoleWrite("> __Example4() " & @CRLF) Local $t_TestObj Local $o_TestObj = __ObjectFromTag("__MyInterface_", '', $t_TestObj, 'int Ln;char Msg[30];') __SetProperty($o_TestObj, "Ln", 555) __SetProperty($o_TestObj, "Msg", 'Is it working.') ConsoleWrite("+>>> Ln : " & __GetProperty($o_TestObj, "Ln") & @CRLF) ConsoleWrite("+>>> Msg : " & __GetProperty($o_TestObj, "Msg") & @CRLF) If IsObj($o_TestObj) Then $o_TestObj = 0 __DeleteObjectFromTag($t_TestObj) ConsoleWrite("----The End----" & @CRLF) EndFunc Func __MyInterface_QueryInterface($pSelf, $pRIID, $pObj) Return __QueryInterface($pSelf, $pRIID, $pObj) EndFunc Func __MyInterface_AddRef($pSelf) Return __AddRef($pSelf) EndFunc Func __MyInterface_Release($pSelf) Return __Release($pSelf) EndFunc Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc Example 2: #include "ObjFromTag_v1a UDF.au3" Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") __Example2() Func __Example2() ConsoleWrite("> __Example2() " & @CRLF) Local $t_TestObj Local $o_TestObj = __ObjectFromTag("__MyInterface_", 'Open hresult();Close hresult();', $t_TestObj, 'handle WinHnd;', False) If Not IsObj($o_TestObj) Then Return $o_TestObj.Open() MsgBox(0, '', 'Clicked to closed Notepad....') $o_TestObj.Close() If IsObj($o_TestObj) Then $o_TestObj = 0 __DeleteObjectFromTag($t_TestObj) EndFunc Func __MyInterface_Open($pSelf) Run("notepad.exe") WinWait("[CLASS:Notepad]", "", 10) Local $hWnd = WinGetHandle("[CLASS:Notepad]") __SetProperty($pSelf, "WinHnd", $hWnd) Return 0 EndFunc Func __MyInterface_Close($pSelf) WinClose(__GetProperty($pSelf, "WinHnd")) Return 0 EndFunc Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc Example 3: #include "ObjFromTag_v1a UDF.au3" Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") __Example3() Func __Example3() ConsoleWrite("> __Example3() " & @CRLF) Local $t_TestObj Local $o_TestObj = __ObjectFromTag("__MyInterface_", 'MsgBox hresult();', $t_TestObj, 'char Title[10];char Text[30];int Flag;', False) If Not IsObj($o_TestObj) Then Return __SetProperty($o_TestObj, "Title", "Something") __SetProperty($o_TestObj, "Text", 'Is it working.') __SetProperty($o_TestObj, "Flag", 64 + 262144) $o_TestObj.MsgBox() If IsObj($o_TestObj) Then $o_TestObj = 0 __DeleteObjectFromTag($t_TestObj) ConsoleWrite("----The End----" & @CRLF) EndFunc Func __MyInterface_MsgBox($pSelf) MsgBox(__GetProperty($pSelf, "Flag"), __GetProperty($pSelf, "Title"), __GetProperty($pSelf, "Text")) EndFunc Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc Example 4: #include "ObjFromTag_v1a UDF.au3" Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") __Example3() Func __Example3() ConsoleWrite("> __Example3() " & @CRLF) Local $t_TestObj Local $o_TestObj = __ObjectFromTag("", 'DisplayBook str();', $t_TestObj, 'char book[50];char author[15];int year;', False) If Not IsObj($o_TestObj) Then Return __SetProperty($o_TestObj, "book", "Harry Potter and the Sorcerer's Stone") __SetProperty($o_TestObj, "author", 'J. K. Rowling') __SetProperty($o_TestObj, "year", 1997) MsgBox(0, 'Book', $o_TestObj.DisplayBook) If IsObj($o_TestObj) Then $o_TestObj = 0 __DeleteObjectFromTag($t_TestObj) ConsoleWrite("----The End----" & @CRLF) EndFunc Func DisplayBook($pSelf) Local $sString = 'The novel ' & __GetProperty($pSelf, "book") & ' ,' & _ ' written by author ' & __GetProperty($pSelf, "author") & _ ' and published in ' & __GetProperty($pSelf, "year") & '.' Local Static $tString = DllStructCreate(StringFormat("char str[%d]", StringLen($sString) + 1)) ;+1 to null terminate! $tString.str = $sString Return DllStructGetPtr($tString) EndFunc Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc Example 5: #include "ObjFromTag_v1a UDF.au3" Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") __Example3() Func __Example3() ConsoleWrite("> __Example3() " & @CRLF) Local $t_BookObj, $t_AuthorObj Local $o_BookObj = __ObjectFromTag("", 'BookList hresult(bstr;bstr);', $t_BookObj, 'char book[50];int year;', False) Local $o_AuthorObj = __ObjectFromTag("", 'DisplayBook str(bstr);', $t_AuthorObj, 'char author[15];ptr oBook;', False) __SetProperty($o_AuthorObj, "oBook", $o_BookObj()) $o_BookObj.BookList("Harry Potter and the Sorcerer's Stone", 1997) MsgBox(0, 'Book', $o_AuthorObj.DisplayBook('J. K. Rowling')) If IsObj($o_AuthorObj) Then $o_AuthorObj = 0 If IsObj($o_BookObj) Then $o_BookObj = 0 __DeleteObjectFromTag($t_AuthorObj) __DeleteObjectFromTag($t_BookObj) ConsoleWrite("----The End----" & @CRLF) EndFunc Func BookList($pSelf, $pStrA, $pStrB) __SetProperty($pSelf, "book", __Bstr_ToString($pStrA)) __SetProperty($pSelf, "year", __Bstr_ToString($pStrB)) EndFunc Func DisplayBook($pSelf, $pStrA) __SetProperty($pSelf, "author", __Bstr_ToString($pStrA)) Local $pBookList = __GetProperty($pSelf, "oBook") Local $sString = 'The novel ' & __GetProperty($pBookList, "book") & ' ,' & _ ' written by author ' & __GetProperty($pSelf, "author") & _ ' and published in ' & __GetProperty($pBookList, "year") & '.' Local Static $tString = DllStructCreate(StringFormat("char str[%d]", StringLen($sString) + 1)) ;+1 to null terminate! $tString.str = $sString Return DllStructGetPtr($tString) EndFunc Func __Bstr_ToString($pString) Local $o_Data = DllStructGetData(DllStructCreate("wchar[" & _ DllStructGetData(DllStructCreate("dword", $pString - 4), 1) / 2 & "]", $pString), 1) Return $o_Data EndFunc Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc for more about objectfromtag you can follow this thread created by @LarsJ https://www.autoitscript.com/forum/topic/205154-using-objcreateinterface-and-objectfromtag-functions/ and do check out code posted by @trancexx @ProgAndy @monoceres @wolf9228 @LarsJ @Danyfirex and @Bilgus. on this topic. Note: You can also register this object, created using __ObjectFromTag, within the Running Object Table (ROT). ObjFromTag_v1c.au3
    1 point
  42. Credit goes to @Numeric1 for his Ping Pong game using AutoItObject. @Gianni also converted the Ping Pong game using AutoItObject_Internal, coded by @genius257 Here’s my attempt using __ObjectFromTag. #include-once #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> #include "ObjFromTag_v1c.au3" Global $g__flag = False Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") _GDIPlus_Startup() Const $COLOR_RED = 0xFFFF0000 Const $COLOR_GREEN = 0xFF00FF00 GamePanel() Func GamePanel() Local $hGUI = GUICreate("Ping Pong", 400, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) GUISetBkColor(0x000000) GUISetState() Local $aClient = WinGetClientSize($hGUI) If @error Then Return SetError(1, 0, 0) Local $iWidth = $aClient[0] Local $iHeight = $aClient[1] Local $t_GamePanel Local $GamePanel_Property = 'int iWidth;int iHeight;ptr ball;ptr paddle;ptr map[5];int speedLevel;' Local $GamePanel_Method = 'move hresult();drawStage hresult();cleanUpResources hresult();runGameLoop hresult();' Local $c_GamePanel = __ObjectFromTag('_', $GamePanel_Method, $t_GamePanel, $GamePanel_Property, False) If Not IsObj($c_GamePanel) Then Return Local $t_Ball Local $Ball_Property = 'int dx;int dy;int size;int X;int Y;' Local $Ball_Method = 'move hresult();' Local $c_Ball = __ObjectFromTag('_', $Ball_Method, $t_Ball, $Ball_Property, False) If Not IsObj($c_Ball) Then Return Local $t_Paddle Local $Paddle_Property = 'int X;int size;int dx;' Local $Paddle_Method = 'moveLeft hresult();moveRight hresult(int);' Local $c_Paddle = __ObjectFromTag('_', $Paddle_Method, $t_Paddle, $Paddle_Property, False) If Not IsObj($c_Paddle) Then Return Local $aGDIMap[5] $aGDIMap[0] = _GDIPlus_GraphicsCreateFromHWND($hGUI) $aGDIMap[1] = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $aGDIMap[0]) $aGDIMap[2] = _GDIPlus_ImageGetGraphicsContext($aGDIMap[1]) $aGDIMap[3] = _GDIPlus_BrushCreateSolid($COLOR_RED) $aGDIMap[4] = _GDIPlus_HatchBrushCreate(4, $COLOR_GREEN) Ball($c_Ball, 40, 40) Paddle($c_Paddle, 150, 100) __SetProperty($c_GamePanel, 'iWidth', $iWidth) __SetProperty($c_GamePanel, 'iHeight', $iHeight) __SetProperty($c_GamePanel, 'ball', $c_Ball()) __SetProperty($c_GamePanel, 'paddle', $c_Paddle()) __SetProperty($c_GamePanel, 'speedLevel', 100) __SetProperty($c_GamePanel, "map", $aGDIMap[0], 1) __SetProperty($c_GamePanel, "map", $aGDIMap[1], 2) __SetProperty($c_GamePanel, "map", $aGDIMap[2], 3) __SetProperty($c_GamePanel, "map", $aGDIMap[3], 4) __SetProperty($c_GamePanel, "map", $aGDIMap[4], 5) $c_GamePanel.runGameLoop() $c_GamePanel.cleanUpResources() $c_Paddle = 0 $c_Ball = 0 $c_GamePanel = 0 __DeleteObjectFromTag($t_Paddle) __DeleteObjectFromTag($t_Ball) __DeleteObjectFromTag($t_GamePanel) ConsoleWrite("< The End >" & @CRLF) EndFunc Func Ball(Byref $oSelf, $x = 0, $y = 0, $size = 5) __SetProperty($oSelf, 'dx', 10) __SetProperty($oSelf, 'dy', -10) __SetProperty($oSelf, 'size', $size) __SetProperty($oSelf, 'X', $y) __SetProperty($oSelf, 'Y', $x) EndFunc Func Paddle(Byref $oSelf, $x = 0, $size = 5) __SetProperty($oSelf, 'X', $x) __SetProperty($oSelf, 'size', $size) __SetProperty($oSelf, 'dx', 20) EndFunc Func _moveLeft($this) Local $paddleX = __GetProperty($this, "X") Local $paddledx = __GetProperty($this, "dx") $paddleX -= $paddledx If $paddleX < 0 Then __SetProperty($this, 'X', 0) Else __SetProperty($this, 'X', $paddleX) Endif EndFunc ;==>_moveLeft Func _moveRight($this, $maxX) Local $paddleWidth = __GetProperty($this, "size") Local $paddleX = __GetProperty($this, "X") Local $paddledx = __GetProperty($this, "dx") If $paddleX + $paddledx + $paddleWidth <= $maxX Then $paddleX += $paddledx Else $paddleX = $maxX - $paddledx EndIf __SetProperty($this, 'X', $paddleX) EndFunc ;==>_moveRight Func _move($this) Local $pBall = __GetProperty($this, "ball") Local $pPaddle = __GetProperty($this, "paddle") Local $x = __GetProperty($pBall, "X") Local $y = __GetProperty($pBall, "Y") Local $dx = __GetProperty($pBall, "dx") Local $dy = __GetProperty($pBall, "dy") Local $BallSize = __GetProperty($pBall, "size") Local $Width = __GetProperty($this, "iWidth") Local $Height = __GetProperty($this, "iHeight") If $y + $dy >= ($Height - 40) And $x + $BallSize >= __GetProperty($pPaddle, "X") And $x <= __GetProperty($pPaddle, "X") + __GetProperty($pPaddle, "size") Then $dy *= -1 EndIf If $y + $dy <= 0 Then $dy = Abs($dy) EndIf If $y + $dy >= $Height - $BallSize Then MsgBox(0, "Game Over", "You missed the ball! Game Over!") $g__flag = True Return EndIf If $x + $dx <= 0 Then $dx = Abs($dx) EndIf If $x + $dx >= $Width - $BallSize Then $dx = -Abs($dx) EndIf $x += $dx $y += $dy __SetProperty($pBall, 'dx', $dx) __SetProperty($pBall, 'dy', $dy) __SetProperty($pBall, 'X', $x) __SetProperty($pBall, 'Y', $y) Local $GamePanel_Method = 'move hresult();drawStage hresult();cleanUpResources hresult();runGameLoop hresult();' Local $c__GamePanel = __RestoreObjectFromPtr($this, $GamePanel_Method, False, Default) $c__GamePanel.drawStage() EndFunc ;==>_move Func _drawStage($this) Local $hGraphics = __GetProperty($this, "map", 1) Local $hBitmap = __GetProperty($this, "map", 2) Local $hGraphicsCtxt = __GetProperty($this, "map", 3) Local $hBrush = __GetProperty($this, "map", 4) Local $hHatchBrush = __GetProperty($this, "map", 5) Local $pBall = __GetProperty($this, "ball") Local $pPaddle = __GetProperty($this, "paddle") Local $iX = __GetProperty($pBall, "X") Local $iY = __GetProperty($pBall, "Y") Local $iRadius = __GetProperty($pBall, "size") Local $padX = __GetProperty($pPaddle, "X") Local $padH = __GetProperty($this, "iHeight") - 40 _GDIPlus_GraphicsClear($hGraphicsCtxt, 0xFF000000) _GDIPlus_GraphicsFillEllipse($hGraphicsCtxt, $iX - $iRadius, $iY - $iRadius, $iRadius * 2, $iRadius * 2, $hBrush) _GDIPlus_GraphicsFillRect($hGraphicsCtxt, $padX, $padH, __GetProperty($pPaddle, "size"), 10, $hHatchBrush) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, __GetProperty($this, "iWidth"), __GetProperty($this, "iHeight")) EndFunc ;==>_drawStage Func _cleanUpResources($this) ConsoleWrite("clean up ressources...." & @CRLF) _GDIPlus_GraphicsDispose(__GetProperty($this, "map", 1)) _GDIPlus_BitmapDispose(__GetProperty($this, "map", 2)) _GDIPlus_GraphicsDispose(__GetProperty($this, "map", 3)) _GDIPlus_BrushDispose(__GetProperty($this, "map", 4)) _GDIPlus_Shutdown() EndFunc ;==>_cleanUpResources Func _runGameLoop($this) Local $speedUpTime = 5000 Local $lastMoveTime = TimerInit() Local $maxX = __GetProperty($this, "iWidth") Local $GamePanel_Method = 'move hresult();drawStage hresult();cleanUpResources hresult();runGameLoop hresult();' Local $c__GamePanel = __RestoreObjectFromPtr($this, $GamePanel_Method, False, Default) Local $pPaddle = __GetProperty($this, "paddle") Local $Paddle_Method = 'moveLeft hresult();moveRight hresult(int);' Local $c__Paddle = __RestoreObjectFromPtr($pPaddle, $Paddle_Method, False, Default) While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop If _IsPressed(25) Then $c__Paddle.moveLeft() If _IsPressed(27) Then $c__Paddle.moveRight($maxX) If _IsPressed(53) Then While 1 If _IsPressed(25) Or _IsPressed(27) Then ExitLoop Sleep(100) WEnd EndIf If TimerDiff($lastMoveTime) >= $speedUpTime Then __SetProperty($this, 'speedLevel', __GetProperty($this, "speedLevel") - 5) If __GetProperty($this, "speedLevel") < 0 Then __SetProperty($this, 'speedLevel', 0) $lastMoveTime = TimerInit() EndIf $c__GamePanel.move() If $g__flag Then ExitLoop Sleep(__GetProperty($this, "speedLevel")) WEnd EndFunc ;==>_runGameLoop I also updated the __ObjectFromTag UDF (ver: 1c)
    1 point
  43. Updated to: WebP v0.3.5 build 2025-06-27 beta You can now create WebP animated files. Examples8 encodes GDI+ supported image files to an animation. Example9 captures the desktop screen to an WebP anim file.
    1 point
  44. You can simply try this code: It uses GDI+ to draw a red circle with centered text, creates a 32-bit ARGB icon, and sets it as a taskbar overlay using ITaskbarList3::SetOverlayIcon. It updates the icon every second. You can easily adjust it to fit your own needs. Let me know if it works for you! #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPIIcons.au3> Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " Line: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) EndFunc ; Define ITaskbarList3 COM interface Global Const $sCLSID_TaskbarList = "{56FDF344-FD6D-11D0-958A-006097C9A090}" Global Const $sIID_ITaskbarList3 = "{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}" Global Const $tagITaskbarList3 = _ "HrInit hresult();" & _ "AddTab hresult(hwnd);" & _ "DeleteTab hresult(hwnd);" & _ "ActivateTab hresult(hwnd);" & _ "SetActiveAlt hresult(hwnd);" & _ "MarkFullscreenWindow hresult(hwnd;boolean);" & _ "SetProgressValue hresult(hwnd;uint64;uint64);" & _ "SetProgressState hresult(hwnd;int);" & _ "RegisterTab hresult(hwnd;hwnd);" & _ "UnregisterTab hresult(hwnd);" & _ "SetTabOrder hresult(hwnd;hwnd);" & _ "SetTabActive hresult(hwnd;hwnd;dword);" & _ "ThumbBarAddButtons hresult(hwnd;uint;ptr);" & _ "ThumbBarUpdateButtons hresult(hwnd;uint;ptr);" & _ "ThumbBarSetImageList hresult(hwnd;ptr);" & _ "SetOverlayIcon hresult(hwnd;ptr;wstr);" & _ "SetThumbnailTooltip hresult(hwnd;wstr);" & _ "SetThumbnailClip hresult(hwnd;ptr);" ; Global variables Global $hGraphic, $hTextBrush, $hFormat, $hFamily, $hFont, $hBackgroundBrush, $hPen Global $oList, $hWnd Global $iWidth = 32, $iHeight = 32, $iFontSize = 12 Global $iCounter = 0 Main() Func Main() _GDIPlus_Startup() $hWnd = GUICreate("Taskbar Overlay Icon Test", 400, 300) Local $label = GUICtrlCreateLabel("Starting...", 10, 10, 380, 100) GUISetState() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) $hTextBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize) $hBackgroundBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000) $hPen = _GDIPlus_PenCreate(0xFF000000, 2) $oList = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList3, $tagITaskbarList3) If Not IsObj($oList) Then MsgBox(16, "Error", "Failed to initialize ITaskbarList3.") Exit EndIf $oList.HrInit() If @error Then MsgBox(16, "Error", "HrInit failed: " & @error) Exit EndIf GUICtrlSetData($label, "$oList.AddTab") $oList.AddTab($hWnd) If @error Then MsgBox(16, "Error", "Failed to add taskbar tab: " & @error) Exit EndIf _UpdateOverlayIcon($iCounter) GUICtrlSetData($label, "Overlay icon initialized with counter: " & $iCounter) Local $hTimer = TimerInit() While 1 If TimerDiff($hTimer) > 1000 Then $iCounter += 1 If $iCounter > 99 Then $iCounter = 99 _UpdateOverlayIcon($iCounter) GUICtrlSetData($label, "Counter: " & $iCounter) $hTimer = TimerInit() EndIf If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop Sleep(10) WEnd GUICtrlSetData($label, "Removing overlay icon and tab") _Taskbar_SetOverlayIcon($oList, $hWnd, Null, "") $oList.DeleteTab($hWnd) $oList = 0 _GDIPlus_FontDispose($hFont) _GDIPlus_PenDispose($hPen) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hTextBrush) _GDIPlus_BrushDispose($hBackgroundBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc Func _UpdateOverlayIcon($iCount) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $GDIP_PXF32ARGB) Local $hGraphicBitmap = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGraphicBitmap, 2) _GDIPlus_GraphicsClear($hGraphicBitmap, 0x00000000) _GDIPlus_GraphicsFillEllipse($hGraphicBitmap, 0, 0, $iWidth - 2, $iHeight - 2, $hBackgroundBrush) _GDIPlus_GraphicsDrawEllipse($hGraphicBitmap, 0, 0, $iWidth - 2, $iHeight - 2, $hPen) Local $tLayout = _GDIPlus_RectFCreate(2, 2, $iWidth - 4, $iHeight - 8) DrawStringCentered($hGraphicBitmap, $iCount, $hFont, $tLayout, $hFormat, $hTextBrush) Local $hIcon = _GDIPlus_HICONCreateFromBitmap($hBitmap) If @error Then MsgBox(16, "Error", "Failed to create HICON: " & @error) Exit EndIf _Taskbar_SetOverlayIcon($oList, $hWnd, $hIcon, "Counter: " & $iCount) _WinAPI_DestroyIcon($hIcon) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphicBitmap) EndFunc Func DrawStringCentered($hGraphic, $iIndex, $hFont, $tLayout, $hFormat, $hTextBrush) Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $iIndex, $hFont, $tLayout, $hFormat) Local $tIndex = $aInfo[0] $tIndex.X = $tLayout.X + (($tLayout.Width - $tIndex.Width) / 2) $tIndex.Y = $tLayout.Y + (($tLayout.Height - _GDIPlus_FontGetHeight($hFont, $hGraphic)) / 2) _GDIPlus_GraphicsDrawStringEx($hGraphic, $iIndex, $hFont, $tIndex, $hFormat, $hTextBrush) EndFunc Func _Taskbar_SetOverlayIcon(ByRef $oTB, $hWnd, $hIcon, $sAltText = "") Local $vRet = $oTB.SetOverlayIcon($hWnd, $hIcon, $sAltText) If @error Then Return SetError(@error, @extended, False) If $vRet = 0 Then Return True Return SetError($vRet, 0, False) EndFunc
    1 point
  45. WildByDesign

    DwmColorBlurMica

    I had some users mention that my compiled binary (last bunch of releases) gets labelled as a virus. Out of all of the AVs out there, only 1 is doing this and of course it happens to be Microsoft. They call it "Trojan:Win32/Sabsik.FL.A!ml" in client version of Defender and "Trojan:Win32/Wacatac.B!ml" with their cloud AV on VirusTotal. I have submitted it to Microsoft as a false positive in hopes that it gets analyzed and removed sometime in the future but I am not holding my breath. From my security industry work, I know that the main reason why they do this is to encourage developers to purchase expensive code signing certificates. I don't know if this detection is AutoIt-related or not. Some of my other projects are getting flagged as well. Does anybody have any experience with this? EDIT: I am reading through the 15 page ( ) thread now but I don't know how much of that is current information or outdated.
    1 point
  46. New version available.
    1 point
  47. Nine

    Windows Debug Messages?

    I got it working (I think). Tested, both x86 and x64, it gives same results. I haven't put any error handling, as I wanted to see if it would work solely in AutoIt. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <StructureConstants.au3> #include <WinAPIProc.au3> #include <Array.au3> #include <WinAPIFiles.au3> #include <APIErrorsConstants.au3> Global Const $SECURITY_DESCRIPTOR_REVISION = 1 Global $hEventBufferReady, $hEventDataReady, $hBuffer, $pDebugInfo, $bEnd HotKeySet("{ESC}", Terminate) Example() Func Example() Local $iPID, $sOutput StartDebugCapture() Do $sOutput = GetDebugOutput() If $sOutput Then $iPID = @extended ConsoleWrite($iPID & @CRLF & $sOutput & @CRLF) EndIf Sleep(100) Until $bEnd StopDebugCapture() EndFunc ;==>Example Func StartDebugCapture() Local $tSecurityDescriptor = DllStructCreate("byte;byte;word;ptr[4]") Local $tSecurityAttributes = DllStructCreate($tagSECURITY_ATTRIBUTES) $tSecurityAttributes.Length = DllStructGetSize($tSecurityAttributes) $tSecurityAttributes.Descriptor = DllStructGetPtr($tSecurityDescriptor) $tSecurityAttributes.InheritHandle = True Local $aCall = DllCall("advapi32.dll", "bool", "InitializeSecurityDescriptor", "struct*", $tSecurityDescriptor, "dword", $SECURITY_DESCRIPTOR_REVISION) $aCall = DllCall("advapi32.dll", "bool", "SetSecurityDescriptorDacl", "struct*", $tSecurityDescriptor, "bool", True, "ptr", 0, "bool", False) $hEventBufferReady = _WinAPI_CreateEvent($tSecurityAttributes, False, False, "DBWIN_BUFFER_READY") ;ConsoleWrite($hEventBufferReady & @CRLF) $hEventDataReady = _WinAPI_CreateEvent($tSecurityAttributes, False, False, "DBWIN_DATA_READY") ;ConsoleWrite($hEventDataReady & @CRLF) $hBuffer = _WinAPI_CreateFileMapping(-1, 4096, "DBWIN_BUFFER", $PAGE_READWRITE, $tSecurityAttributes) ;ConsoleWrite($hBuffer & @CRLF) $pDebugInfo = _WinAPI_MapViewOfFile($hBuffer, 0, 4096, $FILE_MAP_READ) ;ConsoleWrite($pDebugInfo & @CRLF) _WinAPI_SetEvent($hEventBufferReady) EndFunc ;==>StartDebugCapture Func StopDebugCapture() _WinAPI_CloseHandle($hEventBufferReady) _WinAPI_CloseHandle($hEventDataReady) _WinAPI_UnmapViewOfFile($pDebugInfo) _WinAPI_CloseHandle($hBuffer) EndFunc ;==>StopDebugCapture Func GetDebugOutput() If _WinAPI_WaitForSingleObject($hEventDataReady, 0) = $WAIT_TIMEOUT Then Return Local $tEvent = DllStructCreate("dword PID;char string[4092]", $pDebugInfo) _WinAPI_SetEvent($hEventBufferReady) Return SetExtended($tEvent.PID, $tEvent.string) EndFunc ;==>GetDebugOutput Func Terminate() $bEnd = True EndFunc ;==>Terminate
    1 point
  48. This is a tool I put together to size an ESX cluster based on the VM resource requirements. it's far from perfect and probably bug ridden, but I just wanted to share. Credits to @guiness for his _GUICtrlListView_CreateArray UDF and to @Melba and associated crew for the GUIListViewEx UDF. edit: v0.7 ESX Builder.zip
    1 point
×
×
  • Create New...