Jump to content

Recommended Posts

Posted

The issue in your case is that the functions are not running in a separate thread. That means _FileSearch and FileCopy will return when finished and thus will not get any information about the progress. What you can do is to use a generic animation without any display of the progress which must be called before the function.

You can do something like this here:

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <Timers.au3>
#include <WinAPIHObj.au3>
;#include-once <_GDIPlus_GearsAnim.au3>
;#include-once <_GDIPlus_CogWheels.au3>
;#include-once <_GDIPlus_CloudySpiral.au3>

_GDIPlus_Startup()
Global $hGUI = GUICreate("Search box", 300, 300)
Local $Button_1, $Button_2, $Button_3


GUISetState(@SW_SHOW, $hGUI)
Global $hHBmp_BG, $hB, $iSleep, $File1
Global Const $STM_SETIMAGE = 0x0172; $IMAGE_BITMAP = 0
Global $hGUI_Anim, $iW, $iH, $hPic, $fFontSize = 18, $aData

$Button_1 = GUICtrlCreateButton("Find file №1", 20, 20, 100, 100)
$Button_2 = GUICtrlCreateButton("Find file №2", 20, 140, 100, 100)
$Button_3 = GUICtrlCreateButton("Copy file", 140, 20, 100, 100)
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GDIPlus_Shutdown()
            ExitLoop
        Case $Button_1
            $iW = 500
            $iH = 250
            $iSleep = 40
            $hGUI_Anim = GUICreate("Gears Animation", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
            $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
            GUICtrlSetState(-1, $GUI_DISABLE)
            GUISetState(@SW_SHOWNA, $hGUI_Anim)
            _Timer_SetTimer($hGUI_Anim, $iSleep, "PlayAnim_Gears")
            Sleep(10000)
;~          $sPath1 = "D:"
;~          $sFileMask1 = "Test1.txt"
;~          $aReturn = _FileSearch($sPath1, $sFileMask1)
;~          $File1 = $aReturn[1]
;~          ConsoleWrite($File1 & @CR)
;~          ShellExecute($aReturn[1])
            _Timer_KillAllTimers($hGUI_Anim)
            _WinAPI_DeleteObject($hHBmp_BG)
            GUIDelete($hGUI_Anim)
            ; While looking for a file, I would like this (_GDIPlus_GearsAnim.au3) loading screen to work. But I don’t know how to do it.
        Case $Button_2
            $sPath2 = "H:"
            $sFileMask2 = "Test2.txt"
            $aReturn = _FileSearch($sPath2, $sFileMask2)
            $File2 = $aReturn[1]
            ConsoleWrite($File2 & @CR)
            ShellExecute($File2)
            ; While looking for a file №2, I would like this (_GDIPlus_CogWheels.au3) loading screen to work. But I don’t know how to do it.
        Case $Button_3
            $iW = 500
            $iH = 200
            $iSleep = 20
            $aData = InitTextBitmaps("Please wait", "Times New Roman", $fFontSize)
            $hGUI_Anim = GUICreate("Simple Loading Text Anim", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
            $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
            GUICtrlSetState(-1, $GUI_DISABLE)
            GUISetState(@SW_SHOWNA, $hGUI_Anim)
            GUIRegisterMsg($WM_TIMER, "PlayAnim_LoadingTextAnim")
            DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI_Anim, "int", 0, "int", $iSleep, "int", 0)
            Sleep(10000)
            $sPath2 = "H:"
;~          FileCopy($File1, $sPath2)
            GUIRegisterMsg($WM_TIMER, "")
            _Timer_KillAllTimers($hGUI_Anim)
            For $i = 0 To UBound($aData) - 1
                _GDIPlus_BitmapDispose($aData[$i][0])
            Next
            _WinAPI_DeleteObject($hHBmp_BG)
            GUIDelete($hGUI_Anim)
            ; While the file is being copied, I would like this (_GDIPlus_CloudySpiral.au3) loading screens to work. But I don’t know how to do it.
    EndSwitch
WEnd

Func _FileSearch($sPath, $sFileMask)
    Local $sOut = StringToBinary("0" & @CRLF, 2), $aOut
    Local $hDir = Run(@ComSpec & ' /U/C DIR "' & $sPath & '\' & $sFileMask & '" /S/B/A-D', @SystemDir, @SW_HIDE, 6)
    While 1
        $sOut &= StdoutRead($hDir, False, True)
        If @error Then ExitLoop
    WEnd

    $aOut = StringRegExp(BinaryToString($sOut, 2), "[^\r\n]+", 3)
    If @error Then Return SetError(1)

    $aOut[0] = UBound($aOut) - 1
    Global $IsOrNowFile = $aOut[0]
    Return $aOut
EndFunc   ;==>_FileSearch

;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Func PlayAnim_Gears($hWnd, $iMsg, $iIDTimer, $iTime)
    #forceref $hWnd, $iMsg, $iIDTimer, $iTime
    $hHBmp_BG = GearsAnim($iW, $iH)
    $hB = GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG)
    If $hB Then _WinAPI_DeleteObject($hB)
    _WinAPI_DeleteObject($hHBmp_BG)
EndFunc   ;==>PlayAnim

Func GearsAnim($iW, $iH, $sText = "Loading...", $fSpeed = 2, $bBgGradient = True, $bHBitmap = True)
    Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
    Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx, $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 + (@OSBuild > 5999))
    _GDIPlus_GraphicsSetTextRenderingHint($hGfx, $GDIP_TEXTRENDERINGHINT_ANTIALIAS)
    _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)
    If $bBgGradient Then
        Local Const $hBrush_Bg = _GDIPlus_LineBrushCreate(0, 0, $iW / 2, $iH / 2, 0xFF080808, 0xFF606060, 1)
        _GDIPlus_GraphicsFillRect($hGfx, 0, 0, $iW, $iH, $hBrush_Bg)
    EndIf

    Local Const $iW2 = $iW / 2, $iH2 = $iH / 2
    Local Const $hBrush = _GDIPlus_BrushCreateSolid(0)
    Local Static $f1 = 0, $f2 = 0, $f3 = 0, $f4 = 0, $c = 0, $iTeeth = 12
    Local $aGears[4], $i, $iW_Gear = 220, $iH_Gear = 150, $iW2_Gear = $iW_Gear / 2, $iH2_Gear = $iH_Gear / 2
    Local Const $hBitmap_Gear = _GDIPlus_BitmapCreateFromScan0($iW_Gear, $iH_Gear)
    Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap_Gear)
    _GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 + (@OSBuild > 5999))
    _GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)
    _GDIPlus_GraphicsClear($hCtxt, 0xFF121212)

    $aGears[0] = _GDIPlus_BitmapCreateGear($f1, $iTeeth / 2)
    _GDIPlus_GraphicsDrawImage($hCtxt, $aGears[0], 0, 1)
    $aGears[1] = _GDIPlus_BitmapCreateGear($f2, $iTeeth / 2)
    _GDIPlus_GraphicsDrawImage($hCtxt, $aGears[1], 51, 51)
    $aGears[2] = _GDIPlus_BitmapCreateGear($f3, $iTeeth / 2)
    _GDIPlus_GraphicsDrawImage($hCtxt, $aGears[2], 0, 101)
    $aGears[3] = _GDIPlus_BitmapCreateGear($f4, $iTeeth, 60, 48)
    _GDIPlus_GraphicsDrawImage($hCtxt, $aGears[3], 120, 4)

    _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap_Gear, $iW2 - $iW2_Gear, $iH2 - $iH2_Gear, $iW_Gear, $iH_Gear)

    $f1 -= $fSpeed
    $f2 += $fSpeed
    $f3 -= $fSpeed
    $f4 -= $fSpeed / 2

    Local $iC = Hex(Int(0x80 - Sin($c) * 0x7F), 2)
    $c += 0.025

    Local $hPath = _GDIPlus_PathCreate()

    If $sText Then
        _GDIPlus_BrushSetSolidColor($hBrush, "0x9F" & $iC & $iC & $iC)
        Local Const $hFamily = _GDIPlus_FontFamilyCreate("Arial Black"), $hFormat = _GDIPlus_StringFormatCreate()
        _GDIPlus_StringFormatSetAlign($hFormat, 1)
;~      _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
        Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH)
        $tLayout.Y = $iH2 + $iH2_Gear + 4
        _GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $iH / 10, $hFormat)
        _GDIPlus_GraphicsFillPath($hGfx, $hPath, $hBrush)
        _GDIPlus_PathReset($hPath)
    EndIf

    Local Const $iPenSize = 2

    Local $tRect = DllStructCreate("float X; float Y; float W; float H;")
    $tRect.W = $iW_Gear * 1.5
    $tRect.H = $iH_Gear
    Local $hBrush_outline = _GDIPlus_LineBrushCreateFromRectWithAngle($tRect, 0xFF202020, 0xFFA0A0A0, -210, True, 1)
    _GDIPlus_LineBrushSetSigmaBlend($hBrush_outline, 0, 1)

    Local Const $hPen = _GDIPlus_PenCreate2($hBrush_outline, $iPenSize)
    $iW2_Gear += $iPenSize / 2
    $iH2_Gear += $iPenSize / 2
    Local $aPoints[9][2] = [[8]], $iCorner = 5
    $aPoints[1][0] = $iW2 - $iW2_Gear + $iCorner
    $aPoints[1][1] = $iH2 - $iH2_Gear
    $aPoints[2][0] = $iW2 + $iW2_Gear - $iCorner
    $aPoints[2][1] = $iH2 - $iH2_Gear
    $aPoints[3][0] = $iW2 + $iW2_Gear
    $aPoints[3][1] = $iH2 - $iH2_Gear + $iCorner
    $aPoints[4][0] = $iW2 + $iW2_Gear
    $aPoints[4][1] = $iH2 + $iH2_Gear - $iCorner
    $aPoints[5][0] = $iW2 + $iW2_Gear - $iCorner
    $aPoints[5][1] = $iH2 + $iH2_Gear
    $aPoints[6][0] = $iW2 - $iW2_Gear + $iCorner
    $aPoints[6][1] = $iH2 + $iH2_Gear
    $aPoints[7][0] = $iW2 - $iW2_Gear
    $aPoints[7][1] = $iH2 + $iH2_Gear - $iCorner
    $aPoints[8][0] = $iW2 - $iW2_Gear
    $aPoints[8][1] = $iH2 - $iH2_Gear + $iCorner

    _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 0.025)
    _GDIPlus_GraphicsDrawPath($hGfx, $hPath, $hPen)

    _GDIPlus_PenDispose($hPen)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_BrushDispose($hBrush)
    If $bBgGradient Then _GDIPlus_BrushDispose($hBrush_Bg)
    _GDIPlus_BrushDispose($hBrush_outline)
    If $sText Then
        _GDIPlus_FontFamilyDispose($hFamily)
        _GDIPlus_StringFormatDispose($hFormat)
    EndIf
    For $i = 0 To 3
        _GDIPlus_BitmapDispose($aGears[$i])
    Next
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_BitmapDispose($hBitmap_Gear)
    _GDIPlus_GraphicsDispose($hGfx)

    If $bHBitmap Then
        Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
        _GDIPlus_BitmapDispose($hBitmap)
        Return $hHBITMAP
    EndIf
    Return $hBitmap
EndFunc   ;==>GearsAnim

Func _GDIPlus_BitmapCreateGear($fAngle = 0, $iTeeth = 6, $fRadius_outer = 30, $fRadius_inner = 18, $fTeethHeight = 10.5, $iColor1 = 0xFF606060, $iColor2 = 0xFF404040)
    Local Const $iW = 2 * $fRadius_outer + $fTeethHeight * 2, $iH = $iW, $iW2 = $iW / 2, $iH2 = $iW2, $fDeltaAngle = 360 / $iTeeth, $fDeg = 3.14159265358979 / 180
    Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
    Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx, $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 + (@OSBuild > 5999))

    Local $tRect = DllStructCreate("float X; float Y; float W; float H;")
    $tRect.W = $iW
    $tRect.H = $iH / 2
    Local $hBrush_outline = _GDIPlus_LineBrushCreateFromRectWithAngle($tRect, 0x44000000 + BitAND(0x00FFFFFF, $iColor2), 0, -90, True, 1)
    _GDIPlus_LineBrushSetSigmaBlend($hBrush_outline, 1, 0.95)
    _GDIPlus_LineBrushSetColors($hBrush_outline, 0, 0xAA989898)

    Local Const $hPen = _GDIPlus_PenCreate2($hBrush_outline, 2)
    Local Const $hBrush = _GDIPlus_BrushCreateSolid($iColor1)
    Local Const $hPath = _GDIPlus_PathCreate()
    _GDIPlus_PathAddEllipse($hPath, $iW2 - $fRadius_outer, $iH2 - $fRadius_outer, $fRadius_outer * 2, $fRadius_outer * 2)
    Local $aPoints[5][2] = [[4]], $iX, $iY, $i, $j
    For $i = 1 To $iTeeth
        $iX = $iW2 + Cos(($fAngle + 0) * $fDeg) * $fRadius_outer
        $iY = $iH2 + Sin(($fAngle + 0) * $fDeg) * $fRadius_outer
        For $j = 0 To $aPoints[0][0]
            $aPoints[1][0] = $iX + Cos(($fAngle + 45) * $fDeg) * $fTeethHeight
            $aPoints[1][1] = $iY + Sin(($fAngle + 45) * $fDeg) * $fTeethHeight
            $aPoints[2][0] = $iX + Cos(($fAngle + 135) * $fDeg) * $fTeethHeight
            $aPoints[2][1] = $iY + Sin(($fAngle + 135) * $fDeg) * $fTeethHeight
            $aPoints[3][0] = $iX + Cos(($fAngle + 225) * $fDeg) * $fTeethHeight
            $aPoints[3][1] = $iY + Sin(($fAngle + 225) * $fDeg) * $fTeethHeight
            $aPoints[4][0] = $iX + Cos(($fAngle + 315) * $fDeg) * $fTeethHeight
            $aPoints[4][1] = $iY + Sin(($fAngle + 315) * $fDeg) * $fTeethHeight
        Next
        _GDIPlus_PathAddPolygon($hPath, $aPoints)
        $fAngle += $fDeltaAngle
    Next
    _GDIPlus_PathWindingModeOutline($hPath)
    _GDIPlus_PathAddEllipse($hPath, $iW2 - $fRadius_inner, $iH2 - $fRadius_inner, $fRadius_inner * 2, $fRadius_inner * 2)
    _GDIPlus_GraphicsFillPath($hGfx, $hPath, $hBrush)
    _GDIPlus_GraphicsDrawPath($hGfx, $hPath, $hPen)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush_outline)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGfx)
    Return $hBitmap
EndFunc   ;==>_GDIPlus_BitmapCreateGear

;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Func PlayAnim_LoadingTextAnim()
    $hHBmp_BG = _GDIPlus_LoadingTextAnim($iW, $iH, $aData, $fFontSize)
    $hB = GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG)
    If $hB Then _WinAPI_DeleteObject($hB)
    _WinAPI_DeleteObject($hHBmp_BG)
EndFunc   ;==>PlayAnim

Func _GDIPlus_LoadingTextAnim($iW, $iH, ByRef $aCoords, $fFontSize, $sText = "LOADING", $bHBitmap = True)
    Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
    Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4 + (@OSBuild > 5999))
    _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4)
    _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)
    Local Const $iBGColor = 0x303030
    _GDIPlus_GraphicsClear($hGfx, 0xFF000000 + $iBGColor)
    Local Const $iStartX = 0, $iEndX = $iW, $fLength = ($iEndX - $iStartX), $fLength2 = $fLength / 2, _
                $iW2 = $iW / 2, $iH2 = $iH / 2, $fLeft = $iW2 - 70, $fRight = $iW2 + 30, $iSpeed = 6, _
                $fRL = 180 / ($fLeft / $iSpeed), $fRR = 180 / (($iW - $fRight) / $iSpeed), _
                $fAL = 0xFF / (($fLeft + $fFontSize) / $iSpeed), $fAR = 0xFF / (($iW - $fRight - $fFontSize) / $iSpeed)

    Local Const $hBrush_Alpha = _GDIPlus_BrushCreateSolid(0xFF000000 + $iBGColor)
    Local Static $x = 0, $i = 0
    Local $j, $iW_Char, $iH_Char, $hBmp, $hCtxt, $hMatrix, $iDX = 3
    For $j = 0 To UBound($aCoords) - 1
        $iW_Char = _GDIPlus_ImageGetWidth($aCoords[$j][0])
        $iH_Char = _GDIPlus_ImageGetHeight($aCoords[$j][0])
        $hBmp = _GDIPlus_BitmapCloneArea($aCoords[$j][0], 0, 0, $iW_Char, $iH_Char, $GDIP_PXF32ARGB)
        $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp)
        _GDIPlus_GraphicsClear($hCtxt, 0x00000000)

        $hMatrix = _GDIPlus_MatrixCreate()
        _GDIPlus_MatrixTranslate($hMatrix, $iW_Char / 2, $iH_Char / 2)
        _GDIPlus_MatrixRotate($hMatrix, -180 + $aCoords[$j][2])
        _GDIPlus_GraphicsSetTransform($hCtxt, $hMatrix)
        _GDIPlus_GraphicsDrawImageRect($hCtxt, $aCoords[$j][0], -$iW_Char / 2, -$iH_Char / 2, $iW_Char, $iH_Char)

        _GDIPlus_BrushSetSolidColor($hBrush_Alpha, Int($aCoords[$j][3]) * 0x1000000 + $iBGColor)

        _GDIPlus_GraphicsFillRect($hCtxt, -$iW_Char / 2, -$iH_Char / 2, $iW_Char, $iH_Char, $hBrush_Alpha)
        _GDIPlus_GraphicsDrawImage($hGfx, $hBmp, $aCoords[$j][1], $iH2 - $iH_Char / 2)
        _GDIPlus_MatrixDispose($hMatrix)
        _GDIPlus_GraphicsDispose($hCtxt)
        _GDIPlus_BitmapDispose($hBmp)

        If $aCoords[$j][1] > $fLeft And $aCoords[$j][1] < $fRight Then
            $aCoords[$j][1] += $iSpeed / 2
            $aCoords[$j][2] = -180
            $aCoords[$j][3] = 0x00
        Else
            If $aCoords[$j][1] < $fLeft And $aCoords[$j][1] > 0 Then
                $aCoords[$j][2] -= $fRL
                If $aCoords[$j][3] > $fAL Then $aCoords[$j][3] -= $fAL
            ElseIf $aCoords[$j][1] > $fRight Then
                $aCoords[$j][2] -= $fRR
                If ($aCoords[$j][3] - $fAR) < 0xFF Then $aCoords[$j][3] += $fAR
            EndIf
            $aCoords[$j][1] += $iSpeed
        EndIf
    Next
    If $aCoords[0][1] > $iW + $fFontSize * 4 Then
        For $j = 0 To UBound($aCoords) - 1
            $aCoords[$j][1] = -($fFontSize * ($iDX + 1) * UBound($aCoords) - 1) + $fFontSize * $iDX * ($j + 1)
            $aCoords[$j][2] = 0
            $aCoords[$j][3] = 0xFF
        Next
    EndIf

    _GDIPlus_BrushDispose($hBrush_Alpha)
    _GDIPlus_GraphicsDispose($hGfx)
    If $bHBitmap Then
        Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
        _GDIPlus_BitmapDispose($hBitmap)
        Return $hHBITMAP
    EndIf
    Return $hBitmap
EndFunc

Func InitTextBitmaps($sText, $sFont, $fFontSize)
    Local Const $aText = StringSplit($sText, "", 2)
    Local $aCoords[UBound($aText)][4]

    Local Const $hFamily = _GDIPlus_FontFamilyCreate($sFont)
    Local Const $hFont = _GDIPlus_FontCreate($hFamily, $fFontSize)
    Local Const $hFormat = _GDIPlus_StringFormatCreate()
    Local $tLayout = _GDIPlus_RectFCreate()
    Local Const $hDC = _WinAPI_GetWindowDC(0)
    Local Const $hDummy = _GDIPlus_GraphicsCreateFromHDC($hDC)
    Local Const $hBrush_Text = _GDIPlus_BrushCreateSolid(0xFF35C4F0)
    Local $i, $aInfo, $iW, $iH, $hCtxt, $hMatrix, $iDX = 3
    For $i = 0 To UBound($aCoords) - 1
        $aInfo = _GDIPlus_GraphicsMeasureString($hDummy, $aText[$i], $hFont, $tLayout, $hFormat)
        $iW = $aInfo[0].Width * 2
        $iH = $aInfo[0].Height * 2
        $aCoords[$i][0] = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
        $hCtxt = _GDIPlus_ImageGetGraphicsContext($aCoords[$i][0])
;~      _GDIPlus_GraphicsClear($hCtxt, 0xFF0000FF)
        _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 4 + (@OSBuild > 5999))
        _GDIPlus_GraphicsSetTextRenderingHint($hCtxt, 4)
        $aCoords[$i][1] = -($fFontSize * ($iDX + 1) * UBound($aCoords) - 1) + $fFontSize * $iDX * ($i + 1)
        $aCoords[$i][2] = 0
        $tLayout.X = $aInfo[0].Width / 2
        $tLayout.Y = $aInfo[0].Height / 8
        _GDIPlus_GraphicsDrawStringEx($hCtxt, $aText[$i], $hFont, $tLayout, $hFormat, $hBrush_Text)
        _GDIPlus_GraphicsDispose($hCtxt)
        $aCoords[$i][3] = 0xFF
    Next
    _GDIPlus_BrushDispose($hBrush_Text)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _WinAPI_DeleteObject($hDC)
    _GDIPlus_GraphicsDispose($hDummy)
    Return $aCoords
EndFunc

I hope it helps you a little bit...

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted
5 hours ago, UEZ said:

You can do something like this here:

I understand that autoit is a procedural language and that one function must end first, then another start. I tried somehow to link with the timer, but I didn't succeed. I tried to make a separate file.exe from the loading screen, but I don't really like the result. There is a difference in the response time of the function. In your version, everything happens synchronously. Thanks a lot for the tip. I will try to develop this idea further.
It is a pity that there is no option without a timer.

  • 3 months later...
Posted

hi Dear UEZ

i have a problem with _GDIPlus_LoadingSpinner.au3

when i use this example ,  spiner has freezed

...

SpinerLoaded()

DllCall("Rasapi32.dll", "dword", "RasDialW", "ptr", 0,"wstr",$sPhoneBook, "ptr",DllStructGetPtr($tRASDIAL_PARAMS), "dword", 0, "ptr", Null, "handle*", NULL)

SpinerOFF()

Posted
2 hours ago, Parsix said:

hi Dear UEZ

i have a problem with _GDIPlus_LoadingSpinner.au3

when i use this example ,  spiner has freezed

...

SpinerLoaded()

DllCall("Rasapi32.dll", "dword", "RasDialW", "ptr", 0,"wstr",$sPhoneBook, "ptr",DllStructGetPtr($tRASDIAL_PARAMS), "dword", 0, "ptr", Null, "handle*", NULL)

SpinerOFF()

Hi Parsix,

with this fragment it is very hard to understand why it freezes. Can you post the whole code?

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

  • 2 weeks later...
Posted

Hi Parsix,

I cannot test it properly because I get "Rasdial msg = 623". I assume to establish the Ras connectivity I need to run it with real credentials.

I suspect that the RasDialW call somehow blocks the SetTimer function, because the _LoadingScreen_Spinner function looks fine so far at first glance.

I don't know if it possible to run the animation in a separate thread...

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted
8 hours ago, UEZ said:

Hi Parsix,

I cannot test it properly because I get "Rasdial msg = 623". I assume to establish the Ras connectivity I need to run it with real credentials.

I suspect that the RasDialW call somehow blocks the SetTimer function, because the _LoadingScreen_Spinner function looks fine so far at first glance.

I don't know if it possible to run the animation in a separate thread...

RasDialA too

rasdialW call (and RasDialA)  blocks the SetTimer function

 

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...