freyaharts

splashcreen.au3 how to close and call/run my au3 script?

2 posts in this topic

#1 ·  Posted

i found amazing splash screen from here 

 

however theres no instruction how close it and run my .au3 it just splashing forever.. how can i set sleeptime how long it will run before it close and run my script?

 

heres the sample splash screen

 

;coded by UEZ build 2014-02-11, idea taken from http://codepen.io/MrHill/pen/KFusI
;AutoIt v3.3.9.21 or higher needed!
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

_GDIPlus_Startup()
Global Const $STM_SETIMAGE = 0x0172; $IMAGE_BITMAP = 0
Global $iW = 600, $iH = 320
Global Const $hGUI = GUICreate("Rotating Rectangles", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()

Global $hHBmp_BG, $hB, $iSleep = 5, $iPerc = 0

GUIRegisterMsg($WM_TIMER, "PlayAnim")
DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iSleep, "int", 0)

Do
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIRegisterMsg($WM_TIMER, "")
            _WinAPI_DeleteObject($hHBmp_BG)
            _GDIPlus_Shutdown()
            GUIDelete()
            Exit
    EndSwitch
Until False

Func PlayAnim()
    $hHBmp_BG = _GDIPlus_RotatingRectangles($iW, $iH, StringFormat("%05.2f %", $iPerc))
    $hB = GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG)
    If $hB Then _WinAPI_DeleteObject($hB)
    _WinAPI_DeleteObject($hHBmp_BG)
    $iPerc += 0.13
    If $iPerc > 99.9 Then $iPerc = 0
EndFunc   ;==>PlayAnim


Func _GDIPlus_RotatingRectangles($iW, $iH, $sText = "", $iRectangles = 3, $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)
    _GDIPlus_GraphicsClear($hGfx, 0xFF181818)

    Local Const $fDeg = 3.14159265358979 / 180, $iRadius = $iH / 6, $iRectSize = $iRadius / 3, $fDeltaAngle = 360 / $iRectangles, $iW2 = $iW / 2, $iH2 = $iH / 2
    Local Const $hBrush = _GDIPlus_BrushCreateSolid(0)
    Local Static $f = 0
    Local $i, $j, $aPoints[5][2] = [[4]], $iX, $iY, $fAngle = $f, $iR, $iG, $iB, $hPath, $hBrush_Glow, $hBmp, $hBmp_Ctxt
    For $i = 1 To $iRectangles
        $iR = Hex(0x80 + Int(Cos($fDeg * $f * 1.5) * 0x60), 2)
        $iG = Hex(0x80 + Int(Sin($fDeg * $f * 1.5) * 0x60), 2)
        $iB = "00"
        $iX = $iW2 + Cos(($fAngle + 0) * $fDeg) * $iRadius
        $iY = $iH2 + Sin(($fAngle + 0) * $fDeg) * $iRadius
        For $j = 0 To $aPoints[0][0]
            $aPoints[1][0] = $iX + Cos($fAngle * $fDeg) * $iRectSize
            $aPoints[1][1] = $iY + Sin($fAngle * $fDeg) * $iRectSize
            $aPoints[2][0] = $iX + Cos(($fAngle + 90) * $fDeg) * $iRectSize
            $aPoints[2][1] = $iY + Sin(($fAngle + 90) * $fDeg) * $iRectSize
            $aPoints[3][0] = $iX + Cos(($fAngle + 180) * $fDeg) * $iRectSize
            $aPoints[3][1] = $iY + Sin(($fAngle + 180) * $fDeg) * $iRectSize
            $aPoints[4][0] = $iX + Cos(($fAngle + 270) * $fDeg) * $iRectSize
            $aPoints[4][1] = $iY + Sin(($fAngle + 270) * $fDeg) * $iRectSize
        Next
        $hPath = _GDIPlus_PathCreate()
        _GDIPlus_PathAddEllipse($hPath, 0, 0, $iRectSize * 6, $iRectSize * 6)
        $hBrush_Glow = _GDIPlus_PathBrushCreateFromPath($hPath)
        _GDIPlus_PathBrushSetCenterColor($hBrush_Glow, "0x38" & $iR & $iG & $iB)
        _GDIPlus_PathBrushSetCenterPoint($hBrush_Glow, $iRectSize * 3, $iRectSize * 3)
        _GDIPlus_PathBrushSetSurroundColor($hBrush_Glow, 0x00000000)
        _GDIPlus_PathBrushSetGammaCorrection($hBrush_Glow, True)
        $hBmp = _GDIPlus_BitmapCreateFromScan0($iRectSize * 6, $iRectSize * 6)
        $hBmp_Ctxt = _GDIPlus_ImageGetGraphicsContext($hBmp)
        _GDIPlus_GraphicsFillPath($hBmp_Ctxt, $hPath, $hBrush_Glow)
        _GDIPlus_BrushDispose($hBrush_Glow)
        _GDIPlus_PathDispose($hPath)
        _GDIPlus_GraphicsDrawImageRect($hGfx, $hBmp, $iX - $iRectSize * 3, $iY - $iRectSize * 3, $iRectSize * 6, $iRectSize * 6)
        _GDIPlus_BrushDispose($hBrush_Glow)
        _GDIPlus_GraphicsDispose($hBmp_Ctxt)
        _GDIPlus_BitmapDispose($hBmp)

        _GDIPlus_BrushSetSolidColor($hBrush, "0xFF" & $iR & $iG & $iB)
        _GDIPlus_GraphicsFillPolygon($hGfx, $aPoints, $hBrush)
        $fAngle += $fDeltaAngle
    Next

    $f += 3
    _GDIPlus_BrushSetSolidColor($hBrush, 0xA0FFFFFF)
    $hPath = _GDIPlus_PathCreate()
    Local Const $hFamily = _GDIPlus_FontFamilyCreate("Arial"), $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH)
    _GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $iH / 32, $hFormat)
    _GDIPlus_GraphicsFillPath($hGfx, $hPath, $hBrush)

    _GDIPlus_PathDispose($hPath)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_GraphicsDispose($hGfx)

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

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Something like this here!?

;coded by UEZ build 2014-02-11, idea taken from http://codepen.io/MrHill/pen/KFusI
;AutoIt v3.3.9.21 or higher needed!
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

_GDIPlus_Startup()
Global Const $STM_SETIMAGE = 0x0172; $IMAGE_BITMAP = 0
Global $iW = 600, $iH = 320
Global Const $hGUI = GUICreate("Rotating Rectangles", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()

Global $hHBmp_BG, $hB, $iSleep = 5, $iPerc = 0, $bLoaded = False

GUIRegisterMsg($WM_TIMER, "PlayAnim")
DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iSleep, "int", 0)

Do
    If $bLoaded Then ExitLoop
Until Not Sleep(100)

MsgBox(0, "Test", "Start your code here!", 60)


Func PlayAnim()
    $hHBmp_BG = _GDIPlus_RotatingRectangles($iW, $iH, StringFormat("%05.2f %", $iPerc))
    $hB = GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG)
    If $hB Then _WinAPI_DeleteObject($hB)
    _WinAPI_DeleteObject($hHBmp_BG)
    $iPerc += 0.26
    If $iPerc > 99.9 Then
        GUIRegisterMsg($WM_TIMER, "")
        $hHBmp_BG = _GDIPlus_RotatingRectangles($iW, $iH, StringFormat("%05.2f %", 100))
        $hB = GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG)
        If $hB Then _WinAPI_DeleteObject($hB)
        _WinAPI_DeleteObject($hHBmp_BG)
        _GDIPlus_Shutdown()
        For $i = 255 To 0 Step -8
            If $i > -1 Then WinSetTrans($hGUI, "", $i)
            Sleep(10)
        Next
        GUIDelete()
        $bLoaded = True
    EndIf
EndFunc   ;==>PlayAnim


Func _GDIPlus_RotatingRectangles($iW, $iH, $sText = "", $iRectangles = 3, $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)
    _GDIPlus_GraphicsClear($hGfx, 0xFF181818)

    Local Const $fDeg = 3.14159265358979 / 180, $iRadius = $iH / 6, $iRectSize = $iRadius / 3, $fDeltaAngle = 360 / $iRectangles, $iW2 = $iW / 2, $iH2 = $iH / 2
    Local Const $hBrush = _GDIPlus_BrushCreateSolid(0)
    Local Static $f = 0
    Local $i, $j, $aPoints[5][2] = [[4]], $iX, $iY, $fAngle = $f, $iR, $iG, $iB, $hPath, $hBrush_Glow, $hBmp, $hBmp_Ctxt
    For $i = 1 To $iRectangles
        $iR = Hex(0x80 + Int(Cos($fDeg * $f * 1.5) * 0x60), 2)
        $iG = Hex(0x80 + Int(Sin($fDeg * $f * 1.5) * 0x60), 2)
        $iB = "00"
        $iX = $iW2 + Cos(($fAngle + 0) * $fDeg) * $iRadius
        $iY = $iH2 + Sin(($fAngle + 0) * $fDeg) * $iRadius
        For $j = 0 To $aPoints[0][0]
            $aPoints[1][0] = $iX + Cos($fAngle * $fDeg) * $iRectSize
            $aPoints[1][1] = $iY + Sin($fAngle * $fDeg) * $iRectSize
            $aPoints[2][0] = $iX + Cos(($fAngle + 90) * $fDeg) * $iRectSize
            $aPoints[2][1] = $iY + Sin(($fAngle + 90) * $fDeg) * $iRectSize
            $aPoints[3][0] = $iX + Cos(($fAngle + 180) * $fDeg) * $iRectSize
            $aPoints[3][1] = $iY + Sin(($fAngle + 180) * $fDeg) * $iRectSize
            $aPoints[4][0] = $iX + Cos(($fAngle + 270) * $fDeg) * $iRectSize
            $aPoints[4][1] = $iY + Sin(($fAngle + 270) * $fDeg) * $iRectSize
        Next
        $hPath = _GDIPlus_PathCreate()
        _GDIPlus_PathAddEllipse($hPath, 0, 0, $iRectSize * 6, $iRectSize * 6)
        $hBrush_Glow = _GDIPlus_PathBrushCreateFromPath($hPath)
        _GDIPlus_PathBrushSetCenterColor($hBrush_Glow, "0x38" & $iR & $iG & $iB)
        _GDIPlus_PathBrushSetCenterPoint($hBrush_Glow, $iRectSize * 3, $iRectSize * 3)
        _GDIPlus_PathBrushSetSurroundColor($hBrush_Glow, 0x00000000)
        _GDIPlus_PathBrushSetGammaCorrection($hBrush_Glow, True)
        $hBmp = _GDIPlus_BitmapCreateFromScan0($iRectSize * 6, $iRectSize * 6)
        $hBmp_Ctxt = _GDIPlus_ImageGetGraphicsContext($hBmp)
        _GDIPlus_GraphicsFillPath($hBmp_Ctxt, $hPath, $hBrush_Glow)
        _GDIPlus_BrushDispose($hBrush_Glow)
        _GDIPlus_PathDispose($hPath)
        _GDIPlus_GraphicsDrawImageRect($hGfx, $hBmp, $iX - $iRectSize * 3, $iY - $iRectSize * 3, $iRectSize * 6, $iRectSize * 6)
        _GDIPlus_BrushDispose($hBrush_Glow)
        _GDIPlus_GraphicsDispose($hBmp_Ctxt)
        _GDIPlus_BitmapDispose($hBmp)

        _GDIPlus_BrushSetSolidColor($hBrush, "0xFF" & $iR & $iG & $iB)
        _GDIPlus_GraphicsFillPolygon($hGfx, $aPoints, $hBrush)
        $fAngle += $fDeltaAngle
    Next

    $f += 3
    _GDIPlus_BrushSetSolidColor($hBrush, 0xA0FFFFFF)
    $hPath = _GDIPlus_PathCreate()
    Local Const $hFamily = _GDIPlus_FontFamilyCreate("Arial"), $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH)
    _GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $iH / 32, $hFormat)
    _GDIPlus_GraphicsFillPath($hGfx, $hPath, $hBrush)

    _GDIPlus_PathDispose($hPath)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_GraphicsDispose($hGfx)

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

 

Edited by UEZ

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

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