-
Posts
7,312 -
Joined
-
Last visited
-
Days Won
76
UEZ last won the day on April 7 2024
UEZ had the most liked content!
About UEZ

- Birthday 12/03/2007
Profile Information
-
Member Title
Never say never
-
Location
Germany
-
Interests
Computer, watching movies, football (soccer), being lazy :-)
Recent Profile Visitors
UEZ's Achievements
-
CreateSemaphoreW and CreateFileMappingW in SciTE
UEZ replied to KaFu's topic in AutoIt General Help and Support
Maybe you can test singleton using Atom. -
jaberwacky reacted to a post in a topic: WebP v0.3.1 build 2022-06-18 beta
-
CreateSemaphoreW and CreateFileMappingW in SciTE
UEZ replied to KaFu's topic in AutoIt General Help and Support
Just wondering why API call is different when using Freebasic: 'Coded by UEZ build 2025-03-29 #include "windows.bi" 'https://learn.microsoft.com/de-de/windows/win32/api/winbase/nf-winbase-createsemaphorea Function _WinAPI_CreateSemaphore(sOccurrenceName As String, InitCount As Long = 0, MaxCount As Long = 1) As HANDLE Dim As HANDLE hSemaphore = CreateSemaphore(NULL, InitCount, MaxCount, sOccurrenceName) If GetLastError() = ERROR_ALREADY_EXISTS Then Return 0 If hSemaphore = 0 Then Return -1 Return hSemaphore End Function Dim As HANDLE hSemaphore = _WinAPI_CreateSemaphore("1a2b3c4d5e6f") If hSemaphore = 0 Then End MessageBox(0, "An occurrence of this app (x64 or x86) is already running! Exiting...", "ERROR", MB_OK Or MB_ICONSTOP Or MB_TOPMOST) MessageBox(0, "Started", "Information", MB_OK Or MB_TOPMOST Or MB_ICONINFORMATION) If hSemaphore > 0 Then ReleaseSemaphore(hSemaphore, 1, NULL) CloseHandle(hSemaphore) End If In FB I call the CreateSemaphore with the key whereas in Autoit the first call is empty. Any other call with the compiled exe regardless if it is x86 or x64 it will show the MsgBox. -
KaFu reacted to a post in a topic: CreateSemaphoreW and CreateFileMappingW in SciTE
-
CreateSemaphoreW and CreateFileMappingW in SciTE
UEZ replied to KaFu's topic in AutoIt General Help and Support
Hi KaFu, I now have a new notebook and have not looked into the problem since then because it works with ioa747's suggestion. Maybe I will make some tests. Btw, I have no problems with the CreateSemaphore code from post#1. Edit: still same problem with x86. #AutoIt3Wrapper_UseX64=n ShellExecute("C:\Users\Public\Desktop\Adobe Acrobat.lnk") -
TheSaint reacted to a post in a topic: PNG in GUI
-
NassauSky reacted to a post in a topic: Transparent Clock With Opaque Buttons
-
Transparent Clock With Opaque Buttons
UEZ replied to NassauSky's topic in AutoIt GUI Help and Support
Skinning the cat makes it ugly. 😉 _WinAPI_SetLayeredWindowAttributes($hGUI_Child, 0x123456, 0x60) makes the child GUI transparent, too. -
NassauSky reacted to a post in a topic: Transparent Clock With Opaque Buttons
-
Transparent Clock With Opaque Buttons
UEZ replied to NassauSky's topic in AutoIt GUI Help and Support
Use child GUI: ... Global Const $SC_DRAGMOVE = 0xF012 Global $iW = 300, $iH = 100, $hHBitmap Global $hGUI = GUICreate("Parent", $iW, $iH, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)), _ $hGUI_Child = GUICreate("", 30, 20, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI) Global $hButton = GUICtrlCreateButton("Test", 0, 0, 30, 20) GUICtrlSetBkColor($hButton, 0x000000) GUICtrlSetColor($hButton, 0x00FF00) GUISetBkColor(0x123456, $hGUI_Child) _WinAPI_SetLayeredWindowAttributes($hGUI_Child, 0x123456) GUISetState(@SW_SHOW, $hGUI_Child) GUISetState(@SW_SHOW, $hGUI) ... -
NassauSky reacted to a post in a topic: Is it possible to have a transparent BG when employing GDIPlus ?
-
DLLCall fails in AutoIt but works in VB6
UEZ replied to TimRude's topic in AutoIt General Help and Support
Interesting that the input string must be in that format. #include <Array.au3> #include <WinAPIDiag.au3> Local $sFilename = "c:\Test\MyTestFile.xyž" Local $aCall = DllCall("OleAut32.dll", "ptr", "SysAllocString", "wstr", $sFilename) $t = DllStructCreate("wchar p[" & StringLen($sFilename) & "]", $aCall[0]) _WinAPI_DisplayStruct($t) DllCall("OleAut32.dll", "none", "SysFreeString", "ptr", $aCall[0]) ž = 0000 0001 0111 1110 -> 1 126 Wondering why there is no API documentation... -
DLLCall fails in AutoIt but works in VB6
UEZ replied to TimRude's topic in AutoIt General Help and Support
Error 3221225477 is hex 0xC000005 which is an access violation. Without the possibility to test it with the DLL, it will be difficult to find the problem. -
DLLCall fails in AutoIt but works in VB6
UEZ replied to TimRude's topic in AutoIt General Help and Support
When I read the VB code, I understand that the length of the string will be written to dwOutSize variable. Passing $dwOutSize to the dll call make no sense because you pass a value, not the pointer to the variable. Can you test? $tLength = DllStructCreate("long dwOutSize") Local $aDllCallReturn = DllCall("XYZDECRYPT.DLL", "str", "DECRYPTXYZFILE", "str", $sFullFileName, "struct*", $tLength) ConsoleWrite($tLength.dwOutSize & @CRLF) -
It was more an information to M23 because of the embedded executable... These files can be found somewhere in this forum.
-
DLLCall fails in AutoIt but works in VB6
UEZ replied to TimRude's topic in AutoIt General Help and Support
dwOutSize As Long should be "long", $dwOutSize otherwise, if this is a pointer to a struct then try $dwOutSize = DllStructCreate("long dwOutSize") Local $aDllCallReturn = DllCall("XYZDECRYPT.DLL", "str", "DECRYPTXYZFILE", "str", $sFullFileName, "struct*", $dwOutSize) -
DeFlaaj reacted to a post in a topic: GDIPlus, need help with rotating an image
-
Xandy reacted to a post in a topic: GDI Plus Image Save to File
-
TheDcoder reacted to a post in a topic: Win11 Classic Start
-
Meanwhile also source codes will be classified as malware! Microsoft Defender Antivirus has detected malware or other potentially unwanted software. For more information please see the following: https://go.microsoft.com/fwlink/?linkid=37020&name=Trojan:AutoIt/Prcablt.SD!MTB&threatid=2147740918&enterprise=1 Name: Trojan:AutoIt/Prcablt.SD!MTB ID: 2147740918 Severity: Severe Category: Trojan Path: containerfile:_C:\Coding\AU3\Internet\Mp3SearchEngine\Mp3SearchEngine v1.0.8.8.au3; containerfile:_C:\Coding\AU3\Tools\WallpaperBank\WallpaperBank v1.0.2.0.au3; file:_C:\Coding\AU3\Internet\Mp3SearchEngine2\Mp3SearchEngine_v2.0.1.1.au3; file:_C:\Coding\AU3\Internet\Mp3SearchEngine\Mp3SearchEngine v1.0.8.8.au3->(UTF-8); file:_C:\Coding\AU3\SystemInfo\CompStats\Computer Stats Utility 2.0.2.0.au3; file:_C:\Coding\AU3\Tools\HTML Imager\HTML Imager v1.0.1.1.au3; file:_C:\Coding\AU3\Tools\HTML Imager\HTML Imager v1.0.1.2.au3; file:_C:\Coding\AU3\Tools\HTML Imager\HTML Imager v1.0.1.3.au3; file:_C:\Coding\AU3\Tools\ImageSplitter\ImageSplitter v1.0.0.7.au3; file:_C:\Coding\AU3\Tools\Mp3SearchEngine\Mp3SearchEngine v1.0.9.2.au3; file:_C:\Coding\AU3\Tools\WallpaperBank\WallpaperBank v1.0.2.0.au3->(UTF-8); Detection Origin: Local machine Detection Type: Concrete Detection Source: System User: NT AUTHORITY\SYSTEM Process Name: C:\Programme\Editor\Notepad3\Notepad3.exe Security intelligence Version: AV: 1.421.1531.0, AS: 1.421.1531.0, NIS: 1.421.1531.0 Engine Version: AM: 1.1.24090.11, NIS: 1.1.24090.11
-
SEKOMD reacted to a post in a topic: Move region - is it possible.. ? (created by _WinAPI_CreateRectRgn)
-
Something like that? #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WinAPIHObj.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WinAPIHObj.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <Timers.au3> $hGUI = GUICreate('Move region - is it possible.. ?', 600, 600) GUISetBkColor($COLOR_RED, $hGUI) GUISetState(@SW_SHOW, $hGUI) Global $x = 0, $y = 0, $iWidth = 80, $iHeight = 80 $hRgn1 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) Global $x = 120, $y = 120, $iWidth = 80, $iHeight = 80 $hRgn2 = _WinAPI_CreateRectRgn($x, $y, $x + $iWidth, $y + $iHeight) $hCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn1, 1) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn2, 3) _WinAPI_SetWindowRgn($hGUI, $hCombinedRgn) ;help me ;how to move region? ;ex. _WinAPI_MoveRgn ... (set new iX iY) ;ex. _WinAPI_RgnSetPos ... (set new iX iY) ;any ideas? Global $i, $tPAINTSTRUCT _Timer_SetTimer($hGUI, 10, "UpdateRegion") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _Timer_KillAllTimers($hGUI) _WinAPI_DeleteObject($hRgn1) _WinAPI_DeleteObject($hRgn2) _WinAPI_DeleteObject($hCombinedRgn) ExitLoop EndSwitch WEnd Func UpdateRegion($hWnd, $iMsg, $iIDTimer, $iTime) #forceref $hWnd, $iMsg, $iIDTimer, $iTime _WinAPI_OffsetRgn($hRgn2, Sin($i) * 10, Cos($i) * 10) $i += 0.1 $hCombinedRgn = _WinAPI_CreateRectRgn(0, 0, WinGetPos($hGUI)[2], WinGetPos($hGUI)[3]) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn1, 1) _WinAPI_CombineRgn($hCombinedRgn, $hCombinedRgn, $hRgn2, 3) _WinAPI_SetWindowRgn($hGUI, $hCombinedRgn) _WinAPI_DeleteObject($hCombinedRgn) EndFunc
-
Please help improve the function (_GDIPlus, draw text)
UEZ replied to SEKOMD's topic in AutoIt General Help and Support
You may try something like this here: ;Coded by UEZ #include <Constants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global Const $STM_SETIMAGE = 0x0172 _GDIPlus_Startup() Global $iW = 600, $iH = 400, $sText = @MSEC, $bHover = False, $iTimer = 30 Global $iBGColor = 0xFF808080, $iBtnBGColor = 0xFF1BA0E1 Global $hGUI = GUICreate("Test", $iW, $iH, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_THICKFRAME)) Global $idPic = GUICtrlCreatePic("", $iW / 4, $iH / 4, $iW / 2, $iH / 2) GUICtrlSetResizing(-1, $GUI_DOCKVCENTER + $GUI_DOCKHCENTER) GUISetBkColor(BitAND($iBGColor, 0xFFFFFF), $hGUI) Global $aSize = ControlGetPos($hGUI, "", $idPic) Global $aHBitmap = _GDIPlus_BitmapCreateRoundedButtonAndText($sText, $iW / 2, $iH / 2, $iBtnBGColor, $aSize[2] / 4, $iBGColor) Global $hB = GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $aHBitmap[0]) If $hB Then _WinAPI_DeleteObject($hB) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_TIMER, "Animate") Global $iID = DllCall("user32.dll", "uint_ptr", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iTimer, "int", 0)[0] While 1 If WinActive($hGUI) Then $aMouseInfo = GUIGetCursorInfo($hGUI) ;hover simulation Switch $aMouseInfo[4] Case $idPic $bHover = True Case Else $bHover = False EndSwitch EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE DllCall("user32.dll", "bool", "KillTimer", "hwnd", $hGUI, "uint_ptr", $iID) GUIRegisterMsg($WM_TIMER, "") GUIRegisterMsg($WM_SIZE, "") GUIRegisterMsg($WM_GETMINMAXINFO, "") _GDIPlus_Shutdown() GUIDelete() Exit Case $idPic GUIRegisterMsg($WM_TIMER, "") MsgBox($MB_TOPMOST, "Information", "Button pressed") GUIRegisterMsg($WM_TIMER, "Animate") EndSwitch WEnd Func Animate() $sText = @MSEC WM_SIZE($hGUI, 0, 0, 0) EndFunc Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) #forceref $Msg, $wParam, $lParam Local $aSize = ControlGetPos($hWnd, "", $idPic) Local $aHBitmap = _GDIPlus_BitmapCreateRoundedButtonAndText($sText, $aSize[2], $aSize[3], $iBtnBGColor, $aSize[2] / 4, $iBGColor) Local $hB = GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $bHover ? $aHBitmap[1] : $aHBitmap[0]) If $hB Then _WinAPI_DeleteObject($hB) _WinAPI_DeleteObject($aHBitmap[0]) _WinAPI_DeleteObject($aHBitmap[1]) Return "GUI_RUNDEFMSG" EndFunc Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam) Local $minmaxinfo = DllStructCreate("long ptReserved;long ptReserved;long ptMaxSizeX;long ptMaxSizeY;long ptMaxPositionX;long ptMaxPositionY;long ptMinTrackSizeX;long ptMinTrackSizeY;long ptMaxTrackSizeX;long ptMaxTrackSizeY", $lParam) With $minmaxinfo .ptMinTrackSizeX = 200 .ptMinTrackSizeY = 100 .ptMaxTrackSizeX = @DesktopWidth * 0.8 .ptMaxTrackSizeY = @DesktopHeight * 0.8 EndWith Return "GUI_RUNDEFMSG" EndFunc ;==>WM_GETMINMAXINFO ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_BitmapCreateRoundedButtonAndText ; Description ...: Draw rounded button ; Syntax ........: _GDIPlus_BitmapCreateRoundedButtonAndText($sString, $iWidth, $iHeight[, $iBgColor = 0xFF1BA0E1[, $iFontSize = 16[, $sFont = "Times New Roman"[, ; $iHoverColor = 0xFFC9388C[, $iFrameSize = 2[, $iFontFrameColor = 0x408AD5EA[, $iFontColor = 0xFFFFFFFF]]]]]]) ; Parameters ....: $sString - A string value. ; $iWidth - An integer value. ; $iHeight - An integer value. ; $iBgColor - [optional] An integer value. Default is 0xFF1BA0E1. ; $iFontSize - [optional] An integer value. Default is 16. ; $sFont - [optional] A string value. Default is "Times New Roman". ; $iBGGfx - [optional] An integer value. Default is 0xFFF0F0F0 ; $iHoverColor - [optional] An integer value. Default is 0xFFFFFFFF. ; $iFrameSize - [optional] An integer value. Default is 2. ; $iFontFrameColor - [optional] An integer value. Default is 0x408AD5EA. ; $iFontColor - [optional] An integer value. Default is 0xFFFFFFFF. ; Return values .: an array with 2 GDI bitmap handles -> [0]: default button, [1]: hover button ; Author ........: UEZ ; Version .......: 0.85 build 2025-01-14 ; Modified ......: ; Remarks .......: Dispose returned GDI bitmap handles when done ; Example .......: Yes ; =============================================================================================================================== Func _GDIPlus_BitmapCreateRoundedButtonAndText($sString, $iWidth, $iHeight, $iBgColor = 0xFF1BA0E1, $iFontSize = 16, $iBGGfx = 0xFFF0F0F0, $sFont = "Times New Roman", $iHoverColor = 0xFFFFFFFF, $iFrameSize = 2, $iFontFrameColor = 0x408AD5EA, $iFontColor = 0xFFFFFFFF) ;some checks If $sString = "" Then Return SetError(1, 0, 0) If Int($iWidth) < $iFrameSize * 2 Then Return SetError(2, 0, 0) If Int($iHeight) < $iFrameSize * 2 Then Return SetError(3, 0, 0) ;create font objects Local Const $hFormat = _GDIPlus_StringFormatCreate() Local Const $hFamily = _GDIPlus_FontFamilyCreate($sFont) Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iWidth, $iHeight) _GDIPlus_StringFormatSetAlign($hFormat, 1) ;center string on X axis _GDIPlus_StringFormatSetLineAlign($hFormat, 1) ;center string on Y axis ;create bitmap and graphics context handles Local Const $aBitmaps[2] = [_GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight), _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)] Local Const $aGfxCtxt[2] = [_GDIPlus_ImageGetGraphicsContext($aBitmaps[0]), _GDIPlus_ImageGetGraphicsContext($aBitmaps[1])] _GDIPlus_GraphicsClear($aGfxCtxt[0], $iBGGfx) _GDIPlus_GraphicsClear($aGfxCtxt[1], $iBGGfx) ;set drawing quality _GDIPlus_GraphicsSetSmoothingMode($aGfxCtxt[0], $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetSmoothingMode($aGfxCtxt[1], $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($aGfxCtxt[0], $GDIP_TEXTRENDERINGHINTANTIALIASGRIDFIT) ;define brush and pen objects Local Const $hBrushFontColor = _GDIPlus_BrushCreateSolid($iFontColor) Local Const $hPenFontFrameColor = _GDIPlus_PenCreate($iFontFrameColor, $iFrameSize), $hPenHoverColor = _GDIPlus_PenCreate($iHoverColor, $iFrameSize) ;create path object Local Const $hPath = _GDIPlus_PathCreate() ;create cloned path object for string measurement Local Const $hPath_Dummy = _GDIPlus_PathClone($hPath) _GDIPlus_PathAddString($hPath_Dummy, $sString, $tLayout, $hFamily, 0, $iFontSize, $hFormat) ;create rounded borders Local $fArcSize = $iWidth * 0.2 _GDIPlus_PathStartFigure($hPath) _GDIPlus_PathAddArc($hPath, $iFrameSize, $iHeight - $fArcSize - $iFrameSize, $fArcSize, $fArcSize, 180, -90) ;BR _GDIPlus_PathAddArc($hPath, $iWidth - $fArcSize - $iFrameSize, $iHeight - $fArcSize - $iFrameSize, $fArcSize, $fArcSize, -270, -90) ;BL _GDIPlus_PathAddArc($hPath, $iWidth - $fArcSize - $iFrameSize, $iFrameSize, $fArcSize, $fArcSize, 0, -90) ;TR _GDIPlus_PathAddArc($hPath, $iFrameSize, $iFrameSize, $fArcSize, $fArcSize, -90, -90) ;TL _GDIPlus_PathCloseFigure($hPath) Local Const $hPath_Clone = _GDIPlus_PathClone($hPath) ;needed to fill button background and border paint Local Const $hBrushBGColor = _GDIPlus_PathBrushCreateFromPath($hPath) _GDIPlus_PathBrushSetSurroundColor($hBrushBGColor, $iBgColor) _GDIPlus_PathBrushSetCenterColor($hBrushBGColor, 0xFFFFFFFF) _GDIPlus_PathBrushSetCenterPoint($hBrushBGColor, $iWidth / 2, $iHeight / 2) _GDIPlus_PathBrushSetSigmaBlend($hBrushBGColor, 1, 0.33333) _GDIPlus_GraphicsFillPath($aGfxCtxt[0], $hPath, $hBrushBGColor) _GDIPlus_GraphicsDrawPath($aGfxCtxt[0], $hPath, $hPenFontFrameColor) _GDIPlus_PathReset($hPath) ;add string to path _GDIPlus_PathAddString($hPath, $sString, $tLayout, $hFamily, 1, $iFontSize, $hFormat) ;clear bitmap and draw string _GDIPlus_GraphicsFillPath($aGfxCtxt[0], $hPath, $hBrushFontColor) _GDIPlus_GraphicsDrawPath($aGfxCtxt[0], $hPath, $hPenFontFrameColor) ;draw rectangle on cloned bitmap for hover effect _GDIPlus_GraphicsDrawImageRect($aGfxCtxt[1], $aBitmaps[0], 0, 0, $iWidth, $iHeight) _GDIPlus_GraphicsDrawPath($aGfxCtxt[1], $hPath_Clone, $hPenHoverColor) ;dispose object resources _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_PathDispose($hPath) _GDIPlus_PathDispose($hPath_Dummy) _GDIPlus_PathDispose($hPath_Clone) _GDIPlus_GraphicsDispose($aGfxCtxt[0]) _GDIPlus_GraphicsDispose($aGfxCtxt[1]) _GDIPlus_BrushDispose($hBrushFontColor) _GDIPlus_BrushDispose($hBrushBGColor) _GDIPlus_PenDispose($hPenFontFrameColor) _GDIPlus_PenDispose($hPenHoverColor) ;create GDI bitmap for later usage Local $aHBitmaps[2] = [_GDIPlus_BitmapCreateHBITMAPFromBitmap($aBitmaps[0]), _GDIPlus_BitmapCreateHBITMAPFromBitmap($aBitmaps[1])] ;dispose GDI+ bitmaps _GDIPlus_BitmapDispose($aBitmaps[0]) _GDIPlus_BitmapDispose($aBitmaps[1]) Return $aHBitmaps EndFunc ;==>_GDIPlus_BitmapCreateRoundedButtonAndText -
How to create rounded corners? (_GDIPlus)
UEZ replied to SEKOMD's topic in AutoIt General Help and Support
I modified one of my old script from 2014: ;Coded by UEZ #include <GUIConstantsEx.au3> #include <GDIPlus.au3> _GDIPlus_Startup() Global Const $STM_SETIMAGE = 0x0172 Global Const $hGUI = GUICreate("GDI+ Test", 200, 100) GUISetBkColor(0x505050) Global Const $iPicBtn = GUICtrlCreatePic("", 50, 28, 100, 44) Global $aButtons = _GDIPlus_BitmapCreateRoundedButtonAndText("install", 100, 44) _WinAPI_DeleteObject(GUICtrlSendMsg($iPicBtn, $STM_SETIMAGE, $IMAGE_BITMAP, $aButtons[0])) GUISetState() Global $aMouseInfo, $bShow = False, $bHide = False Do If WinActive($hGUI) Then $aMouseInfo = GUIGetCursorInfo($hGUI) ;hover simulation Switch $aMouseInfo[4] Case $iPicBtn _WinAPI_DeleteObject(GUICtrlSendMsg($iPicBtn, $STM_SETIMAGE, $IMAGE_BITMAP, $aButtons[1])) $bShow = True $bHide = False Case Else _WinAPI_DeleteObject(GUICtrlSendMsg($iPicBtn, $STM_SETIMAGE, $IMAGE_BITMAP, $aButtons[0])) $bHide = True $bShow = False EndSwitch EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _WinAPI_DeleteObject($aButtons[0]) _WinAPI_DeleteObject($aButtons[1]) _GDIPlus_Shutdown() Exit Case $iPicBtn MsgBox(0, "Information", "Button pressed") EndSwitch Until False ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_BitmapCreateRoundedButtonAndText ; Description ...: Draw rounded button ; Syntax ........: _GDIPlus_BitmapCreateRoundedButtonAndText($sString, $iWidth, $iHeight[, $iBgColor = 0xFF1BA0E1[, $iFontSize = 16[, $sFont = "Times New Roman"[, ; $iHoverColor = 0xFFC9388C[, $iFrameSize = 2[, $iFontFrameColor = 0x408AD5EA[, $iFontColor = 0xFFFFFFFF]]]]]]) ; Parameters ....: $sString - A string value. ; $iWidth - An integer value. ; $iHeight - An integer value. ; $iBgColor - [optional] An integer value. Default is 0xFF1BA0E1. ; $iFontSize - [optional] An integer value. Default is 16. ; $sFont - [optional] A string value. Default is "Times New Roman". ; $iHoverColor - [optional] An integer value. Default is 0xFFC9388C. ; $iFrameSize - [optional] An integer value. Default is 2. ; $iFontFrameColor - [optional] An integer value. Default is 0x408AD5EA. ; $iFontColor - [optional] An integer value. Default is 0xFFFFFFFF. ; Return values .: an array with 2 GDI bitmap handles -> [0]: default button, [1]: hover button ; Author ........: UEZ ; Version .......: 0.85 build 2025-01-12 ; Modified ......: ; Remarks .......: Dispose returned GDI bitmap handles when done ; Example .......: Yes ; =============================================================================================================================== Func _GDIPlus_BitmapCreateRoundedButtonAndText($sString, $iWidth, $iHeight, $iBgColor = 0xFF1BA0E1, $iFontSize = 16, $sFont = "Times New Roman", $iHoverColor = 0xF0FFFFFF, $iFrameSize = 2, $iFontFrameColor = 0x408AD5EA, $iFontColor = 0xFFFFFFFF) ;some checks If $sString = "" Then Return SetError(1, 0, 0) If Int($iWidth) < $iFrameSize * 2 Then Return SetError(2, 0, 0) If Int($iHeight) < $iFrameSize * 2 Then Return SetError(3, 0, 0) ;create font objects Local Const $hFormat = _GDIPlus_StringFormatCreate() Local Const $hFamily = _GDIPlus_FontFamilyCreate($sFont) Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iWidth, $iHeight) _GDIPlus_StringFormatSetAlign($hFormat, 1) ;center string on X axis _GDIPlus_StringFormatSetLineAlign($hFormat, 1) ;center string on Y axis ;create bitmap and graphics context handles Local Const $aBitmaps[2] = [_GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight), _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)] Local Const $aGfxCtxt[2] = [_GDIPlus_ImageGetGraphicsContext($aBitmaps[0]), _GDIPlus_ImageGetGraphicsContext($aBitmaps[1])] ;set drawing quality _GDIPlus_GraphicsSetSmoothingMode($aGfxCtxt[0], $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetSmoothingMode($aGfxCtxt[1], $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($aGfxCtxt[0], $GDIP_TEXTRENDERINGHINTANTIALIASGRIDFIT) ;define brush and pen objects Local Const $hBrushFontColor = _GDIPlus_BrushCreateSolid($iFontColor) ;, $hBrushBGColor = _GDIPlus_BrushCreateSolid($iBgColor) Local Const $hPenFontFrameColor = _GDIPlus_PenCreate($iFontFrameColor, $iFrameSize), $hPenHoverColor = _GDIPlus_PenCreate($iHoverColor, $iFrameSize) ;create path object Local Const $hPath = _GDIPlus_PathCreate() ;create cloned path object for string measurement Local Const $hPath_Dummy = _GDIPlus_PathClone($hPath) _GDIPlus_PathAddString($hPath_Dummy, $sString, $tLayout, $hFamily, 0, $iFontSize, $hFormat) _GDIPlus_PathStartFigure($hPath) Local $fArcSize = $iWidth * 0.33333 _GDIPlus_PathAddArc($hPath, $iFrameSize, $iHeight - $fArcSize - $iFrameSize, $fArcSize, $fArcSize, 180, -90) ;BR _GDIPlus_PathAddArc($hPath, $iWidth - $fArcSize - $iFrameSize, $iHeight - $fArcSize - $iFrameSize, $fArcSize, $fArcSize, -270, -90) ;BL _GDIPlus_PathAddArc($hPath, $iWidth - $fArcSize - $iFrameSize, $iFrameSize, $fArcSize, $fArcSize, 0, -90) ;TR _GDIPlus_PathAddArc($hPath, $iFrameSize, $iFrameSize, $fArcSize, $fArcSize, -90, -90) ;TL _GDIPlus_PathCloseFigure($hPath) Local Const $hPath_Clone = _GDIPlus_PathClone($hPath) Local Const $hBrushBGColor = _GDIPlus_PathBrushCreateFromPath($hPath) _GDIPlus_PathBrushSetSurroundColor($hBrushBGColor, $iBgColor) _GDIPlus_PathBrushSetCenterColor($hBrushBGColor, 0xFFFFFFFF) _GDIPlus_PathBrushSetCenterPoint($hBrushBGColor, $iWidth / 2, $iHeight / 2) _GDIPlus_PathBrushSetSigmaBlend($hBrushBGColor, 1, 0.33333) _GDIPlus_GraphicsFillPath($aGfxCtxt[0], $hPath, $hBrushBGColor) _GDIPlus_GraphicsDrawPath($aGfxCtxt[0], $hPath, $hPenFontFrameColor) _GDIPlus_PathReset($hPath) ;add string to path _GDIPlus_PathAddString($hPath, $sString, $tLayout, $hFamily, 1, $iFontSize, $hFormat) ;clear bitmap and draw string _GDIPlus_GraphicsFillPath($aGfxCtxt[0], $hPath, $hBrushFontColor) _GDIPlus_GraphicsDrawPath($aGfxCtxt[0], $hPath, $hPenFontFrameColor) ;draw rectangle on cloned bitmap for hover effect _GDIPlus_GraphicsDrawImageRect($aGfxCtxt[1], $aBitmaps[0], 0, 0, $iWidth, $iHeight) _GDIPlus_GraphicsDrawPath($aGfxCtxt[1], $hPath_Clone, $hPenHoverColor) ;dispose object resources _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_PathDispose($hPath) _GDIPlus_PathDispose($hPath_Dummy) _GDIPlus_PathDispose($hPath_Clone) _GDIPlus_GraphicsDispose($aGfxCtxt[0]) _GDIPlus_GraphicsDispose($aGfxCtxt[1]) _GDIPlus_BrushDispose($hBrushFontColor) _GDIPlus_BrushDispose($hBrushBGColor) _GDIPlus_PenDispose($hPenFontFrameColor) _GDIPlus_PenDispose($hPenHoverColor) ;create GDI bitmap for later usage Local $aHBitmaps[2] = [_GDIPlus_BitmapCreateHBITMAPFromBitmap($aBitmaps[0]), _GDIPlus_BitmapCreateHBITMAPFromBitmap($aBitmaps[1])] ;dispose GDI+ bitmaps _GDIPlus_BitmapDispose($aBitmaps[0]) _GDIPlus_BitmapDispose($aBitmaps[1]) Return $aHBitmaps EndFunc ;==>_GDIPlus_BitmapCreateRoundedButtonAndText -
How can my UDF find dependency DLLs
UEZ replied to emcodem's topic in AutoIt General Help and Support
Sorry, then I misunderstood your problem. As far as I understand your problem, RTFC's suggestion would be the best. There are a lot of portable programs with a setup routine.