Jump to content

Leaderboard

Popular Content

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

  1. Jon

    AutoIt v3.3.17.1 Beta

    AutoIt v3.3.17.1 Beta View File 3.3.17.1 (July 08, 2025) (Beta) AutoIt: UDFs: - Fixed: Typo in variable name in Date.au3 introduced in previous beta. 3.3.17.0 (June 29, 2025) (Beta) AutoIt: - Changed: Windows 7/Server 2008 is now the minimum OS version required due to dev environment changes. - Added #3891: DllCall() performance optimisation. - Added: Standard Windows Fonts List for Win10/Win11. - Added #3906: GUICtrlCreateXXX creation in example assign to $idXXX to reflect Ctrl type. - Added: FileGetAttrib() retrieve Join folder (J) as created by FileCreateNTFSLink(). - Added: Split WindowsConstants.u3 in WindowsNotifsConstants.au3, WindowsStylesConstants.au3 and WindowsSysColor.au3. - Added: #3984: GUICtrlSetGraphic() doc precision. - Fixed: Doc Chr(0) handling inside functions. - Fixed #3923: Doc typo in "Send Key List". - Fixed: Regression #3135 handle leak (Thanks Nano, Rudi, Nine). - Fixed #3925: Doc With ... EndWith using DllStruct Type. - Fixed: Links in Tutorials example code (thanks argumentum). Au3info: - Added: Display mouse coordinate mode. - Fixed #3917: Crash under Win7. SciTE-Lite: - Fixed: Folding Fix for #Preprocessor foldblock when followed by a CommentBlock. UDFs: - Added: script examples when running under Win11 with new notepad.exe. - Added: _GUICtrlTreeView_GetItemByIndex() can retrieve handle of the list of main item ($hItem= -1). - Added: _IsPressed() can be called with numeric value as in "WinAPIsvkeysConstants.au3". - Added #3909: _DebugReportData() to report Array column formatted. - Added: libExamples referring MemoWrite() now refer to _MemoWrite() defined in Extras\HelpFileInternals.au3. - Added: _WinAPI_WaitSystemIdle(), _WinAPI_QueryDiskUsage(), _WinAPI_QueryProcessorUsage(), _WinAPI_QueryProcessCycleTime() - Added: Doc _WinAPI_GetWindowSubclass() example (Thanks pixelSearch). - Added: _WinAPI_GetKeyboardLayout() default value for the running thread. - Added: _WinAPI_GetUserDefaultLCID() example. - Added: _WinAPI_GetKeyboardLayoutLocale(). - Added: _WinAPI_GetKeyboardState() example (Thanks AutoXenon). - Added #3932: Try to use file in HelpFile\Extras instead of @ScriptDir. - Added #3934: _WinAPI_SetTimer() example. - Added: _IsPressed() can wait on one of several keys. - Added: _WinAPI_SendInput(). - Added #3960: _Div() integer division. - Added #3963: _WinAPI_OpenEvent(). - Added: _GDIPlus_ImageSaveToFile() doc precision for compression level. - Added: _WinAPI_GetCursorSize() and _WinAPI_SetCursorSize(). - Added: $FOLDERID_Documents Constants in APIShellExConstants.au3. - Added: Support _GUIToolTip*() to be used to external process. - Added: Support _GUICtrlHeader*() to be used to external process. - Added: Support _GUICtrlStatusBar*() to be used to external process. - Added #3988: _WinAPI_GetSystemPowerStatus() return Battery status saver. - Added #3985: _ArrayDisplay() + $WS_EX_TOPMOST. - Added #3991: _SQLite_ForeignKeys() and Add a parameter in _SQLite_Open() to set it also. - Added #3990: _IsPressed() return in @extended if the key is still pressed. - Added: _DebugSetup(..., 1) does not interact with script being debug, Report infos copied to clipboard - Added: _WinAPI_SetWindowTheme() example to demonstrate Checkbox or Radio controls coloring. - Added #3997: _WinAPI_RegisterShellHookWindow() example improvement. - Added #3999: _WinAPI_OemToChar() performance improvement. - Added #3946: _ChooseFont() updated defaults (thanks argumentum). - Added: _DateDiff(), _DateAdd() using array for [days, hours, minutes, seconds]. - Added: _DebugSetup() Type 6, same as 1 but a timeout to close the report log windows. - Fixed #3894: _WinAPI_GetProcessName() returns incorrect result when process ID is invalid. - Fixed: "Then SetError()" in several standard UDF. - Fixed #3921: Missing _GUICtrlStatusBar_SetParts() examples. - Fixed: Doc typo $GPIP_ERR* >> $GDIP_ERR*. - Fixed #3926: _GUICtrlTreeView_SetChildren() not set/reset chidren flag. - Fixed: _WinAPI_DisplayStruct() elements containing chr(124). - Fixed #3945: StringRegExp() /s include VT. - Fixed #3949: _ArrayDisplay() does show multiple subscript of an array. - Fixed #3954: links in libfunction constants. - Fixed: missing doc description $iSubItem = - 1 in _GUICtrlListView_SetItemText(). - Fixed #3959: _WinAPI_ShellUserAuthenticationDlg() example. - Fixed #3975: unrelated link in Pcre doc. - Fixed #3903: _GuiCtrlTab_GetItem() does work on external process. - Fixed #3992: _WinAPI_DwmSetWindowAttribute() does not support all MSDN attributes. - Fixed #4001: _GUICtrlListView_*() example ($tagNMITEMACTIVATE). - Fixed #4003: _ArrayPush() doc precision. - Fixed: _GUICtrlButton_SetSplitInfo() example crash. - Fixed: Support of Notepad under Win11 for _DebugSetup(). - Fixed #4022: Various doc duplicated words. - Fixed #4031: _DebugArrayDisplay() buttons display. - Fixed: _DebugArrayDisplay() not executed if @error on entering ($ARRAYDISPLAY_CHECKERROR if no display wanted on @error). - Fixed #4033: _DateTimeSplit() setting $aTimePart[0] whem no time defined. - Fixed #4024: _DebugSetup(,, 5) (notepad window) not working under Windows 11. - Fixed: _WinAPI_IsElevated() @extended return value (Thanks Argumentum). - Fixed #4039: _GUICtrlTreeView_Delete() with $hWnd. - Fixed #4038: _GUICtrlRichEdit_StreamToFile() extra new paragraph. - Fixed #4029: _Date_Time_SystemTimeToDateTimeStr() Wrong output. - Fixed #4040: _GUICtrlRichEdit_SetZoom() parameter limitation bug. - Fixed #4041: _GUICtrlStatusBar_SetIcon() not shown. Submitter Jon Submitted 07/08/2025 Category Beta  
    10 points
  2. MattyD

    WinRT - WinUI3

    Hi all - This is an offshoot of the WinRT Project. I'm posting my progress here while I'm bumbling around with WinUI3 - just so the main project doesn't get too cluttered. If I get things working I'll merge the two projects back together. That's the plan anyway! ATM all I have is a blank Window (thrilling I know!), but if you wish to try it out you'll need to: download and extract the example (obviously!) WindowTest.zip Go here and download the latest Redistributable package of the Windows App SDK. Currently this is 1.7.3 (look in the table for the link.). Once you've extracted that, go to the MSIX > win10-x64 folder It seems the x86 libraries don't work at the moment. (thanks for testing Gianni) . So ensure you're running Autiot_x64 on the autoit side! (#AutoIt3Wrapper_UseX64=Y directive in script) Extract the contents of Microsoft.WindowsAppRuntime.1.7.msix. (7-Zip works fine) I also installed the msix - This is not necessary for now (thanks again Gianni). At some point we'll probably reference our dlls from the installed runtime location. Grab all the .dll files and put then in the same folder as "WindowTest.au3" If you plan to make use of the Class Explorer script, grab all the .winmd files and put them in the same folder as "ClassExplorer v2.3.1.au3" I also found AppxManifest.xml is handy for mapping objects to physical dll files. Cheers, Matt
    4 points
  3. UEZ

    why no array pointer

    Just made a quick test for 2D struct array: ;Code by UEZ #AutoIt3Wrapper_UseX64=y #include <WinAPIDiag.au3> #include <Memory.au3> Global Const $iWidth = 1000, $iHeight = 4000 Global Const $iTotal = $iWidth * $iHeight ConsoleWrite("Total: " & $iTotal & @CRLF) Global $t2DArray = DllStructCreate("uint a[" & $iTotal & "]") ;2D array Global $pArray = DllStructGetPtr($t2DArray) Global $x, $y, $t, $index ;2D For $y = 0 To $iHeight - 1 ;0 1 2 3 4 $t = $y * $iWidth ;10 11 12 13 14 For $x = 0 To $iWidth - 1 ;20 21 22 23 24 $index = $t + $x ;30 31 32 33 34 $t2DArray.a(($index + 1)) = $y & $x ; Next ;1D -> 0 1 2 3 4 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 Next Global $fTimer = TimerInit() ;~ Print2DArray($t2DArray, $iWidth, $iHeight) InsertValue2D(99, 0, 0, $t2DArray, $pArray, $iWidth, $iHeight, "uint") ;~ ConsoleWrite(@CRLF & "Result (add 99 at 0, 0):" & @CRLF) ConsoleWrite(TimerDiff($fTimer) & @CRLF) ;~ Print2DArray($t2DArray, $iWidth, $iHeight + 1) DeleteValue2D(2, 2, $t2DArray, $pArray, $iWidth, $iHeight + 1, "uint") ConsoleWrite(TimerDiff($fTimer) & @CRLF) ;~ ConsoleWrite(@CRLF & "Result (del 2, 2 -> 21):" & @CRLF) ;~ Print2DArray($t2DArray, $iWidth, $iHeight) Func InsertValue2D($value, $xPos, $yPos, ByRef $tStruct, ByRef $pArray, $cols, $rows, $type) Local $oldElements = $cols * $rows Local $newRows = $rows + 1 Local $newElements = $cols * $newRows Local $elementSize Switch $type Case "ushort", "short", "word" $elementSize = 2 Case "uint", "int", "float" $elementSize = 4 Case "double", "int64", "uint64" $elementSize = 8 Case Else Return SetError(1, 0, 0) EndSwitch Local $tNew = DllStructCreate($type & " a[" & $newElements & "]") Local $pNew = DllStructGetPtr($tNew) Local $insertIndex = $yPos * $cols + $xPos If $insertIndex < 0 Or $insertIndex > $oldElements Then Return SetError(1, 0, 0) _MemMoveMemory($pArray, $pNew, $insertIndex * $elementSize) $tNew.a($insertIndex + 1) = $value Local $bytesAfter = ($oldElements - $insertIndex) * $elementSize _MemMoveMemory($pArray + ($insertIndex * $elementSize), $pNew + (($insertIndex + 1) * $elementSize), $bytesAfter) $tStruct = $tNew $pArray = $pNew Return 1 EndFunc Func DeleteValue2D($xPos, $yPos, ByRef $tStruct, ByRef $pArray, $cols, $rows, $type) Local $oldElements = $cols * $rows If $rows < 2 Then Return SetError(1, 0, 0) Local $newElements = $oldElements - 1 Local $elementSize Switch $type Case "ushort", "short", "word" $elementSize = 2 Case "uint", "int", "float" $elementSize = 4 Case "double", "int64", "uint64" $elementSize = 8 Case Else Return SetError(2, 0, 0) EndSwitch Local $deleteIndex = $yPos * $cols + $xPos If $deleteIndex < 0 Or $deleteIndex >= $oldElements Then Return SetError(3, 0, 0) Local $tNew = DllStructCreate($type & " a[" & $newElements & "]") Local $pNew = DllStructGetPtr($tNew) _MemMoveMemory($pArray, $pNew, $deleteIndex * $elementSize) Local $bytesAfter = ($oldElements - $deleteIndex - 1) * $elementSize _MemMoveMemory($pArray + (($deleteIndex + 1) * $elementSize), $pNew + ($deleteIndex * $elementSize), $bytesAfter) $tStruct = $tNew $pArray = $pNew Return 1 EndFunc Func Print2DArray($t2DArray, $cols, $rows) Local $x, $y, $index For $y = 0 To $rows - 1 For $x = 0 To $cols - 1 $index = $y * $iWidth + $x ConsoleWrite($t2DArray.a($index + 1) & @TAB) Next ConsoleWrite(@CRLF) Next EndFunc It took 13 seconds to execute insert and delete operation for one element each for an array with 4.000.000 elements. I don't know how long it would take using ASM... I'm pretty rusty when it comes to ASM. ¯\_(ツ)_/¯
    4 points
  4. UEZ

    why no array pointer

    Something like that: 1D: ;coded by UEZ #include <WinAPIDiag.au3> #include <Memory.au3> Global $iElements = 2^5 ConsoleWrite("Number of entries: " & $iElements & @CRLF) Global $tArray = DllStructCreate("uint a[" & $iElements & "]") Global $pArray = DllStructGetPtr($tArray) For $i = 1 To $iElements $tArray.a(($i)) = $i Next Global $iPos = Int($iElements * 0.667) ConsoleWrite("Insert to position " & $iPos & @CRLF) InsertValue(123456789, $iPos, $tArray, $pArray, "uint") _WinAPI_DisplayStruct($tArray, "uint a[" & $iElements + 1 & "]") Func InsertValue($value, $iPos, ByRef $tArray, ByRef $pArray, $type) If Not IsDllStruct($tArray) Then Return SetError(1, 0, 0) Local $iUB, $iBytes Switch $type Case "wchar", "short", "ushort", "word" $iBytes = 2 $iUB = DllStructGetSize($tArray) / $iBytes Case "float", "int", "long", "bool", "uint", "ulong" $iBytes = 4 $iUB = DllStructGetSize($tArray) / $iBytes Case "int64", "uint64", "double" $iBytes = 8 $iUB = DllStructGetSize($tArray) / $iBytes Case Else Return SetError(2, 0, 0) EndSwitch If $iPos < 1 Or $iPos > $iUB Then SetError(3, 0, 0) $iUB += 1 Local $tArray_new = DllStructCreate($type & " a[" & $iUB & "]") $pArray = DllStructGetPtr($tArray_new) _MemMoveMemory(DllStructGetPtr($tArray), $pArray, ($iPos - 1) * $iBytes) $tArray_new.a(($iPos)) = $value _MemMoveMemory(DllStructGetPtr($tArray) + ($iPos - 1) * $iBytes, $pArray + $iPos * $iBytes , ($iUB - $iPos) * $iBytes) $tArray = $tArray_new Return 1 EndFunc 2D: #include <WinAPIDiag.au3> #include <Memory.au3> Global Const $iWidth = 5, $iHeight = 4 Global Const $iTotal = $iWidth * $iHeight Global $t2DArray = DllStructCreate("uint a[" & $iTotal & "]") ;2D array Global $pArray = DllStructGetPtr($t2DArray) Global $x, $y, $t, $index ;2D For $y = 0 To $iHeight - 1 ;0 1 2 3 4 $t = $y * $iWidth ;10 11 12 13 14 For $x = 0 To $iWidth - 1 ;20 21 22 23 24 $index = $t + $x ;30 31 32 33 34 $t2DArray.a(($index + 1)) = $y & $x ; Next ;1D -> 0 1 2 3 4 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 Next Print2DArray($t2DArray, $iWidth, $iHeight) InsertValue2D(99, 0, 0, $t2DArray, $pArray, $iWidth, $iHeight, "uint") ConsoleWrite(@CRLF & "Result (add 99 at 0, 0):" & @CRLF) Print2DArray($t2DArray, $iWidth, $iHeight + 1) DeleteValue2D(2, 2, $t2DArray, $pArray, $iWidth, $iHeight + 1, "uint") ConsoleWrite(@CRLF & "Result (del 2, 2 -> 21):" & @CRLF) Print2DArray($t2DArray, $iWidth, $iHeight) Func InsertValue2D($value, $xPos, $yPos, ByRef $tStruct, ByRef $pArray, $cols, $rows, $type) Local $oldElements = $cols * $rows Local $newRows = $rows + 1 Local $newElements = $cols * $newRows Local $elementSize Switch $type Case "ushort", "short", "word" $elementSize = 2 Case "uint", "int", "float" $elementSize = 4 Case "double", "int64", "uint64" $elementSize = 8 Case Else Return SetError(1, 0, 0) EndSwitch Local $tNew = DllStructCreate($type & " a[" & $newElements & "]") Local $pNew = DllStructGetPtr($tNew) Local $insertIndex = $yPos * $cols + $xPos If $insertIndex < 0 Or $insertIndex > $oldElements Then Return SetError(1, 0, 0) _MemMoveMemory($pArray, $pNew, $insertIndex * $elementSize) $tNew.a($insertIndex + 1) = $value Local $bytesAfter = ($oldElements - $insertIndex) * $elementSize _MemMoveMemory($pArray + ($insertIndex * $elementSize), $pNew + (($insertIndex + 1) * $elementSize), $bytesAfter) $tStruct = $tNew $pArray = $pNew Return 1 EndFunc Func DeleteValue2D($xPos, $yPos, ByRef $tStruct, ByRef $pArray, $cols, $rows, $type) Local $oldElements = $cols * $rows If $rows < 2 Then Return SetError(1, 0, 0) Local $newElements = $oldElements - 1 Local $elementSize Switch $type Case "ushort", "short", "word" $elementSize = 2 Case "uint", "int", "float" $elementSize = 4 Case "double", "int64", "uint64" $elementSize = 8 Case Else Return SetError(2, 0, 0) EndSwitch Local $deleteIndex = $yPos * $cols + $xPos If $deleteIndex < 0 Or $deleteIndex >= $oldElements Then Return SetError(3, 0, 0) Local $tNew = DllStructCreate($type & " a[" & $newElements & "]") Local $pNew = DllStructGetPtr($tNew) _MemMoveMemory($pArray, $pNew, $deleteIndex * $elementSize) Local $bytesAfter = ($oldElements - $deleteIndex - 1) * $elementSize _MemMoveMemory($pArray + (($deleteIndex + 1) * $elementSize), $pNew + ($deleteIndex * $elementSize), $bytesAfter) $tStruct = $tNew $pArray = $pNew Return 1 EndFunc Func Print2DArray($t2DArray, $cols, $rows) Local $x, $y, $index For $y = 0 To $rows - 1 For $x = 0 To $cols - 1 $index = $y * $iWidth + $x ConsoleWrite($t2DArray.a($index + 1) & @TAB) Next ConsoleWrite(@CRLF) Next EndFunc
    4 points
  5. I've created a label based solution for a simple status bar. May be it's interesting 4u. https://github.com/BugFix/AutoIt-Scripts/blob/main/Statusbar/statusbar_small.md#gallery
    3 points
  6. I tried to add these 2 controls (combo & input box) to my script found in this post with good results, on a maximizable / resizable GUI : These are the lines modified / added to the script, so you can try them too : 1) Lines modified : ; Local $iW = 300, $iH = 100 Local $iW = 600, $iH = 200 ; Local $aParts[3] = [90, 180, 280] Local $aParts[3] = [200, 400, 580] ; Local $idChangeText = GUICtrlCreateLabel("Change Text", 110, 25, 80, 30, $SS_CENTER + $SS_CENTERIMAGE), $iInc Local $idChangeText = GUICtrlCreateLabel("Change Text", $iW / 2 - 40, 50, 80, 30, $SS_CENTER + $SS_CENTERIMAGE), $iInc 2) Lines added : #include <ComboConstants.au3> ... Local $idComboBox = GUICtrlCreateCombo("Install", 100, 180, 100, 18, $CBS_DROPDOWNLIST) GUICtrlSetData($idComboBox, "Uninstall") GUICtrlSetBkColor(-1, 0xFF0000) ; red _WinAPI_SetParent(GUICtrlGetHandle($idComboBox), $g_hGUI) Local $idInput = GUICtrlCreateInput("Input in part 1", 300, 181, 100, 18) GUICtrlSetBkColor(-1, 0x00FF00) ; green _WinAPI_SetParent(GUICtrlGetHandle($idInput), $g_hGUI) * Please create $idComboBox and $idInput just after the label $idChangeText * IIRC your StatusBar height got a higher value, so you'll probably have to lower a bit the Y coord of both controls * Lucky me, I tried the _WinAPI_SetParent() on each control (combo & input), indicating... the GUI as parent and it "woke" them up both. Without this instruction, they didn't react, as you indicated. Hope it will work on your side, fingers crossed
    3 points
  7. This works on my Win10 machine. #include <GUIConstantsEx.au3> #include <WinApi.au3> #include <WindowsConstants.au3> Global $hDeskWin = _WinGetDesktopHandle() Global $h_Desktop_SysListView32 = HWnd(@extended) Main() Func Main() Local $this = GUICreate("", 400, 400, @DesktopWidth - (400) - 20, 100, $WS_POPUP, $WS_EX_NOACTIVATE + $WS_EX_TRANSPARENT) _WinAPI_SetParent($this, $h_Desktop_SysListView32) Local $iPic = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\msoobe.jpg", 0, 0, 400, 400) ;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) WinSetTrans($this, "", 200) _GuiRoundCorners($this, 16, 16) _WinAPI_SetWindowLong($this, $GWL_HWNDPARENT, ControlGetHandle("[CLASS:Progman]", "", "SysListView321")) ;hide in taskbar GUISetState(@SW_SHOWNOACTIVATE, $this) ;_WinAPI_SetWindowPos($this, $HWND_BOTTOM, Default, Default, Default, Default, BitOR($SWP_NOACTIVATE, $SWP_SHOWWINDOW, $SWP_NOMOVE, $SWP_NOSIZE )) ;not worked While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($this) EndFunc ;==>Main Func _GuiRoundCorners($h_win, $ixR, $iyR) Local $aPos = WinGetPos($h_win) If @error Then Return 0 Local $iW = $aPos[2] Local $iH = $aPos[3] Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $iW, $iH, $ixR, $iyR) _WinAPI_SetWindowRgn($h_win, $hRgn) EndFunc ;==>_GuiRoundCorners ; http://www.autoitscript.com/forum/topic/119783-desktop-class-workerw/page__view__findpost__p__903081 ; =============================================================================================================================== ; <_WinGetDesktopHandle.au3> ; ; Function to get the Windows' Desktop Handle. ; Since this is no longer a simple '[CLASS:Progman]' on Aero-enabled desktops, this method uses a slightly ; more involved method to find the correct Desktop Handle. ; ; Author: Ascend4nt, credits to Valik for pointing out the Parent->Child relationship: Desktop->'SHELLDLL_DefView' ; =============================================================================================================================== ; Example use: #cs #include <GuiListView.au3> $iTimer = TimerInit() $hDeskWin = _WinGetDesktopHandle() $hListView = HWnd(@extended) ConsoleWrite("Time elapsed:" & TimerDiff($iTimer) & " ms" & @CRLF) $iDeskItems = _GUICtrlListView_GetItemCount($hListView) ConsoleWrite("Handle to desktop: " & $hDeskWin & ", Title: '" & WinGetTitle($hDeskWin) & "', Handle to Listview: " & $hListView & ", # Items:" & $iDeskItems & ", Title: " & WinGetTitle($hListView) & @CRLF) MsgBox(0, "Desktop handle (with ListView) found", "Handle to desktop: " & $hDeskWin & ", Title: '" & WinGetTitle($hDeskWin) & "'," & @CRLF & "Handle to Listview: " & $hListView & @CRLF & "# Desktop Items:" & $iDeskItems) #ce Func _WinGetDesktopHandle() Local $i, $hDeskWin, $hSHELLDLL_DefView, $hListView ; The traditional Windows Classname for the Desktop, not always so on newer O/S's $hDeskWin = WinGetHandle("[CLASS:Progman]") ; Parent->Child relationship: Desktop->SHELLDLL_DefView $hSHELLDLL_DefView = ControlGetHandle($hDeskWin, '', '[CLASS:SHELLDLL_DefView; INSTANCE:1]') ; No luck with finding the Desktop and/or child? If $hDeskWin = '' Or $hSHELLDLL_DefView = '' Then ; Look through a list of WorkerW windows - one will be the Desktop on Windows 7+ O/S's $aWinList = WinList("[CLASS:WorkerW]") For $i = 1 To $aWinList[0][0] $hSHELLDLL_DefView = ControlGetHandle($aWinList[$i][1], '', '[CLASS:SHELLDLL_DefView; INSTANCE:1]') If $hSHELLDLL_DefView <> '' Then $hDeskWin = $aWinList[$i][1] ExitLoop EndIf Next EndIf ; Parent->Child relationship: Desktop->SHELDLL_DefView->SysListView32 $hListView = ControlGetHandle($hSHELLDLL_DefView, '', '[CLASS:SysListView32; INSTANCE:1]') If $hListView = '' Then Return SetError(-1, 0, '') Return SetExtended($hListView, $hDeskWin) EndFunc ;==>_WinGetDesktopHandle
    2 points
  8. This did it. This solved my problem. It's funny, too, because _WinAPI_SetParent() was problematic at one point causing issues by destroying the theming. And now here comes _WinAPI_SetParent() to save the day by restoring the lovely theming. It blows my mind! Thank you so much for your help and for your time with this. I appreciate it, as always. You've saved me a few times now already. Now I can move on to the not-so-fun DPI awareness control sizing stuff.
    2 points
  9. ...so, yes. It should work everywhere. When he claimed that something changed drastically ( not sure what ) I jumped into getting the latest to test and not make a fool of my self calling Bill to give him a piece of my mind !. Fortunately, I didn't have to 😇
    2 points
  10. Just as a shot in the dark: I honestly do not know, how the Excel UDF interacts with Exel.exe, but, maybe: For a complete different task with Outlook (powershell) I ran into the issue, that Outlook is opening a "COM-Server", and with that one the PS-Commands interact. Sometimes it did work, next day it didn't. The constraint finally was, that outlook.exe can open such a COM-Server exactly one time within a Windows PC / VM. I used Fast User Switching (FUS), and when I had two logins to this test-PC, and under the login context of "User-A" there was outlook running, then after FUS to user-B the first instance of outlook.exe was not able to create a COM-Server within this user context again, because this is a "one-COM-server-per-PC" thing, not "one-per-user-context". Switching back to user-A, terminate Outlook.exe there, switching again to User-B, everything was working perfectly.
    1 point
  11. ... ~3 years later, added an [unofficial] update for ArrayDisplayInternals.au3 for both v3.3.16.1 and v3.3.17.1 beta. Added: $ARRAYDISPLAY_SUBTITLECOLOUR = 1024 ; Contrasts the subtitle with a light grey background $ARRAYDISPLAY_MAXTITLE = 2048 ; Maximize title width regardless of array width Test Script #include "ArrayDisplayInternals.au3" #include <Debug.au3> #include <Array.au3> ; Sample 2D array for all tests Global $aTestArray[4][3] = [ _ [1, "Red", True], _ [2, "Green", False], _ [3, "Blue", True], _ [4, "Yellow", False] _ ] ; Flag Constants Global Const $F_LEFT = 0 Global Const $F_TRANSPOSE = 1 Global Const $F_RIGHT = 2 Global Const $F_CENTER = 4 Global Const $F_VERBOSE = 8 Global Const $F_COPYONLY = 16 Global Const $F_NOBUTTONS = 32 Global Const $F_NOROW = 64 Global Const $F_CHECKERR = 128 Global Const $F_NODATALABEL = 256 Global Const $F_NORIGHTCLICK= 512 Global Const $F_SUBTITLECOLOUR = 1024 Global Const $F_MAXTITLE = 2048 ; Utility function to log and invoke display Func RunFlagTest($sLabel, $iFlags) ConsoleWrite("Test: " & $sLabel & " | Flags: " & $iFlags & @CRLF) _DebugArrayDisplay($aTestArray, $sLabel, Default, $iFlags) EndFunc ConsoleWrite("=== Starting ARRAYDISPLAY Flag Tests ===" & @CRLF) ; --- Individual Flag Tests --- RunFlagTest("LEFT Align (Default)", $F_LEFT) RunFlagTest("TRANSPOSE", $F_TRANSPOSE) RunFlagTest("RIGHT Align", $F_RIGHT) RunFlagTest("CENTER Align", $F_CENTER) RunFlagTest("VERBOSE Mode", $F_VERBOSE) RunFlagTest("COPY ONLY Buttons", $F_COPYONLY) RunFlagTest("NO Buttons Displayed", $F_NOBUTTONS) RunFlagTest("NO ROW Column", $F_NOROW) RunFlagTest("CHECK ERROR (on valid input)", $F_CHECKERR) RunFlagTest("NO DATA LABEL Display", $F_NODATALABEL) RunFlagTest("NO RIGHT-CLICK Menu", $F_NORIGHTCLICK) RunFlagTest("CONTRAST SUBTITLE", $F_SUBTITLECOLOUR) RunFlagTest("A VERY LONG ARRAY TITLE THAT SHOULDN'T BE TRUNCATED", $F_MAXTITLE) ; --- Combination Tests --- RunFlagTest("TRANSPOSE + CENTER Align", BitOR($F_TRANSPOSE, $F_CENTER)) RunFlagTest("RIGHT Align + NO ROW", BitOR($F_RIGHT, $F_NOROW)) RunFlagTest("COPY ONLY + SUBTITLE COLOUR", BitOR($F_COPYONLY, $F_SUBTITLECOLOUR)) RunFlagTest("NO Buttons + NO DATA LABEL", BitOR($F_NOBUTTONS, $F_NODATALABEL)) RunFlagTest("VERBOSE + CHECK ERROR + CENTER Align", BitOR($F_VERBOSE, $F_CHECKERR, $F_CENTER)) RunFlagTest("TRANSPOSE + COPY ONLY + NO ROW", BitOR($F_TRANSPOSE, $F_COPYONLY, $F_NOROW)) RunFlagTest("CENTER Align + NO DATA LABEL + NO RIGHT-CLICK", BitOR($F_CENTER, $F_NODATALABEL, $F_NORIGHTCLICK)) ConsoleWrite("=== Tests Complete ===" & @CRLF) ArrayDisplayInternals.au3 beta_v3.3.17.1_ArrayDisplayInternals.au3
    1 point
  12. #include <Misc.au3> HotKeySet("{ESC}", "Terminate") ; just in case you want to exit this way Func Terminate() Exit EndFunc ;==>Terminate Exit Example() Func Example() Local $iX = 985, $iY = 284 While Sleep(100) ; otherwise the CPU is going nuts If _IsPressed("04") Then ; 04 Middle mouse button (three-button mouse) Do Sleep(100) ; wait intill is released Until Not _IsPressed("04") MouseMove($iX, $iY) ToolTip("..and here we are on " & $iX & " / " & $iY & " at " & _ @HOUR & ":" & @MIN & ":" & @SEC & @LF & "Press ESC to exit this demo.") AdlibRegister(ToolTipOff, 1000) ; to show you that we're done ; but you do your thing here EndIf WEnd EndFunc ;==>Example Func ToolTipOff() AdlibUnRegister(ToolTipOff) ToolTip("") EndFunc ;==>ToolTipOff ..this should get you started
    1 point
  13. @Ontosy, this is Sparta, I mean, this is AutoIt. If you rather use languages that have those, use those 🤔
    1 point
  14. I noticed that a couple of days ago but did not report, after we saw the issue in _GUICtrlStatusBar_EmbedControl which did not let you embed controls in your script, because of _WinAPI_SetParent() which change the parent of the embedded controls, then their background colors were not the ones you wanted. I'm sure other examples in the help file would need the same fix, e.g. to take care of the messages WM_SIZE / WM_MOVE when the GUI is resized, minimized etc... and calculate the position of these controls during the registered messages functions.
    1 point
  15. By default, embedding other controls in my status bar is not provided. But some thoughts on this: The function "_StatusbarCreate" returns an array that contains, among other things, the IDs of all parts. The ID can be used to query the part's rectangle. One option would be to hide the original label and overlay it with another control at the determined position. Some optical corrections may still be necessary to achieve a uniform appearance. That is the solution I would choose. Good luck with your attempts.
    1 point
  16. The idea is to be able to share information in the forum when a struct data needs to be shared among us. As an example, lets say that we wanna share what comes out of $tagOSVERSIONINFOEX. We could just run: #include <WinAPIMisc.au3> #include <WinAPIDiag.au3> #include <Debug.au3> #include <Sqlite.au3> Exit GetOs() Func GetOs() Local $tOSVERSIONINFOEX = DllStructCreate($tagOSVERSIONINFOEX) DllStructSetData($tOSVERSIONINFOEX, 1, DllStructGetSize($tOSVERSIONINFOEX)) Local $aCall = DllCall('kernel32.dll', 'bool', 'GetVersionExW', 'struct*', $tOSVERSIONINFOEX) If @error Or Not $aCall[0] Then Return SetError(@error, @extended, 0) Local $aArray = _WinAPI_DisplayStruct_mod($tOSVERSIONINFOEX, $tagOSVERSIONINFOEX, '', 0, 0, 0, True, 0, 1) Local $sText = _SQLite_Display2DResult($aArray, 0, True) ConsoleWrite(@CRLF & $sText & @CRLF & @CRLF) ; for those outside the editor Local $iW = 600, $iH = 300, $hGui = GUICreate(@ScriptName, $iW, $iH) GUISetFont(10, 400, 0, "Terminal") Local $idEdit = GUICtrlCreateEdit($sText, 0, 0, $iW, $iH) GUISetState() While GUIGetMsg() <> -3 WEnd GUIDelete($hGui) EndFunc ;==>GetOs ... ... and share the text that comes out: - - 0x0125DC18 <struct> 0 - 1 OSVersionInfoSize 0 DWORD 4 284 2 MajorVersion 4 DWORD 4 10 3 MinorVersion 8 DWORD 4 0 4 BuildNumber 12 DWORD 4 22631 5 PlatformId 16 DWORD 4 2 6 CSDVersion 20 WCHAR[128] 256 7 ServicePackMajor 276 USHORT 2 0 8 ServicePackMinor 278 USHORT 2 0 9 SuiteMask 280 USHORT 2 256 10 ProductType 282 BYTE 1 1 11 Reserved 283 BYTE 1 - - - 0x0125DD34 <endstruct> 284 - So the mod. I made to _WinAPI_DisplayStruct() is here ( with the complete running example from above ) This way is easier to share such. I know this is a lazy way to do it but, is a fast mod. and does what is needed to get the data as text.
    1 point
  17. Thanks @pixelsearch. Indeed I double checked and it seems this constant was missing from the list. I have fixed it now.
    1 point
  18. ..can't make it go behind the icons Win11 24H2
    1 point
  19. For the record, these 2 lines would be a good start in OP's script, placed in the main loop (tested) Case $TRAY_EVENT_MOUSEOVER If WinGetTitle("[active]") <> "AutoIt v3" Then $Title = WinGetTitle("[active]") It is strange that the help file doesn't mention the event $TRAY_EVENT_MOUSEOVER in the topic TrayGetMsg when it is mentioned in the topic TraySetOnEvent That's a big difference with the events listed the help file, topic GUIGetMsg and GUISetOnEvent : the same events are listed in these 2 topics.
    1 point
  20. I was trying out the sending Alt Tab, and getting nowhere, fast. GetWinTitle() always returned an empty string, and GetWinProcName() always returned ‘explorer.exe’. Your second example works just great! Though way over my head, far too advanced for my newbie skills. But hey it works, so you have saved me hours if not days. Thanks yet again argumentum!
    1 point
  21. argumentum

    Tidy/VSCode

    Ok. Good to know. Am sure I'll face those WTFs and thanks to you now know how to go about it. I have my eyes on @ioa747's AI stuff because I'd like to run AI locally. It'd suck if in the middle of depending on an AI service I learn that: "you owe me a zillion dollars" or "to continue insert more coins" or any of what a service may come up with.
    1 point
  22. BinaryBrother

    Tidy/VSCode

    Thanks @argumentum. The VSCode/AutoIt.Damien isn't working exactly right for me... It runs just fine and the errors don't show up in scite. There's nothing wrong, but it's detecting errors. Edit: Relaunching the project folder fixes it. 😕
    1 point
  23. n3wbie

    WebDriver and Admin rights

    Yes its working for chrome. thanks
    1 point
  24. I might have a suggestion for an extension: Currently, the user must not make a single typing error for the suggestion to be displayed as such. To be more generous, you could use a fuzzy comparison. I have implemented this accordingly in your script and used >>this UDF<< for the fuzzy search. The script now looks like this: #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <WinAPI.au3> #include <GuiListBox.au3> #include "FuzzyString.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, 0, 0, 1, 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 = _FS_ArraySearchFuzzy($g_aAvailableTags, $sLastPart, 1, __LS_UntilLength) $aFilteredSuggestions = _ArrayExtract($aFilteredSuggestions, -1, -1, 0, 0) $iCount = UBound($aFilteredSuggestions) 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 ; comparison function for the fuzzy comparison, which only compares up to the same length and introduces limit values for short strings. Func __LS_UntilLength($sA, $sB, $iMax = Default) Local $iLenA = StringLen($sA) Local $iLenB = StringLen($sB) Local $iLenMin = $iLenA > $iLenB ? $iLenB : $iLenA Local $iLenShort = $iLenMin > 1 ? 2 : $iLenMin Local $aLS[2] ; short exit for performance boost If StringLeft($sA, $iLenShort) <> StringLeft($sB, $iLenShort) Then $aLS[0] = $iMax + 1 Return $aLS EndIf $aLS = _FS_Hamming(StringLeft($sA, $iLenMin), StringLeft($sB, $iLenMin), $iMax) If @error Then Return SetError(@error, @extended) If $aLS[0] > 0 And $aLS[0] > ($iLenMin - 2) Then $aLS[0] = $iMax + 1 Return $aLS EndFunc Enter something like "abose" and you'll see what I mean. This does not come from StringRegExp but from _ArrayUnique. And this behavior can be prevented directly when it is called via _ArrayUnique($aWords, 0, 0, 1, 0).
    1 point
  25. mLipok

    WebDriver and Admin rights

    I think they're changing the default behavior. But they also provide override switches here: https://chromium-review.googlesource.com/c/chromium/src/+/6515318/11/chrome/common/chrome_switches.cc EDIT: btw. the --do-not-de-elevate switch was provide in MsEdge in 2019 and still is there
    1 point
  26. ..I would not talk to them. Would be useless. They do what they do and we, ...we find a way around ¯\_(ツ)_/¯
    1 point
  27. My most awesome "_WinAPI_SetWindowTheme_unr()" is "_WinAPI_SetWindowTheme()" without the "child proofing", the rest is the standard WinAPI. If on 26100 .4652 things don't work, .. tell M$ ? The simple approach I gave you in the beginning was "fake it" and that's, what is in my vast ( or not ) knowledge of GUIs 🤯
    1 point
  28. Gianni

    WinRT - WinUI3

    Hi @MattyD ... I didn't install it, and "WindowTest.au3" works anyway ... ... I also tried this stuff but it doesn't work ... I get this --> !>01:19:22 AutoIt3.exe ended.rc:-1073741819 Thanks for all this work! 👍
    1 point
  29. Jon

    AutoIt v3.3.17.1 Beta

    55 downloads

    3.3.17.1 (July 08, 2025) (Beta) AutoIt: UDFs: - Fixed: Typo in variable name in Date.au3 introduced in previous beta. 3.3.17.0 (June 29, 2025) (Beta) AutoIt: - Changed: Windows 7/Server 2008 is now the minimum OS version required due to dev environment changes. - Added #3891: DllCall() performance optimisation. - Added: Standard Windows Fonts List for Win10/Win11. - Added #3906: GUICtrlCreateXXX creation in example assign to $idXXX to reflect Ctrl type. - Added: FileGetAttrib() retrieve Join folder (J) as created by FileCreateNTFSLink(). - Added: Split WindowsConstants.u3 in WindowsNotifsConstants.au3, WindowsStylesConstants.au3 and WindowsSysColor.au3. - Added: #3984: GUICtrlSetGraphic() doc precision. - Fixed: Doc Chr(0) handling inside functions. - Fixed #3923: Doc typo in "Send Key List". - Fixed: Regression #3135 handle leak (Thanks Nano, Rudi, Nine). - Fixed #3925: Doc With ... EndWith using DllStruct Type. - Fixed: Links in Tutorials example code (thanks argumentum). Au3info: - Added: Display mouse coordinate mode. - Fixed #3917: Crash under Win7. SciTE-Lite: - Fixed: Folding Fix for #Preprocessor foldblock when followed by a CommentBlock. UDFs: - Added: script examples when running under Win11 with new notepad.exe. - Added: _GUICtrlTreeView_GetItemByIndex() can retrieve handle of the list of main item ($hItem= -1). - Added: _IsPressed() can be called with numeric value as in "WinAPIsvkeysConstants.au3". - Added #3909: _DebugReportData() to report Array column formatted. - Added: libExamples referring MemoWrite() now refer to _MemoWrite() defined in Extras\HelpFileInternals.au3. - Added: _WinAPI_WaitSystemIdle(), _WinAPI_QueryDiskUsage(), _WinAPI_QueryProcessorUsage(), _WinAPI_QueryProcessCycleTime() - Added: Doc _WinAPI_GetWindowSubclass() example (Thanks pixelSearch). - Added: _WinAPI_GetKeyboardLayout() default value for the running thread. - Added: _WinAPI_GetUserDefaultLCID() example. - Added: _WinAPI_GetKeyboardLayoutLocale(). - Added: _WinAPI_GetKeyboardState() example (Thanks AutoXenon). - Added #3932: Try to use file in HelpFile\Extras instead of @ScriptDir. - Added #3934: _WinAPI_SetTimer() example. - Added: _IsPressed() can wait on one of several keys. - Added: _WinAPI_SendInput(). - Added #3960: _Div() integer division. - Added #3963: _WinAPI_OpenEvent(). - Added: _GDIPlus_ImageSaveToFile() doc precision for compression level. - Added: _WinAPI_GetCursorSize() and _WinAPI_SetCursorSize(). - Added: $FOLDERID_Documents Constants in APIShellExConstants.au3. - Added: Support _GUIToolTip*() to be used to external process. - Added: Support _GUICtrlHeader*() to be used to external process. - Added: Support _GUICtrlStatusBar*() to be used to external process. - Added #3988: _WinAPI_GetSystemPowerStatus() return Battery status saver. - Added #3985: _ArrayDisplay() + $WS_EX_TOPMOST. - Added #3991: _SQLite_ForeignKeys() and Add a parameter in _SQLite_Open() to set it also. - Added #3990: _IsPressed() return in @extended if the key is still pressed. - Added: _DebugSetup(..., 1) does not interact with script being debug, Report infos copied to clipboard - Added: _WinAPI_SetWindowTheme() example to demonstrate Checkbox or Radio controls coloring. - Added #3997: _WinAPI_RegisterShellHookWindow() example improvement. - Added #3999: _WinAPI_OemToChar() performance improvement. - Added #3946: _ChooseFont() updated defaults (thanks argumentum). - Added: _DateDiff(), _DateAdd() using array for [days, hours, minutes, seconds]. - Added: _DebugSetup() Type 6, same as 1 but a timeout to close the report log windows. - Fixed #3894: _WinAPI_GetProcessName() returns incorrect result when process ID is invalid. - Fixed: "Then SetError()" in several standard UDF. - Fixed #3921: Missing _GUICtrlStatusBar_SetParts() examples. - Fixed: Doc typo $GPIP_ERR* >> $GDIP_ERR*. - Fixed #3926: _GUICtrlTreeView_SetChildren() not set/reset chidren flag. - Fixed: _WinAPI_DisplayStruct() elements containing chr(124). - Fixed #3945: StringRegExp() /s include VT. - Fixed #3949: _ArrayDisplay() does show multiple subscript of an array. - Fixed #3954: links in libfunction constants. - Fixed: missing doc description $iSubItem = - 1 in _GUICtrlListView_SetItemText(). - Fixed #3959: _WinAPI_ShellUserAuthenticationDlg() example. - Fixed #3975: unrelated link in Pcre doc. - Fixed #3903: _GuiCtrlTab_GetItem() does work on external process. - Fixed #3992: _WinAPI_DwmSetWindowAttribute() does not support all MSDN attributes. - Fixed #4001: _GUICtrlListView_*() example ($tagNMITEMACTIVATE). - Fixed #4003: _ArrayPush() doc precision. - Fixed: _GUICtrlButton_SetSplitInfo() example crash. - Fixed: Support of Notepad under Win11 for _DebugSetup(). - Fixed #4022: Various doc duplicated words. - Fixed #4031: _DebugArrayDisplay() buttons display. - Fixed: _DebugArrayDisplay() not executed if @error on entering ($ARRAYDISPLAY_CHECKERROR if no display wanted on @error). - Fixed #4033: _DateTimeSplit() setting $aTimePart[0] whem no time defined. - Fixed #4024: _DebugSetup(,, 5) (notepad window) not working under Windows 11. - Fixed: _WinAPI_IsElevated() @extended return value (Thanks Argumentum). - Fixed #4039: _GUICtrlTreeView_Delete() with $hWnd. - Fixed #4038: _GUICtrlRichEdit_StreamToFile() extra new paragraph. - Fixed #4029: _Date_Time_SystemTimeToDateTimeStr() Wrong output. - Fixed #4040: _GUICtrlRichEdit_SetZoom() parameter limitation bug. - Fixed #4041: _GUICtrlStatusBar_SetIcon() not shown.
    1 point
  30. I'd like a VM that I can just copy from the host PC to another PC and keep running it. The defaults are paths are that the "Virtual Hard Disks" goes somewhere and the setting elsewhere. And I find myself exporting the newly created VM to a set folder, deleting the VM to then import the VM just to have it all in one place. If I want to move the VM from the current hardware to another hardware, all I have to do ( via this way ) is to copy the folder where the exported ( and registered in place ) is at to the other PC. Easy-peasy Do I need help ?, nope. But I coded a "do it for me" so is easier/faster to get done, that to me is not an example script, not even in quality of code, but it gets the job done. The code is down in the next post, so that I can mark it as solved
    1 point
  31. argumentum

    why no array pointer

    Each of these users have their unique stories with their love for AutoIt ( and am not exaggerating when I say "their love" for AutoIt ). Just can't put them all in the same pot. There is also the forum life and the ungratefulness and aggravation they go though, that understandingly push them away from the forum. So because they don't devote attention to the forum, don't mean that they never used AutoIt again. It just mean that they don't frequent the forum.
    1 point
  32. argumentum

    why no array pointer

    I can run AutoIt without any dependencies anywhere. It just runs. Nimble too. A GUI with AutoIt is easy. If I had to do all the things I do in C++ it'd be slower and unforgiving for me. Python is here to stay, and I don't like Python. I'll have to go through the advise I gave you myself for all the AI stuff that is floating around and my brain is never been all that great to start with, and adding aging to the pot don't make it easier either. Yet the advise is the same. I feel you. I really do. But "it is what it is", for you, me, or anyone. I guess you'd do it in ASM and use the FASM. I'd use SQLite and call it a day. Not that I know SQL all that much, but am sure that whatever you're gonna use that big array for, could be done with SQLite, I think. Same here.
    1 point
  33. WildByDesign

    DwmColorBlurMica

    Did I ever mention that I hate making GUIs? 😁 But anyway, we are getting somewhere now... All of the Save and Delete rule functions are working now. I still have to deal with some DPI stuff closer to the completion of this. Right now I am working on the custom owner drawn statusbar with previous help from @pixelsearch. In addition, and to keep the GUI smaller and compact and tidy, I figured out how to add a fully functional (and transparent) combobox to the statusbar. This combobox (right now titled 'Startup Task') allows the user to easily install or uninstall the scheduled task and maybe some other task-related options if needed. The other status bar parts are not done yet but will likely have one for whether or not the task is running as Admin or not. Another part likely to show if the task is even running. I may not need all 4 parts yet but we'll see how it goes, one step at a time. The tricky part? Right now I have the GUI as a separate script file and therefore a separate binary from the main DwmColorBlurMica script. I did this to make it easier and less complex for me to create the GUI in the first place. I would like to merge the two scripts somehow soon. I would like it all in one binary. Running it with no command line args would start the GUI. Running with something like "DwmColorBlurMica -runengine" to run the coloring engine as a separate process. The reason is because I don't want to GUI process to slow down or interfere with the main coloring engine process because it needs the absolutely most priority for performance reasons. But I am not 100% sure that I will be capable of merging these two scripts now. I'll have to see once I finish the GUI. EDIT: I still have to fix the alignment of the Advanced group section and also add some tooltips in various areas.
    1 point
  34. Simply put, I want to move the mouse around desktop and windows that are open on it, and automate some tasks within those windows. Basic AutoIt/AHK-type stuff. Been doing it with LGS/Lua for years. Since latest Ninja update what previously worked no longer works. My guess is something to do with Ninja windows - it works in those using wpf (charts) and not in Control Center and DOMs (not wpf). Can send the mouse to them, but becomes 'stranded' once inside. Other functions still work (e.g. Windows shortcuts Ctrl+P etc,) just not mousemove once inside Annoying is a gross understatement
    1 point
  35. AutoIt is great but, there are things that AutoIt was never meant for. Like a fast ..anything. @jugador, do go and learn something else. That does not mean that you'll never code scripts again. It'll mean that you'll have more tools at your disposal
    1 point
  36. Something like this maybe?: $bValueSIZE = StringRegExpReplace($sValue, '(?m).*?exe\s*(\d+).*$', "$1")
    1 point
  37. Thank you so much. I forgot to close the group. That solved the issue for me.
    1 point
  38. ioa747

    _Msg

    _Msg($iUI, $sText, $sTitle = @ScriptName, $iTimeout = 3, $iOption = 0) Displays a message using different UI elements based on the specified $iUI parameter. ; https://www.autoitscript.com/forum/topic/212945-_msg/ #include <MsgBoxConstants.au3> #include <TrayConstants.au3> #include <AutoItConstants.au3> ; #FUNCTION# ==================================================================================================================== ; Name...........: _Msg ; Description....: Displays a message using different UI elements based on the specified $iUI parameter. ; Syntax.........: _Msg($iUI, $sText, $sTitle = @ScriptName, $iTimeout = 3, $iOption = 0) ; Parameters.....: $iUI - Specifies the UI element to use: ; 0 - Return - nothing ; 1 - ConsoleWrite ; 2 - MsgBox ; 3 - ToolTip ; 4 - TrayTip ; $sText - The message text to be displayed. ; $sTitle - [optional] The title of the UI element. (Default is @ScriptName) ; $iTimeout - [optional] Timeout in seconds for displaying the message. (Default is 3) ; $iOption - [optional] Options for MsgBox, ToolTip, and TrayTip. (Default is 0) ; Return values .: Success: No specific return value, function exits after display. ; Failure: None ; Example .......: _Msg(1, "Hello, this is a test message.", @ScriptName, 5) ; =============================================================================================================================== Func _Msg($iUI, $sText, $sTitle = Default, $iTimeout = 3, $iOption = 0) If $sTitle = Default Then $sTitle = @ScriptName Switch $iUI Case 0 ; ### 0 Return - Does nothing, just exits the function. Return Case 1 ; ### 1 ConsoleWrite ConsoleWrite($sTitle & ": " & $sText & @CRLF) Case 2 ; ### 2 MsgBox MsgBox($iOption, $sTitle, $sText, $iTimeout) Case 3 ; ### 3 ToolTip ToolTip($sText, Default, Default, $sTitle, $iOption) Sleep($iTimeout * 1000) ; ToolTip doesn't have built-in timeout, so we use Sleep ToolTip("") ; Clear the tooltip after the timeout Case 4 ; ### 4 TrayTip TrayTip($sTitle, $sText, $iTimeout, $iOption) Sleep($iTimeout * 1000) ; give time to display it Case Else ; ### Else case - Does nothing, just exits the function. Return EndSwitch EndFunc ;==>_Msg ; Example Usage of _Msg Function ; ### ConsoleWrite ############################################### ; ConsoleWrite Example _Msg(1, "This message appears in the AutoIt console.", "Console Output") ; ConsoleWrite Example - Information-sign icon consisting of an 'i' in a circle _Msg(1, "This is an informational message.", "> Info") ; ConsoleWrite Example - Stop-sign icon _Msg(1, "This is a error message.", "! Error") ; ConsoleWrite Example - Question-mark icon _Msg(1, "This is a question message.", "+ Question") ; ConsoleWrite Example - Exclamation-point icon _Msg(1, "This is a warning message.", "- Warning") ; ### MsgBox ############################################### ; MsgBox Example - Information-sign icon consisting of an 'i' in a circle _Msg(2, "This is an informational message box.", "Info", 3, $MB_ICONINFORMATION) ; MsgBox Example - Stop-sign icon _Msg(2, "This is a error message box.", "Error", 3, $MB_ICONERROR) ; MsgBox Example - Question-mark icon _Msg(2, "This is a question message box.", "Question", 3, $MB_ICONQUESTION) ; MsgBox Example - Exclamation-point icon _Msg(2, "This is a warning message box.", "Warning", 3, $MB_ICONWARNING) ; ### ToolTip ############################################### ; ToolTip Example - no icon _Msg(3, "This is a question ToolTip.", "noicon", 3, $TIP_NOICON) ; ToolTip Example - Information-sign icon consisting of an 'i' in a circle _Msg(3, "This is an informational ToolTip.", "Info", 3, $TIP_INFOICON) ; ToolTip Example - error icon _Msg(3, "This is a error ToolTip.", "Error", 3, $TIP_ERRORICON) ; ToolTip Example - Warning icon _Msg(3, "This is a warning ToolTip.", "Warning", 3, $TIP_WARNINGICON) ; ### TrayTip ############################################### ; TrayTip Example - no icon _Msg(4, "This is a question TrayTip.", "noicon", 3, $TIP_ICONNONE) ; TrayTip Example - Information-sign icon consisting of an 'i' in a circle _Msg(4, "This is an informational TrayTip.", "Info", 3, $TIP_ICONASTERISK) ; TrayTip Example - error icon _Msg(4, "This is a error TrayTip.", "Error", 3, $TIP_ICONHAND) ; TrayTip Example - Warning icon _Msg(4, "This is a warning TrayTip.", "Warning", 3, $TIP_ICONEXCLAMATION) ; ################################################## ; Return Example (does nothing visible) _Msg(0, "This message will not be displayed.", "No Output") ; MsgBox Example $iTimeout = 0 _Msg(2, "All message examples have been executed.", "Examples Finished", 0)
    1 point
  39. Same here Yes please, if you're allowed, then the 3rd script would be a better choice than the 1st one. Just try the change from script 1 to script 3 and if it doesn't work, maybe a Mod could help, thanks for that. By the way, at least 2 things will (or should) be changed in script 3 : 1) I'm gonna comment out very soon all 4 lines concerning $g_hbrush (better comment out than delete in this case) . These 4 lines are : ; Global $g_hBrush ; no need, as _GUICtrlStatusBar_SetBkColor() placed after _WinAPI_SetWindowTheme() does the job correctly ; $g_hBrush = _WinAPI_CreateSolidBrush($g_iBkColor) ; _WinAPI_DeleteObject($g_hBrush) ; _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $g_hBrush) ; backgound color Maybe you did notice that these 4 lines are not found in the script above ("Merging 2 WM_DRAWITEM functions to 1 - Forum .au3") and the display is still correct, as you kindly indicated in your last post. So why should we use a useless brush when it comes to painting the background of a status bar ? [ @argumentum answer could be : "because we want a different back color for each part of a multi part status bar" Honestly I like argumentum, he's always in a good mood and funny, no matter what his avatar shows ] 2) I'm not forgetting this, one of these days for sure Edit: both points 1) and 2) have been fixed in script 3
    1 point
  40. Here modern coding (removed useless code) : #include <WinAPISysWin.au3> #include <WinAPIConstants.au3> #include <GDIPlus.au3> #include <GuiComboBox.au3> #include <File.au3> #include <WindowsConstants.au3> #include <GuiConstants.au3> #include <ButtonConstants.au3> Opt("MustDeclareVars", True) Global Const $AC_SRC_ALPHA = 1 Example() Func Example() ; Load PNG file as GDI bitmap _GDIPlus_Startup() Local $sPngSrc = @ScriptDir & "\LaunchySkin.png" Local $hImage = _GDIPlus_ImageLoadFromFile($sPngSrc) ; Extract image width and height from PNG Local $iWidth = _GDIPlus_ImageGetWidth($hImage) Local $iHeight = _GDIPlus_ImageGetHeight($hImage) ; Create layered window Local $hGUI = GUICreate("", $iWidth, $iHeight, -1, -1, $WS_POPUP, $WS_EX_LAYERED) Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_UpdateLayeredWindowEx($hGUI, -1, -1, $hBitmap) ; Register notification messages GUIRegisterMsg($WM_NCHITTEST, WM_NCHITTEST) GUISetState() WinSetOnTop($hGUI, "", $WINDOWS_ONTOP) ; As per help file : ; When using $WS_EX_MDICHILD the position is relative to client area of the parent window. ; With $WS_EX_LAYERED it is possible to have a transparent picture on a background picture defined in the parent window. ; To have a transparent picture, create the GUI with the WS_EX_LAYERED extended style. ; The left-top pixel will be used as the transparency color. ; If several pictures are created the last picture defines the transparent color. GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI) GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, $iWidth, $iHeight) ; makes the whole child GUI transparent GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("Type the name of a file on" & @CR & "your desktop and press Enter", 50, 30, 140, 60) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) ; combo box listing all items on desktop Local $idCombo = GUICtrlCreateCombo("", 210, 30, 250, -1, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetFont($idCombo, 10) ; set default button for Enter key activation - renders outside GUI window Local $idButton = GUICtrlCreateButton("", 0, 0, 0, 0, $BS_DEFPUSHBUTTON) GUISetState() ; get list of files on desktop, show in combobox Local $aFileList = _FileListToArray(@DesktopDir), $sRun _ArraySort($aFileList, 0, 1) GUICtrlSetData($idCombo, _ArrayToString($aFileList, "|", 1)) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton $sRun = GUICtrlRead($idCombo) ExitLoop EndSwitch WEnd If $sRun And FileExists(@DesktopDir & "\" & $sRun) Then Beep(2000, 50) ShellExecute($sRun, "", @DesktopDir) EndIf _WinAPI_DeleteObject($hBitmap) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() EndFunc ;==>Example Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) Return $HTCAPTION EndFunc ;==>WM_NCHITTEST
    1 point
  41. Andreik

    GDI+ Transparency Mask

    As a request in this thread I wrote a small function to add a transparency mask to a bitmap. I post it here with an example, maybe someone else will need it. The function works with both 32/64 bit versions of AutoIt. #AutoIt3Wrapper_UseX64=y #include <GDIPlus.au3> #include <Memory.au3> $hMain = GUICreate('Transparency mask blending', 720, 400) $cPic = GUICtrlCreatePic('', 0, 0, 720, 400) GUISetState(@SW_SHOW, $hMain) _GDIPlus_Startup() $hDraw = _GDIPlus_BitmapCreateFromScan0(720, 400) $hBackground = _GDIPlus_ImageLoadFromFile('background.png') $hTree = _GDIPlus_ImageLoadFromFile('tree.png') $hMask = _GDIPlus_ImageLoadFromFile('mask.png') $hGraphics = _GDIPlus_ImageGetGraphicsContext($hDraw) $aDim = _GDIPlus_ImageGetDimension($hTree) $DrawWithMask = False AdlibRegister('Draw', 3000) Draw() Do Until GUIGetMsg() = -3 ; GUI_EVENT_CLOSE _GDIPlus_BitmapDispose($hDraw) _GDIPlus_ImageDispose($hBackground) _GDIPlus_ImageDispose($hTree) _GDIPlus_ImageDispose($hMask) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Func Draw() _GDIPlus_GraphicsClear($hGraphics) _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hBackground, 0, 0, 720, 400, 0, 0, 720, 400) If $DrawWithMask Then Local $hCloneTree = _GDIPlus_ImageClone($hTree) SetBitmapMask($hCloneTree, $hMask) _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hCloneTree, 0, 0, $aDim[0], $aDim[1], 550, 200, $aDim[0], $aDim[1]) _GDIPlus_ImageDispose($hCloneTree) Else _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hTree, 0, 0, $aDim[0], $aDim[1], 550, 200, $aDim[0], $aDim[1]) EndIf BitmapToCtrl($hDraw, $cPic) $DrawWithMask = Not $DrawWithMask EndFunc Func SetBitmapMask($hBitmap, $hMask) Local $aDim1 = _GDIPlus_ImageGetDimension($hBitmap) Local $aDim2 = _GDIPlus_ImageGetDimension($hMask) If $aDim1[0] <> $aDim2[0] Or $aDim1[1] <> $aDim1[1] Then Return SetError(1, 0, Null) Local $tBitmap = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aDim1[0], $aDim1[1], BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB) Local $tMask = _GDIPlus_BitmapLockBits($hMask, 0, 0, $aDim2[0], $aDim2[1], BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB) If @AutoItX64 Then Local $sCode = '0x56534C89C6BBFFFFFF00AD25000000FF211A09024883C204E2F05B5EC3' Else Local $sCode = '0x8B4C24048B7C24088B74240CBBFFFFFF00AD25000000FF211F090783C704E2F1C20C00' EndIf Local $dCode = Binary($sCode) Local $iCode = BinaryLen($dCode) Local $pCode = _MemVirtualAlloc(0, $iCode, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE) Local $tCode = DllStructCreate('byte Code[' & $iCode & ']', $pCode) $tCode.Code = $dCode Local $aCall = DllCallAddress('int', DllStructGetPtr($tCode), 'int', $aDim1[0] * $aDim1[1], 'ptr', $tBitmap.Scan0, 'ptr', $tMask.Scan0) _MemVirtualFree($pCode, $iCode, $MEM_DECOMMIT) _GDIPlus_BitmapUnlockBits($hBitmap, $tBitmap) _GDIPlus_BitmapUnlockBits($hMask, $tMask) Return $aDim1 EndFunc Func BitmapToCtrl($hBitmap, $cCtrl) Local Static $STM_SETIMAGE = 0x0172 $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _WinAPI_DeleteObject(GUICtrlSendMsg($cCtrl, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBITMAP)) _WinAPI_DeleteObject($hHBITMAP) EndFunc Resources used in this example can be downloaded at the link below (sorry for external link, my attachement quota is 100%). Credits for graphics resources goes to https://itch.io. Transparency Mask.zip
    1 point
  42. Hi Räuber @Hotzenplotz try this: #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPIConstants.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global Const $SC_DRAGMOVE = 0xF012 $hSplashlogo = _GDIPlus_ImageLoadFromFile("C:\Program Files (x86)\AutoIt3\Examples\GUI\Torus.png") $iw = _GDIPlus_ImageGetWidth($hSplashlogo) $ih = _GDIPlus_ImageGetHeight($hSplashlogo) $SplashGUIlogo = GUICreate("", $iw, $ih, -1, -1, $WS_POPUP, $WS_EX_LAYERED) _SetBitmap($SplashGUIlogo, $hSplashlogo, 255, $iw, $ih) $hGUI_c = GUICreate("Test", $iw, $ih, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $SplashGUIlogo) GUISetBkColor(0x123456, $hGUI_c) _WinAPI_SetLayeredWindowAttributes($hGUI_c, 0x123456) $idComboBox = GUICtrlCreateCombo("Item 1", $iw / 2 - 35, 20, 50, 20) GUICtrlSetData($idComboBox, "Item 2|Exit", "Item 2") $idButton_Close = GUICtrlCreateButton("X", $iw / 2 - 30, $ih - 60, 35, 25) $idLabel = GUICtrlCreateLabel("Test GUI", 0, $ih / 2 - 15, $iw - 20, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN)) GUICtrlSetBkColor(-1, 0x404040) GUICtrlSetColor(-1, 0xFFFFFF) GUISetState(@SW_SHOWNA, $SplashGUIlogo) GUISetState(@SW_SHOW, $hGUI_c) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idComboBox $sComboRead = GUICtrlRead($idComboBox) If $sComboRead = "Exit" Then ExitLoop EndSwitch WEnd GUIDelete($hGUI_c) GUIDelete($SplashGUIlogo) _GDIPlus_ImageDispose($hSplashlogo) _GDIPlus_Shutdown() Exit Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($SplashGUIlogo, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width = 200, $n_height = 200) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $n_width) DllStructSetData($tSize, "Y", $n_height) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_SetBitmap Should look like this:
    1 point
  43. Nothing special - just another analogue clock. -> Read https://en.wikipedia.org/wiki/Swiss_railway_clock for more information. Requires Windows7+ OS! Widget style GUI: ;The Hilfiker / MobaTime Swiss Railway Clock ;Coded by UEZ build 2019-07-07 ;Thanks to Eukalyptus for the _CreateBrushedAluminum() function! #pragma Compile(Icon, "GDI+ Swiss Railway Clock.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #AutoIt3Wrapper_UseX64=n Break(0) #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> ProcessSetPriority(@AutoItPID, $PROCESS_LOW) _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit Global $iW, $iH, $iX, $iY, $sTitle = "GDI+ Swiss Railway Clock v1.16" $iW = IniRead(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_Size", 200) $iW = $iW < 100 ? 100 : $iW > 800 ? 800 : $iW $iH = $iW $iX = IniRead(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_PosX", -1) $iY = IniRead(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_PosY", -1) Global Const $fRad = ACos(-1) / 180, $fDeg = 180 / ACos(-1), $iTimer = 30, $ULW_ALPHA = 2, $SC_DRAGMOVE = 0xF012, $fDeltaShadow = 20 Global $hBitmap, $hHBitmap, $hCanvas, $hBitmap_Clock, $hBrush_Shadow, $hBrush_Update, $hPen_Update, $fDiameter = $iW, $fShadowAngle, $fMin_next, _ $fRadius = $fDiameter / 2, $fSec, $fMin, $fHr, $fAmplitude = 3, $fSize, $hOld Global $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) $tSize.X = $iW $tSize.Y = $iH $tBlend.Alpha = 255 $tBlend.Format = 1 Global Const $hScrDC = _WinAPI_GetDC($hGUI), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) AutoItSetOption("GUIOnEventMode", 1) GDIPlus_SwissRailwayClockWidget() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_SwissRailwayClockWidget() $bExit = False $hGUI = GUICreate($sTitle, $iW, $iH, $iX, $iY, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) GUISetState(@SW_SHOW, $hGUI) ;create canvas elements $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW + $fDeltaShadow, $iH + $fDeltaShadow) $hCanvas = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local Const $iAlpha = 0x0D / $iW * 200 $hBrush_Shadow = _GDIPlus_BrushCreateSolid(BitShift(0x0D + $iAlpha, -24) + 0x202020) $hPen_Update = _GDIPlus_PenCreate(0xFFA02020) $hBrush_Update = _GDIPlus_BrushCreateSolid(0) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) $hBitmap_Clock = GenerateClockBg($fDiameter) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") $fMin_next = @MIN GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113 Local $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $hGUI, "uint_ptr", 1, "uint", $iTimer, "ptr", 0)[0] Do If $bExit Then ExitLoop Until Not Sleep(100) ;release resources GUIRegisterMsg($WM_TIMER, "") DllCall("user32.dll", "bool", "KillTimer", "hwnd", $hGUI, "uint_ptr", $iID) GUIRegisterMsg($WM_LBUTTONDOWN, "") _GDIPlus_PenDispose($hPen_Update) _GDIPlus_BrushDispose($hBrush_Shadow) _GDIPlus_BrushDispose($hBrush_Update) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_ImageDispose($hCanvas) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_DeleteDC($hMemDC) IniWrite(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_Size", WinGetPos($hGUI)[2]) IniWrite(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_PosX", WinGetPos($hGUI)[0]) IniWrite(@ScriptDir & "\GDI+ Swiss Railway Clock.ini", "Settings", "GUI_PosY", WinGetPos($hGUI)[1]) GUIDelete($hGUI) EndFunc ;==>GDIPlus_SwissRailwayClockWidget Func Draw($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GDIPlus_GraphicsClear($hCanvas, 0x00000000) _GDIPlus_GraphicsDrawImageRect($hCanvas, $hBitmap_Clock, 0, 0, $fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow) UpdateClock($hCanvas, $fDiameter) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hHBitmap) EndFunc ;==>Draw Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hGUI _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch EndFunc ;==>_WM_LBUTTONDOWN Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func UpdateClock($hGfx, $fDiameter) Static $bBounce = 0, $f = 0 Local $m1 = $fDiameter * 0.015 ;hour $fHr = 30 * (@HOUR + @MIN / 60) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fHr) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local $iWidth1 = $fDiameter * 0.0375, _ $iHeight1 = $fDiameter / 2.5, _ $iWidth12 = $iWidth1 / 2, _ $fPosY = $fDiameter * 0.2, $iWidth2, $iWidth22, $fPosY2 _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFF101010) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) ;~ DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ ;~ "float", $fRadius - $iWidth12, _ ;~ "float", $fPosY, _ ;~ "float", $iWidth1, "float", $iHeight1) Local $tPoints = DllStructCreate("float p[8]"), $factor = $iW / 160 ; 1----2 ; | | ; 4----3 ;1 $tPoints.p(1) = $fRadius - $iWidth12 $tPoints.p(2) = $fPosY ;2 $tPoints.p(3) = $tPoints.p(1) + $iWidth1 $tPoints.p(4) = $fPosY ;3 $tPoints.p(5) = $tPoints.p(3) + $factor $tPoints.p(6) = $fPosY + $iHeight1 ;4 $tPoints.p(7) = $tPoints.p(1) - $factor $tPoints.p(8) = $tPoints.p(6) DllCall($__g_hGDIPDll, "int", "GdipFillPolygon", "handle", $hGfx, "handle", $hBrush_Update, _ "struct*", $tPoints, "int", 4, "int", "FillModeAlternate") _GDIPlus_GraphicsResetTransform($hGfx) ;min If $fMin_next <> @MIN Then $bBounce = 1 Switch $bBounce Case 1 $fMin = (6 * Mod(($fMin_next + 1), 60)) + Sin($f * 1.9) * $fAmplitude If $fAmplitude = 0 Then $fMin_next = @MIN $f = 0 $fAmplitude = 3 $bBounce = 0 Else $fAmplitude -= 0.5 $fAmplitude = $fAmplitude <= 0 ? 0 : $fAmplitude $f += 1 EndIf Case Else $fMin = (6 * @MIN) EndSwitch _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fMin) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $iWidth1 = $fDiameter * 0.03 $iHeight1 = $fRadius $iWidth12 = $iWidth1 / 2 $fPosY = $fDiameter * 0.1 DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) ;~ DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ ;~ "float", $fRadius - $iWidth12, _ ;~ "float", $fPosY, _ ;~ "float", $iWidth1, "float", $iHeight1) ;1 $tPoints.p(1) = $fRadius - $iWidth12 $tPoints.p(2) = $fPosY ;2 $tPoints.p(3) = $tPoints.p(1) + $iWidth1 $tPoints.p(4) = $fPosY ;3 $tPoints.p(5) = $tPoints.p(3) + $factor $tPoints.p(6) = $fPosY + $iHeight1 ;4 $tPoints.p(7) = $tPoints.p(1) - $factor $tPoints.p(8) = $tPoints.p(6) DllCall($__g_hGDIPDll, "int", "GdipFillPolygon", "handle", $hGfx, "handle", $hBrush_Update, _ "struct*", $tPoints, "int", 4, "int", "FillModeAlternate") _GDIPlus_GraphicsResetTransform($hGfx) ;sec $fSec = 6 * (@SEC * 1.02564 + @MSEC / 1000) If $fSec >= 360 Then $fSec = 0 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fSec) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $fPosY = $fDiameter * 0.27 $fPosY2 = $fDiameter * 0.19 $iWidth1 = $fDiameter * 0.0095 $iHeight1 = $fRadius * 1.3 - $fPosY $iWidth12 = $iWidth1 / 2 $iWidth2 = $fDiameter * 0.083333 $iWidth22 = $iWidth2 / 2 ;shadow seconds DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth1 + $fDiameter * 0.006667, "float", $iHeight1 + $fDiameter * 0.006667) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth22 + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY2 + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth2, "float", $iWidth2) ;seconds _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFFC01010) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth22, _ "float", $fPosY2, _ "float", $iWidth2, "float", $iWidth2) _GDIPlus_GraphicsResetTransform($hGfx) ;button in the center DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) DllCall($__g_hGDIPDll, "int", "GdipDrawEllipse", "handle", $hGfx, "handle", $hPen_Update, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) EndFunc ;==>UpdateClock Func GenerateClockBg($fDiameter, $iBGColor = 0xF8FFFFFF) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap), _ $hBrush = _GDIPlus_BrushCreateSolid($iBGColor), $fBorderSize = $fDiameter * 0.03333, _ $hEffect = _GDIPlus_EffectCreateBlur($fDiameter / 50, 1), $hPen = _GDIPlus_PenCreate(0xA0000000, $fBorderSize) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4) Local Const $fSize = $fDiameter * 0.942 - $fBorderSize / 2 Local Const $hLBrush = _GDIPlus_LineBrushCreate($fBorderSize, $fBorderSize, $fSize, $fSize, 0xFCFFFFFF, 0xF8F0F0F0, 3) _GDIPlus_LineBrushSetSigmaBlend($hLBrush, 0.33333) _GDIPlus_LineBrushSetGammaCorrection($hLBrush) Local Const $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, -$fSize, -$fSize, True) _GDIPlus_MatrixRotate($hMatrix, 90, True) _GDIPlus_MatrixTranslate($hMatrix, $fSize, $fSize, True) _GDIPlus_LineBrushMultiplyTransform($hLBrush, $hMatrix, True) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_GraphicsFillEllipse($hGfx, $fBorderSize, $fBorderSize, $fSize, $fSize, $hLBrush) ;~ Local Const $hPath = _GDIPlus_PathCreate() ;~ _GDIPlus_PathAddEllipse($hPath, $fBorderSize, $fBorderSize, $fSize, $fSize) ;~ Local $hLBrush = _GDIPlus_PathBrushCreateFromPath($hPath) ;~ _GDIPlus_PathBrushSetCenterColor($hLBrush, 0xF8F0F0FF) ;~ _GDIPlus_PathBrushSetCenterPoint($hLBrush, $fSize * 0.70, $fSize * 0.70) ;~ _GDIPlus_PathBrushSetSurroundColor($hLBrush, 0xFBFFFFFF) ;~ _GDIPlus_PathBrushSetGammaCorrection($hLBrush, True) ;~ _GDIPlus_GraphicsFillPath($hGfx, $hPath, $hLBrush) ;~ _GDIPlus_PathDispose($hPath) Local $fShadow_vx = $fDiameter * 0.0095, $fShadow_vy = $fDiameter * 0.01 $fShadowAngle = ATan($fShadow_vy / $fShadow_vx) * $fDeg If $fShadow_vx < 0 And $fShadow_vy >= 0 Then $fShadowAngle += 180 If $fShadow_vx < 0 And $fShadow_vy < 0 Then $fShadowAngle -= 180 _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize + $fShadow_vx, $fBorderSize + $fShadow_vy, $fSize, $fSize, $hPen) _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect) _GDIPlus_BrushSetSolidColor($hBrush) _GDIPlus_PenSetColor($hPen, 0xF0000000) Local Const $hBitmap_Texture = _CreateBrushedAluminum($fDiameter, $fDiameter, $fShadowAngle) Local Const $hTexture = _GDIPlus_TextureCreate($hBitmap_Texture) DllCall($__g_hGDIPDll, "int", "GdipSetPenBrushFill", "ptr", $hPen, "ptr", $hTexture) _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize, $fBorderSize, $fSize, $fSize, $hPen) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, -6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local $iWidth1 = $fDiameter * 0.026667, $iHeight1 = $fDiameter / 10, $iWidth12 = $iWidth1 / 2, $fPosY = $fDiameter * 0.083333, _ $iWidth2 = $fDiameter * 0.013333, $iHeight2 = $fDiameter * 0.0416667, $iWidth22 = $iWidth2 / 2 For $i = 0 To 59 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, 6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Switch Mod($i, 5) Case 0 _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth12, $fPosY, $iWidth1, $iHeight1, $hBrush) Case Else _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth22, $fPosY, $iWidth2, $iHeight2, $hBrush) EndSwitch Next _GDIPlus_GraphicsResetTransform($hGfx) Local Const $hBitmap_Logo = _GDIPlus_BitmapCreateFromMemory(_Au3_Icon()) Local Const $hBitmap_Logo_Scaled = _GDIPlus_ImageResize($hBitmap_Logo, $fDiameter * 0.125, $fDiameter * 0.125) Local $aDim = _GDIPlus_ImageGetDimension($hBitmap_Logo_Scaled) _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap_Logo_Scaled, $fRadius - $aDim[0] / 2, $fRadius / 2, $aDim[0], $aDim[1]) _GDIPlus_ImageDispose($hBitmap_Logo) _GDIPlus_ImageDispose($hBitmap_Logo_Scaled) Local Const $hFamily = _GDIPlus_FontFamilyCreate("Segoe Script"), $hFont = _GDIPlus_FontCreate($hFamily, $fDiameter * 0.025), $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) _GDIPlus_BrushSetSolidColor($hBrush, 0xE0000000) _GDIPlus_GraphicsDrawStringEx($hGfx, "Clock coded by" & @CRLF & "UEZ", $hFont, _GDIPlus_RectFCreate($fRadius - $fRadius * 0.2, $fRadius + $fRadius * 0.2, $fRadius * 0.4, $fRadius * 0.4), $hFormat, $hBrush) _GDIPlus_ImageDispose($hBitmap_Texture) _GDIPlus_BrushDispose($hTexture) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_EffectDispose($hEffect) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hLBrush) _GDIPlus_GraphicsDispose($hGfx) Return $hBitmap EndFunc ;==>GenerateClockBg Func _CreateBrushedAluminum($iW, $iH, $fLightAngle = 40, $iBlurDist = 12, $fBlurTrans = 0.6666, $fRed = 0.8, $fGreen = 0.9, $fBlue = 1, $iLightColor = 0xF0FFFFFF, $fLightSigma = 0.5, $fLightScale = 0.83) ;coded by Eukalyptus! $iBlurDist = Ceiling($iBlurDist) $iBlurDist += 1 - Mod($iBlurDist, 2) Local $iOverSize = 0 For $i = 1 To $iBlurDist Step 2 $iOverSize += $i + $i + 1 Next Local $iWO = $iW + $iOverSize ;========================================= ; Add Noise ;========================================= Local $iNoiseSize = 40 Local $hBmp_Noise = _GDIPlus_BitmapCreateFromScan0($iNoiseSize, $iNoiseSize) Local $hGfx_Noise = _GDIPlus_ImageGetGraphicsContext($hBmp_Noise) Local $tData = _GDIPlus_BitmapLockBits($hBmp_Noise, 0, 0, $iNoiseSize, $iNoiseSize, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32ARGB) Local $iStride = DllStructGetData($tData, "Stride") Local $iWidth = DllStructGetData($tData, "Width") Local $iHeight = DllStructGetData($tData, "Height") Local $pScan0 = DllStructGetData($tData, "Scan0") Local $tPixel = DllStructCreate("dword[" & $iWidth * $iHeight & "];", $pScan0) Local $iAmp For $row = 0 To $iHeight - 1 For $col = 0 To $iWidth - 1 $iAmp = Random(0, 0xFF, 1) DllStructSetData($tPixel, 1, BitOR(0xFF000000, BitShift($iAmp, -16), BitShift($iAmp, -8), $iAmp), $row * $iWidth + $col + 1) Next Next _GDIPlus_BitmapUnlockBits($hBmp_Noise, $tData) ;========================================= ; Create Full NoiseBitmap ;========================================= Local $hBmp_Full = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full = _GDIPlus_ImageGetGraphicsContext($hBmp_Full) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $iXOff, $iYOff, $iSizeX, $iSizeY For $y = 0 To $iH Step $iNoiseSize / 2 For $x = 0 To $iWO Step $iNoiseSize / 2 $iXOff = Random(0, $iNoiseSize / 2, 1) $iYOff = Random(0, $iNoiseSize / 2, 1) $iSizeX = $iNoiseSize - $iXOff $iSizeY = $iNoiseSize - $iYOff _GDIPlus_GraphicsDrawImageRectRect($hGfx_Full, $hBmp_Noise, $iXOff, $iYOff, $iSizeX, $iSizeY, $x, $y, $iSizeX, $iSizeY) Next Next _GDIPlus_GraphicsDispose($hGfx_Noise) _GDIPlus_BitmapDispose($hBmp_Noise) ;========================================= ; MotionBlur ;========================================= Local $hBmp_Full2 = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full2 = _GDIPlus_ImageGetGraphicsContext($hBmp_Full2) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full2, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $tColorMatrix = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];") DllStructSetData($tColorMatrix, 1, 1, 1) DllStructSetData($tColorMatrix, 2, 1, 2) DllStructSetData($tColorMatrix, 3, 1, 3) DllStructSetData($tColorMatrix, 4, $fBlurTrans, 4) DllStructSetData($tColorMatrix, 5, 1, 5) Local $hImgAttrib = _GDIPlus_ImageAttributesCreate() DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) For $i = 1 To $iBlurDist Step 2 DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full2, "ptr", $hBmp_Full, _ "float", $i, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) If $i >= $iBlurDist Then DllStructSetData($tColorMatrix, 1, $fRed, 1) DllStructSetData($tColorMatrix, 2, $fGreen, 2) DllStructSetData($tColorMatrix, 3, $fBlue, 3) DllStructSetData($tColorMatrix, 4, 1, 4) DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) EndIf DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full, "ptr", $hBmp_Full2, _ "float", $i + 1, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) Next _GDIPlus_ImageAttributesDispose($hImgAttrib) _GDIPlus_GraphicsDispose($hGfx_Full2) _GDIPlus_BitmapDispose($hBmp_Full2) _GDIPlus_GraphicsDispose($hGfx_Full) ;========================================= ; Add Light ;========================================= Local $hBmp_Alu = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfx_Alu = _GDIPlus_ImageGetGraphicsContext($hBmp_Alu) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Alu, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Alu, 3) _GDIPlus_GraphicsDrawImage($hGfx_Alu, $hBmp_Full, -$iOverSize, 0) _GDIPlus_BitmapDispose($hBmp_Full) Local $tPointF1 = DllStructCreate("float; float;") Local $tPointF2 = DllStructCreate("float; float;") DllStructSetData($tPointF2, 2, $iH * $fLightScale) $aResult = DllCall($__g_hGDIPDll, "int", "GdipCreateLineBrush", "struct*", $tPointF1, "struct*", $tPointF2, "uint", 0, "uint", $iLightColor, "int", 0, "handle*", 0) If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False) Local $hBrush = $aResult[6] _GDIPlus_LineBrushSetSigmaBlend($hBrush, $fLightSigma) _GDIPlus_LineBrushSetGammaCorrection($hBrush) DllCall($__g_hGDIPDll, "int", "GdipRotateLineTransform", "ptr", $hBrush, "float", $fLightAngle, "int", 0) _GDIPlus_GraphicsFillRect($hGfx_Alu, 0, 0, $iW, $iH, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx_Alu) Return $hBmp_Alu EndFunc ;==>_CreateBrushedAluminum ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2018-02-02 Func _Au3_Icon($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Au3_Icon $Au3_Icon &= 'iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAP0ElEQVR4XtWZW4hs6VXHf+v79qWquruquqtvZ/r0uc8540yScTIQQ0JkDOYyGhIkhhAxxhdR8mDAgAg+6FsE9UVffNMH8S0ERAwS1DFeEo3m6owzmUySc+Zc+15VXZd9+dZyp6ro4pDTORlGIfnDn703TW/+//X9v/Wt3i3PPfccP85w/GhBgLqkS23ixhpRfau6bgItIPpRN5Ag0Xl88jYrxu/E+KA492E0vJd44d245BKQ/H8bkAe80wMOEE5HA5c8SpQ822yv/ubW9vnfffyxR3+vs7r6YcS9HewZnP9ZXPwE0Py/NuCBJj65iERvQPybcNFP4JKzuPgq+CeR6GnwV3FJB4juM+mSNj55Ehe97/LFC5947PL2ey5tb755daW1+fiVc295+qk3fuTShfPPPnb10d+J60sfI6o9BbRer4EIaOLis1Nh6dtBfs6ljY82ljqfiNLFX8X597uk/ksrG4/8ftJo/lq62P51XPQOJHoc3DV8egZYxLkLcW3xQ088fvWTj2ysXItjnxRlGY6Ojmxvb98iJwtnz6xeXO80tx+9tP0Rcf6tuHhzLuS1YwmJLiHuslRVbzQbjydJsrXSbl4RIVlpLZ0xM71+e+cbC41a+8zayuVxlo9CCP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uLQyR+Ucv80zs7ey+BbVVinIjUVpcXL816O82613Zd' $Au3_Icon &= 'gMTEOQcCqIo4RlkpVRu2Uk129w8DneWxeO9v3N79l+pCnuVfxvRfCdkLwIDXAPnSf33tU+fOnvktEXNFUUi1af3e3sHXNRQfA746P0+p4eJlxJ9D5I3OR09fPnfml6vD5m6rubCdRC4FAUDNdDTOe977ej2NUjOjdzxgNBwVh73h3/ooGXrvk2w8esE0PI9Nus11oM9rhHzhi//xtpXV1c+msW92uz0ODw6fA/1t4Es8GDEu3kDcFRclP6Ua2nGcbMdxvI4hzossLdQvAeRFeS/Liv00jddUtej2Bs9pKP4TDYdgOdBD3C4h2wcCrx1M/8kn7j2Y/gxwM03Tz2RZdouHo4GLOuA2EGliNBGpY3qM8+uAoeV3MBvjXBucTJ5dfIcwGgIGlIDxOjAx8DrhgQioEdUjxCmmEQDlaDATGTPF+JRKv24Dbp71GX9M8L84Jo46QVTs6gAAAABJRU5ErkJggg==' Local $bString = _WinAPI_Base64Decode($Au3_Icon) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\au3-icon2.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Au3_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 Download: GDI+ Swiss Railway Clock v1.16 (Widget).au3 GUI version (discontinued): ;the Hilfiker / MobaTime Swiss Railway Clock ;coded by UEZ build 2018-03-01 ;thanks to Eukalyptus for the _CreateBrushedAluminum() function! #Pragma Compile(Icon, "GDI+ Swiss Railway Clock.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #AutoIt3Wrapper_UseX64=n Break(0) #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> ProcessSetPriority(@AutoItPID, $PROCESS_LOW) _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit Global Const $iW = 512, $iH = $iW, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ Swiss Railway Clock v1.1" Global Const $fRad = ACos(-1) / 180, $fDeg = 180 / ACos(-1), $iTimer = 30, $fDeltaShadow = $iW * 0.020 Global $hDC, $hCanvas, $hBitmap_Clock, $hBrush_Shadow, $hBrush_Update, $hPen_Update, $fDiameter = $iW, $hDC_backbuffer, $fShadowAngle, $fMin_next, _ $fRadius = $fDiameter / 2, $fSec, $fMin, $fHr, $fAmplitude = 3 AutoItSetOption("GUIOnEventMode", 1) GDIPlus_SwissRailwayClock() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_SwissRailwayClock() $bExit = False $hGUI = GUICreate($sTitle, $iW + $fDeltaShadow, $iH + $fDeltaShadow, -1, -1, -1, $WS_EX_TOPMOST) GUISetBkColor(0xFFFFFF, $hGUI) GUISetState(@SW_SHOW, $hGUI) ;~ GUISetCursor(16, 1) ;create canvas elements $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW + $fDeltaShadow, $iH + $fDeltaShadow) $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) $hBrush_Shadow = _GDIPlus_BrushCreateSolid(0x14A0A0A0) $hPen_Update = _GDIPlus_PenCreate(0xFFA02020) $hBrush_Update = _GDIPlus_BrushCreateSolid(0) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) $fDiameter = $fDiameter < 128 ? 128 : $fDiameter > 1024 ? 1024 : $fDiameter $hBitmap_Clock = GenerateClockBg($fDiameter) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") $fMin_next = @MIN GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113 Local $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $hGUI, "uint_ptr", 1, "uint", $iTimer, "ptr", 0)[0] Do If $bExit Then ExitLoop Until Not Sleep(100) ;release resources GUIRegisterMsg($WM_TIMER, "") DllCall("user32.dll", "bool", "KillTimer", "hwnd", $hGUI, "uint_ptr", $iID) _GDIPlus_PenDispose($hPen_Update) _GDIPlus_BrushDispose($hBrush_Shadow) _GDIPlus_BrushDispose($hBrush_Update) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete($hGUI) EndFunc ;==>GDIPlus_SwissRailwayClock Func Draw($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GDIPlus_GraphicsDrawImageRect($hCanvas, $hBitmap_Clock, 0, 0, $fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow) UpdateClock($hCanvas, $fDiameter) _WinAPI_BitBlt($hDC, 0, 0, $iW + $fDeltaShadow, $iH + $fDeltaShadow, $hDC_backbuffer, 0, 0, $SRCCOPY) EndFunc Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func UpdateClock($hGfx, $fDiameter) Static $bBounce = 0, $f = 0 Local $m1 = $fDiameter * 0.015 ;hour $fHr = 30 * (@HOUR + @MIN / 60) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fHr) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local $iWidth1 = $fDiameter * 0.0375, _ $iHeight1 = $fDiameter / 2.5, _ $iWidth12 = $iWidth1 / 2, _ $fPosY = $fDiameter * 0.2, $iWidth2, $iWidth22, $fPosY2 _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFF101010) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) _GDIPlus_GraphicsResetTransform($hGfx) ;min If $fMin_next <> @MIN Then $bBounce = 1 Switch $bBounce Case 1 $fMin = (6 * Mod(($fMin_next + 1), 60)) + Sin($f * 1.9) * $fAmplitude If $fAmplitude = 0 Then $fMin_next = @MIN $f = 0 $fAmplitude = 3 $bBounce = 0 Else $fAmplitude -= 0.5 $fAmplitude = $fAmplitude <= 0 ? 0 : $fAmplitude $f += 1 EndIf Case Else $fMin = (6 * @MIN) EndSwitch _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fMin) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $iWidth1 = $fDiameter * 0.03 $iHeight1 = $fRadius $iWidth12 = $iWidth1 / 2 $fPosY = $fDiameter * 0.1 DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) _GDIPlus_GraphicsResetTransform($hGfx) ;sec $fSec = 6 * (@SEC * 1.02564 + @MSEC / 1000) If $fSec >= 360 Then $fSec = 0 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fSec) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $fPosY = $fDiameter * 0.27 $fPosY2 = $fDiameter * 0.19 $iWidth1 = $fDiameter * 0.0095 $iHeight1 = $fRadius * 1.3 - $fPosY $iWidth12 = $iWidth1 / 2 $iWidth2 = $fDiameter * 0.083333 $iWidth22 = $iWidth2 / 2 ;shadow seconds DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth1 + $fDiameter * 0.006667, "float", $iHeight1 + $fDiameter * 0.006667) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth22 + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY2 + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth2, "float", $iWidth2) ;seconds _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFFC01010) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth22, _ "float", $fPosY2, _ "float", $iWidth2, "float", $iWidth2) _GDIPlus_GraphicsResetTransform($hGfx) ;button in the center DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) DllCall($__g_hGDIPDll, "int", "GdipDrawEllipse", "handle", $hGfx, "handle", $hPen_Update, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) EndFunc Func GenerateClockBg($fDiameter) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap), _ $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000), $fBorderSize = $fDiameter * 0.03333, _ $hEffect = _GDIPlus_EffectCreateBlur($fDiameter / 50, 0), $hPen = _GDIPlus_PenCreate(0xA0000000, $fBorderSize) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4) _GDIPlus_GraphicsClear($hGfx, 0xFFFFFFFF) Local Const $fSize = $fDiameter * 0.95 - $fBorderSize / 2 Local $fShadow_vx = $fDiameter * 0.0095, $fShadow_vy = $fDiameter * 0.01 $fShadowAngle = ATan($fShadow_vy / $fShadow_vx) * $fDeg If $fShadow_vx < 0 And $fShadow_vy >= 0 Then $fShadowAngle += 180 If $fShadow_vx < 0 And $fShadow_vy < 0 Then $fShadowAngle -= 180 _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize + $fShadow_vx, $fBorderSize + $fShadow_vy, $fSize, $fSize, $hPen) _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect) _GDIPlus_PenSetColor($hPen, 0xF0000000) Local Const $hBitmap_Texture = _CreateBrushedAluminum($fDiameter, $fDiameter, $fShadowAngle) Local Const $hTexture = _GDIPlus_TextureCreate($hBitmap_Texture) DllCall($__g_hGDIPDll, "int", "GdipSetPenBrushFill", "ptr", $hPen, "ptr", $hTexture) _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize, $fBorderSize, $fSize, $fSize, $hPen) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, -6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local $iWidth1 = $fDiameter * 0.026667, $iHeight1 = $fDiameter / 10, $iWidth12 = $iWidth1 / 2, $fPosY = $fDiameter * 0.083333, _ $iWidth2 = $fDiameter * 0.013333, $iHeight2 = $fDiameter * 0.0416667, $iWidth22 = $iWidth2 / 2 For $i = 0 to 59 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, 6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Switch Mod($i, 5) Case 0 _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth12, $fPosY, $iWidth1, $iHeight1, $hBrush) Case Else _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth22, $fPosY, $iWidth2, $iHeight2, $hBrush) EndSwitch Next _GDIPlus_GraphicsResetTransform($hGfx) Local Const $hBitmap_Logo = _GDIPlus_BitmapCreateFromMemory(_Au3_Icon()) Local Const $hBitmap_Logo_Scaled = _GDIPlus_ImageResize($hBitmap_Logo, $fDiameter * 0.08, $fDiameter * 0.08) Local $aDim = _GDIPlus_ImageGetDimension($hBitmap_Logo_Scaled) _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap_Logo_Scaled, $fRadius - $aDim[0] / 2, $fRadius / 1.75, $aDim[0], $aDim[1]) _GDIPlus_ImageDispose($hBitmap_Logo) _GDIPlus_ImageDispose($hBitmap_Logo_Scaled) Local Const $hFamily = _GDIPlus_FontFamilyCreate("Segoe Script"), $hFont = _GDIPlus_FontCreate($hFamily, $fDiameter * 0.025), $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) ;~ _GDIPlus_BrushSetSolidColor($hBrush, 0xFF400000) _GDIPlus_GraphicsDrawStringEx($hGfx, "Clock by" & @CRLF & "UEZ", $hFont, _GDIPlus_RectFCreate($fRadius - $fRadius * 0.2, $fRadius + $fRadius * 0.2, $fRadius * 0.4, $fRadius * 0.4), $hFormat, $hBrush) _GDIPlus_ImageDispose($hBitmap_Texture) _GDIPlus_BrushDispose($hTexture) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_EffectDispose($hEffect) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx) Return $hBitmap EndFunc Func _CreateBrushedAluminum($iW, $iH, $fLightAngle = 40, $iBlurDist = 12, $fBlurTrans = 0.6666, $fRed = 0.8, $fGreen = 0.9, $fBlue = 1, $iLightColor = 0xF0FFFFFF, $fLightSigma = 0.5, $fLightScale = 0.83) ;coded by Eukalyptus! $iBlurDist = Ceiling($iBlurDist) $iBlurDist += 1 - Mod($iBlurDist, 2) Local $iOverSize = 0 For $i = 1 To $iBlurDist Step 2 $iOverSize += $i + $i + 1 Next Local $iWO = $iW + $iOverSize ;========================================= ; Add Noise ;========================================= Local $iNoiseSize = 40 Local $hBmp_Noise = _GDIPlus_BitmapCreateFromScan0($iNoiseSize, $iNoiseSize) Local $hGfx_Noise = _GDIPlus_ImageGetGraphicsContext($hBmp_Noise) Local $tData = _GDIPlus_BitmapLockBits($hBmp_Noise, 0, 0, $iNoiseSize, $iNoiseSize, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32ARGB) Local $iStride = DllStructGetData($tData, "Stride") Local $iWidth = DllStructGetData($tData, "Width") Local $iHeight = DllStructGetData($tData, "Height") Local $pScan0 = DllStructGetData($tData, "Scan0") Local $tPixel = DllStructCreate("dword[" & $iWidth * $iHeight & "];", $pScan0) Local $iAmp For $row = 0 To $iHeight - 1 For $col = 0 To $iWidth - 1 $iAmp = Random(0, 0xFF, 1) DllStructSetData($tPixel, 1, BitOR(0xFF000000, BitShift($iAmp, -16), BitShift($iAmp, -8), $iAmp), $row * $iWidth + $col + 1) Next Next _GDIPlus_BitmapUnlockBits($hBmp_Noise, $tData) ;========================================= ; Create Full NoiseBitmap ;========================================= Local $hBmp_Full = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full = _GDIPlus_ImageGetGraphicsContext($hBmp_Full) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $iXOff, $iYOff, $iSizeX, $iSizeY For $y = 0 To $iH Step $iNoiseSize / 2 For $x = 0 To $iWO Step $iNoiseSize / 2 $iXOff = Random(0, $iNoiseSize / 2, 1) $iYOff = Random(0, $iNoiseSize / 2, 1) $iSizeX = $iNoiseSize - $iXOff $iSizeY = $iNoiseSize - $iYOff _GDIPlus_GraphicsDrawImageRectRect($hGfx_Full, $hBmp_Noise, $iXOff, $iYOff, $iSizeX, $iSizeY, $x, $y, $iSizeX, $iSizeY) Next Next _GDIPlus_GraphicsDispose($hGfx_Noise) _GDIPlus_BitmapDispose($hBmp_Noise) ;========================================= ; MotionBlur ;========================================= Local $hBmp_Full2 = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full2 = _GDIPlus_ImageGetGraphicsContext($hBmp_Full2) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full2, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $tColorMatrix = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];") DllStructSetData($tColorMatrix, 1, 1, 1) DllStructSetData($tColorMatrix, 2, 1, 2) DllStructSetData($tColorMatrix, 3, 1, 3) DllStructSetData($tColorMatrix, 4, $fBlurTrans, 4) DllStructSetData($tColorMatrix, 5, 1, 5) Local $hImgAttrib = _GDIPlus_ImageAttributesCreate() DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) For $i = 1 To $iBlurDist Step 2 DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full2, "ptr", $hBmp_Full, _ "float", $i, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) If $i >= $iBlurDist Then DllStructSetData($tColorMatrix, 1, $fRed, 1) DllStructSetData($tColorMatrix, 2, $fGreen, 2) DllStructSetData($tColorMatrix, 3, $fBlue, 3) DllStructSetData($tColorMatrix, 4, 1, 4) DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) EndIf DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full, "ptr", $hBmp_Full2, _ "float", $i + 1, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) Next _GDIPlus_ImageAttributesDispose($hImgAttrib) _GDIPlus_GraphicsDispose($hGfx_Full2) _GDIPlus_BitmapDispose($hBmp_Full2) _GDIPlus_GraphicsDispose($hGfx_Full) ;========================================= ; Add Light ;========================================= Local $hBmp_Alu = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfx_Alu = _GDIPlus_ImageGetGraphicsContext($hBmp_Alu) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Alu, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) _GDIPlus_GraphicsDrawImage($hGfx_Alu, $hBmp_Full, -$iOverSize, 0) _GDIPlus_BitmapDispose($hBmp_Full) Local $tPointF1 = DllStructCreate("float; float;") Local $tPointF2 = DllStructCreate("float; float;") DllStructSetData($tPointF2, 2, $iH * $fLightScale) $aResult = DllCall($__g_hGDIPDll, "int", "GdipCreateLineBrush", "struct*", $tPointF1, "struct*", $tPointF2, "uint", 0, "uint", $iLightColor, "int", 0, "handle*", 0) If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False) Local $hBrush = $aResult[6] _GDIPlus_LineBrushSetSigmaBlend($hBrush, $fLightSigma) _GDIPlus_LineBrushSetGammaCorrection($hBrush) DllCall($__g_hGDIPDll, "int", "GdipRotateLineTransform", "ptr", $hBrush, "float", $fLightAngle, "int", 0) _GDIPlus_GraphicsFillRect($hGfx_Alu, 0, 0, $iW, $iH, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx_Alu) Return $hBmp_Alu EndFunc ;==>_CreateBrushedAluminum ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2018-02-02 Func _Au3_Icon($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Au3_Icon $Au3_Icon &= 'iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAP0ElEQVR4XtWZW4hs6VXHf+v79qWquruquqtvZ/r0uc8540yScTIQQ0JkDOYyGhIkhhAxxhdR8mDAgAg+6FsE9UVffNMH8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on) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\au3-icon2.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Au3_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 If you want to run in x64 mode please use AutoIt version 3.3.14.3 since the bug in function _GDIPlus_EffectCreate() has been fixed!
    1 point
  44. Here some useless graphical examples using GDI+, made for fun (my 1st GDI+ codes ): !Some examples may run slowly on WinXP machines (workaround in this thread)! Some examples using Hex() function need adjustment when running on AutoIt version 3.3.8.0+ otherwise colors are flashing (fixed versions in AiO package below)!!! #01 Flying Pearl Necklaces: Source code here (577 downloads previously)! Flying Pearl Necklaces.au3 #02 Flying Squares: Source code here (265 downloads previously)! Flying Squares.au3 #03 Rotating Squares: Source code here! Rotating_Squares.au3 #04 Plasma & Plasma Variant: Source codes here! Plasma: Plasma.au3 Plasma Variant: Plasma Variante.au3 #05 L-System Fractals: Source code here (382 downloads previously)! L-System Fractals.7z #06 Sinus Scroller: Source code here (218 downloads previously)! Sinus Scroller.au3 #07 Visualization: Analog Meter: download here (including source, needed files and compiled exe): Source code + needed files here (473 downloads previously)! Visualizer_Analog Meter.7z More GDI+ visualizations here by monoceres or by Eukalyptus Audio Visualization Collection (German site) #08 Particle Catapult: Source code here (70 downloads previously)! Particle_Catapult.au3 #09 Rotating Cube: Source code here (79 downloads previously)! Rotating_Cube.au3 #10 Simple Ball Collision Simulation: Source code here (35 downloads previously)! Simple_Ball_Collision_Simulation.au3 (it is not finished yet! look from time to time into this thread for an update! Nice tutorial here) #11 Particle Explosions: Source code here: Explosions__from_AutoIteroids_.au3 #12 Rotating Letters: Source codes here: Rotating Letters.au3 Transparent version (87 downloads previously): Rotating Letters Transparent.au3 #13 Rotating Cube 2: Source code here (53 downloads previously): Rotating Cube 2.au3 #14 Rotating Cube 2 with Textures: Source code here (68 downloads previously): Rotating Cube 2 + Textures.7z #15 Rotating Cube 2 with some examples from above on each surface: Source code here (55 downloads previously): Rotating Cube 2 + animated surfaces.7z #16 Rotating Cube 2 simple: Source code here: Rotating Cube 2 - Simple.au3 Or with background pic or Rotating Cube 2 simple + Background #17 Tramp of Particles: Source code here: Tramp of Particles.au3 #18 Twister: Source code here: Twister.au3 WinAPI version is 2.5x faster (look in AiO archive)! #19 Star Burst: Source code here: Star Burst.au3 #20 Warp Starfield: Source code here: Warp Starfield.au3 #21 Plasma 2: Source code here: Plasma 2.au3 #22 Isometric Level-3 Cube: Source code here: Isometric Level-3 Cube.au3 #23 Zoomer: Source code here (7 downloads previously): Zoomer.au3 GDIP.au3 needed for Zoomer! #24 Suspended Cloth Simulation: Source code here: Suspended Cloth Simulation.au3 #25 Visualizer: Oscilloscope Farbrausch: Source code here (30 downloads previously): Visualizer Oscilloscope Farbrausch.au3 To run Visualizer Oscilloscope Farbrausch.au3 properly you need following files: Bass.au3, BassExt.au3, Bass.dll and BassExt.dll. These files can be found in AiO package or on German AutoIt site! #26 Im- Exploding Particle Logo: Source code here: Im- Exploding Particle Logo.7z #27 Pixel Text Effect: Source code here (12 downloads previously): Pixel Text Effect.7z or with ♬chip sound♫ aka demo style (download from German AutoIt site or from AiO archive). #27 works best on Vista+ machines! #28 Star Wars Scroller: Source code here: Star Wars Scroller.au3 For a complete Star Wars Intro have a look to eukalyptus' Star-Wars Intro (see below!) #29 Rotated Letters Simple: Source code here: Rotated Letters Simple.au3 #30 Ballet of Letters: Source code here: Ballet of Letters.au3 #31 Perfect Illusion: Source code here: Perfect Illusion Variant 1.au3 Perfect Illusion Variant 2.au3 Perfect Illusion Variant 3.au3 Mesmerizing Squares Screensaver (previous downloads approx. 100): Mesmerizing_Squares_Screensaver.au3 (compiled version here): Don't stare too long on it or you will be mesmerized One more: Rotating triangle + vertical scroller + music (modification of monoceres' code): Magic Lines Screesaver (110 downloads previously): Magic Lines Screensaver.7z Another screensaver - 3D Star Scrolling Screensaver (83 downloads previously): GDI+ 3D Star Scrolling Screensaver.au3 !Some examples may run slowly on WinXP machines (workaround in this thread)! Some examples using Hex() function need adjustment when running on AutoIt version 3.3.8.0+ otherwise colors are flashing (fixed versions in AiO package below)!!! AiO download link ☞ AiO1 or AiO2 ☜ (all examples above compiled + source codes packed with 7-Zip) Have a look also to the game I made using GDI+: Link: AUTOITEROIDS v1.018 Build 2011-06-09 (Final) (a clone of the game Asteroids made by Atari 1979) I hope you like it! Any kind of comment is welcome!!! My examples are all done with AutoIt v3.3.0.0 on Vista x32! Kudos to: monoceres, smashly, malkey, Eukalyptus and Authenticity! Check out Some Graphical Examples using GDI+ Vol. II build 2016-01-25 More examples made by other members in this thread (thanks you very much!): Spinning Flying Pearl Necklaces by smashly: Spinning Flying Squares by smashly and ProgAndy LMP Visualization by youknowwho4eva: SineWorm by monoceres: Enterprise Warp by youknowwho4eva: Confused ASCII by monoceres: Lissajous Curve by monoceres: Butterfly Curve by monoceres: ParticleCollisionFun2 by crashdemons: Extreme nice physic engine by moritz1243 (German site): Lingering Line by MvGulik: Scroller Sine Blobs by Lakes: Cube surface and 3D axis and by Lakes: by eukalyptus: by eukalyptus: Two more examples by eukalyptus: and FEEL FREE TO POST YOUR GDI+ EXAMPLES HERE,TOO!!! Have fun and regards, UEZ ✌ PS: more modified examples also here in this topic History of my useless scripts above:
    1 point
  45. Playing around with this example (rainy day), if you can click on the moving text, you can then drag the screen-size transparent GUI. The label controls always move on, and relative to, the transparent GUI's position on the screen. Even though you can't see the transparent GUI, you can imagine where it is - in theory. ; https://www.autoitscript.com/forum/topic/184448-transparent-popup-gui-solved/?do=findComment&comment=1325725 #NoTrayIcon #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "Terminate") ; Even if this program's GUI does not have focus, this hotkey, "Esc", will end the script immediately. Local $hGui = GUICreate("trans", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED, $WS_EX_COMPOSITED)) GUISetBkColor(0xF1F1F1, $hGui) ;GUISetFont(24, 600) Local $idCtrlLabel = GUICtrlCreateLabel("This is text on a transparent Layered GUI", 0, 0, 800, 100, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetColor(-1, 0xFF0000) ; Set Text colour. GUICtrlSetFont(-1, 24, 600) Local $idCtrlLabel2 = GUICtrlCreateLabel("This text is on a different label on the same transparent layered GUI", 0, 0, 700, 80, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetColor(-1, 0x0000FF) ; Set Text colour. GUICtrlSetFont(-1, 18, 600) Local $aPosLabel = WinGetPos(GUICtrlGetHandle($idCtrlLabel)), $xDir = 1, $yDir = 1, $iSpeed = 5 _WinAPI_SetLayeredWindowAttributes($hGui, 0xF1F1F1, 250) GUISetState(@SW_SHOW, $hGui) Do ; A moving Label control on GUI. $aPosLabel[0] = ($xDir ? $aPosLabel[0] + $iSpeed : $aPosLabel[0] - $iSpeed) ; 'X' coordinate of Label. $aPosLabel[1] = ($yDir ? $aPosLabel[1] + $iSpeed : $aPosLabel[1] - $iSpeed) ; 'Y' coordinate of Label. $xDir = ($xDir ? ($aPosLabel[0] > @DesktopWidth - 700 ? 0 : 1) : ($aPosLabel[0] < 0 ? 1 : 0)) ; Change horiz. direction 700 from right side of screen, and, left side of screen. $yDir = ($yDir ? ($aPosLabel[1] > @DesktopHeight - 40 ? 0 : 1) : ($aPosLabel[1] < 0 ? 1 : 0)) ; Change vert. direction 40 up from bottom of screen, and, top of screen. GUICtrlSetPos($idCtrlLabel, $aPosLabel[0], $aPosLabel[1]) ; Reposition Label control. GUICtrlSetPos($idCtrlLabel2, $aPosLabel[0], @DesktopHeight - $aPosLabel[1] - 50) ; Reposition Label2 control. Sleep(10) Until GUIGetMsg() = $GUI_EVENT_CLOSE Func Terminate() Exit 0 EndFunc ;==>Terminate
    1 point
  46. Here is a small example (from @UEZ: #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> #include <StructureConstants.au3> #include <WinAPIConstants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global Const $SC_DRAGMOVE = 0xF012 Global $iW, $iH, $hImage, $hBitmap, $hGUI $hImage = _GDIPlus_BitmapCreateFromFile("C:\Program Files\AutoIt3\Examples\GUI\Torus.png") $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetState() _WinAPI_BitmapDisplayTransparentInGUI($hBitmap, $hGUI) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hBitmap) _GDIPlus_BitmapDispose($hImage) _GDIPlus_Shutdown() GUIDelete() Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Edit: after some changes (upgrades) you have to insert: #include <WinAPISysWin.au3> at top of script "#include section"
    1 point
  47. Looks really nice! If you replace the While - Wend with this and add Opt("GUIOnEventMode", 1) / GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <StaticConstants.au3> Global Const $AC_SRC_ALPHA = 1 Opt("GUIOnEventMode", 1) _GDIPlus_Startup() $pngSrc = @ScriptDir & "\GUIBK.png" ;This allows the png to be dragged by clicking anywhere on the main image. GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") $GUI = _GUICreate_Alpha("Look at the shiny", $pngSrc) $myGuiHandle = WinGetHandle("Look at the shiny") GUISetState() ;This is an invisible control container. You can create regular windows controls on this panel. $controlGui = GUICreate("ControlGUI", 400, 400, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $myGuiHandle) GUICtrlSetBkColor($controlGui, 0xFF00FF) GUICtrlSetState(-1, $GUI_DISABLE) ;This png is draggable as if it were a child window. It has about 50 pixels at the top that allow it to be dragged $TransparentButtonTest = GUICreate("Test321", 100, 100, -1, -1, $WS_EX_MDICHILD, $WS_EX_LAYERED, $myGuiHandle) $hImageButton = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Fav.png") SetBitMap($TransparentButtonTest, $hImageButton, 255) GUISetState() ;This png is static. It is in a fixed position relative to the main window png, and is dragged along with it. ;For fun, it fades out in cycles. $TransparentButtonTest2 = GUICreate("Test123", 250, 250, 400, 200,$WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $myGuiHandle) $hImageButton2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Windows.png") SetBitMap($TransparentButtonTest2, $hImageButton2, 255) GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $i = 0 Do $i += 2 If $i >= 255 Then $i = 0 $advMsg = GUIGetMsg(1) SetBitMap($TransparentButtonTest2, $hImageButton2, $i) Until Not Sleep(10) Func _Exit() _GDIPlus_Shutdown() Exit EndFunc Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($hwnd = WinGetHandle("Look at the shiny")) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndIf EndFunc Func _GUICreate_Alpha($sTitle, $sPath, $iX=-1, $iY=-1, $iOpacity=255) Local $hGUI, $hImage, $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hImage = _GDIPlus_ImageLoadFromFile($sPath) $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate($sTitle, $width, $height, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED) $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $width) DllStructSetData($tSize, "Y", $height) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 2) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hImage) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_GUICreate_Alpha Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap it will work as designed UEZ
    1 point
  48. andybiochem

    Stereograms!

    Hi! I studied stereograms (also known as Magic Eye pictures) back in GCSE art at high school. I always thought it'd be cool to write a program to render them - the theory is pretty straight forward - but because computers were pants back then (1995 - 1996), and I couldn't program at all, it was a non-starter. So tryin to teach myself multi-dimensional array use (I've been putting it off waaay too long), I've put together a script to create my own stereograms!!! Have fun!!! #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Opt("PixelCoordMode",2) ;************************************************************************************** ;GUI ;************************************************************************************** $GUI = GUICreate("", 819, 578, 195, 135) GUISetOnEvent($GUI_EVENT_CLOSE,"close") ;************************************************************************************** ; User ;************************************************************************************** ;----- Graphic control ----- $Image = "image.bmp" ; should be 800x500 black + white only. $Picture = GUICtrlCreatePic($Image,9,9,800,500) $Graphic = GUICtrlCreateGraphic(8, 8, 802, 502) GUICtrlSetBkColor(-1,0xFFFFFF) GUICtrlSetColor(-1,0x000000) ;----- buttons/input ----- GUICtrlCreateButton("GO", 190,544,170,25) GUICtrlSetOnEvent(-1,"_Create_Stereogram") GUICtrlSetFont(-1,15) GUICtrlCreateButton("Load Picture",8,544,170,25) GUICtrlSetOnEvent(-1,"Load_Pic") GUICtrlCreateLabel("Depth of field = ",8,523) $TotalDepthInput = GUICtrlCreateInput(20,90,520,30,20) $TypeCheckBox = GUICtrlCreateCheckbox("Use converge method",200,520,200,20) ;----- progress----- $Progress = GUICtrlCreateProgress(410,544,390,25) GUISetState(@SW_SHOW) ;###################################################################################### ; LOOP ;###################################################################################### While 1 Sleep(100) WEnd ;###################################################################################### ; END LOOP ;###################################################################################### Func Load_Pic() ;************************************************************************************** ; Load new picture ;************************************************************************************** ;----- renew graphic ----- GUICtrlDelete($graphic) $Graphic = GUICtrlCreateGraphic(8, 8, 802, 502) ;----- renew pic ----- $Image = FileOpenDialog("",".","Images (*.bmp;*.jpeg;*.jpg;*.gif)") If @error = 1 Then Return GUICtrlDelete($Picture) $Picture = GUICtrlCreatePic($Image,9,9,800,500) EndFunc Func _Create_Stereogram() ;************************************************************************************** ; Create Stereogram Map ;************************************************************************************** GUICtrlSetData($Progress,10) ;----- define noise block ----- Dim $aNoisePattern[801][501] For $x = 1 to 100 For $y = 1 to 500 $Col = 0xFFFFFF If Random(0,1,1) = 1 Then $Col = 0x000000 $aNoisePattern[$x][$y] = $Col Next Next For $Copy = 1 to 7 For $x = 1 to 100 For $y = 1 to 500 $aNoisePattern[$x + ($Copy * 100)][$y] = $aNoisePattern[$x][$y] Next Next Next GUICtrlSetData($Progress,20) ;----- Make profile ----- ; This creates a profile used to off-set the NoisePattern Dim $aProfilePattern[801][501] For $x = 1 to 800 For $y = 1 to 500 $aProfilePattern[$x][$y] = PixelGetColor($x + 9,$y + 9,$GUI) Next Next GUICtrlSetData($Progress,30) ;----- edit noise pattern ----- ; Decide on depth for each pixel (scale 1 to $TotalDepth) $TotalDepth = GUICtrlRead($TotalDepthInput) For $x = 1 to 800 For $y = 1 To 500 $cCol = BitAND($aProfilePattern[$x][$y],255) $aProfilePattern[$x][$y] = (($TotalDepth/255) * $cCol) if GUICtrlRead($TypeCheckBox) = 1 Then $aProfilePattern[$x][$y] = $TotalDepth - $aProfilePattern[$x][$y] Next Next ;----- Apply depth as off-set ----- $CriticalWidth = 100 For $x = $TotalDepth to 800 For $y = 1 to 500 $Offset = ($x - $aProfilePattern[$x][$y]) Do $aNoisePattern[$Offset][$y] = $aNoisePattern[$x][$y] $Offset += $CriticalWidth Until $Offset >= 800 Next Next GUICtrlSetData($Progress,40) ;----- draw edited noise blocks ----- For $x = 1 to 800 For $y = 1 to 500 GUICtrlSetGraphic($Graphic,$GUI_GR_COLOR,$aNoisePattern[$x][$y]) GUICtrlSetGraphic($graphic,$GUI_GR_PIXEL,$x,$y) Next GUICtrlSetData($Progress,40 + (($x/800) * 60)) Next GUICtrlSetData($Progress,100) ;----- Show stereogram ----- GUICtrlDelete($Picture) EndFunc Func close() ;************************************************************************************** ; Bye bye!! ;************************************************************************************** Exit EndFunc It only supports black + white images at the mo (must be in scriptdir), but I might add support for proper 3d grey-scale images soon. Feedback / criticism welcome!!! Attached is an example image to get you started. - "AutoIT Rocks" - Donut [EDIT] - Added support for 3d "Depth Map" images. - Added loading new pics without re-start - Added option to use cross-eyed "converge" mode, rather than "diverge" - Added option to change depth of field (try values up to 100 ish) Note - you can find depth map images on google. Go to google images and search for "Depth Map": http://images.google.co.uk/images?hl=en&am...mages&gbv=2 IMPORTANT::: After pressing the "GO!" button, do not open any windows over the GUI!!! The script uses PixelGetColor to interogate your depth map.
    1 point
×
×
  • Create New...