Jump to content

GDI+ animated loading screens build 2014-06-20 (32 examples)


UEZ
 Share

Recommended Posts

Try something like this here:

 

;coded by UEZ build 2013-05-02, idea from http://tympanus.net/codrops/2012/11/14/creative-css-loading-animations/
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <Memory.au3>
#include <GDIPlus.au3>

Global Const $hDwmApiDll = DllOpen("dwmapi.dll")
Global $sChkAero = DllStructCreate("int;")
DllCall($hDwmApiDll, "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($sChkAero))
Global $bAero = DllStructGetData($sChkAero, 1)
Global $fStep = 0.02
If Not $bAero Then $fStep = 1.25

MsgBox (0, "Installation", "MyApp will be installed...")

_GDIPlus_Startup()
Global Const $STM_SETIMAGE = 0x0172, $IMAGE_BITMAP = 0
Global $iW = 400, $iH = 250
Global Const $hGUI = GUICreate("Steam Punk Loading", $iW, $iH, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOPMOST)
GUISetBkColor(0xD2CEC6)
Global Const $hPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
GUICtrlSetState(-1, $GUI_DISABLE)
WinSetTrans($hGUI, "", 0)
GUISetState()
Global $hHBmp_BG, $hB

GUIRegisterMsg(0x0113, "PlayAnim") ;$WM_TIMER = 0x0113
DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", 50, "int", 0)

Global $z
For $z = 1 To 255 Step $fStep
    WinSetTrans($hGUI, "", $z)
Next

RunWait("calc.exe", @SystemDir)

GUIRegisterMsg(0x0113, "")
_WinAPI_DeleteObject($hHBmp_BG)
_GDIPlus_Shutdown()
GUIDelete()
MsgBox (0, "Installation", "Install OK")

Exit


Func PlayAnim()
    $hHBmp_BG = _GDIPlus_SteamPunkLoading($iW, $iH)
    $hB = GUICtrlSendMsg($hPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG)
    If $hB Then _WinAPI_DeleteObject($hB)
    _WinAPI_DeleteObject($hHBmp_BG)
EndFunc

Func _GDIPlus_SteamPunkLoading($iW, $iH, $sString = "Please wait...", $bHBitmap = True)
    Local Const $hPenArc = _GDIPlus_PenCreate(0xA08ABDC3, 25)
    DllCall($ghGDIPDll, "uint", "GdipSetPenLineJoin", "handle", $hPenArc, "int", 2)
    Local $hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", $GDIP_PXF32ARGB, "ptr", 0, "int*", 0)
    $hBitmap = $hBitmap[6]

    Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2)
    Local Const $hBmp_BG = _GDIPlus_BMPFromMemory(_Background())
    Local $hBrushTexture = DllCall($ghGDIPDll, "uint", "GdipCreateTexture", "handle", $hBmp_BG, "int", 0, "int*", 3)
    $hBrushTexture = $hBrushTexture[3]
    _GDIPlus_BitmapDispose($hBmp_BG)
    _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $iW, $iH, $hBrushTexture)
    Local $fCosX, $fSinY, $i
    Local Const $fDeg = ACos(-1) / 180, $iW2 = $iW / 2, $iH2 = $iH / 2, $iDiameter = 200, $iRadius = $iDiameter / 2, $iSize = 25, $iSize2 = $iSize / 2, $fFontSize = 20
    Local Static $iAngle = 0, $iX = 0, $iDir = 1
    _GDIPlus_PenSetColor($hPenArc, 0x60F0F0F0)
    DllCall($ghGDIPDll, "float", "GdipDrawArc", "handle", $hCtxt, "handle", $hPenArc, "float", $iW2 - $iRadius, "float", $iH2 - $iRadius, "float", $iDiameter, "float", $iDiameter, "float", 0, "float", 360)

    _GDIPlus_PenSetColor($hPenArc, 0xA08ABDC3)
    For $i = 0 To 7
        If Not Mod($i, 2) Then
            DllCall($ghGDIPDll, "float", "GdipDrawArc", "handle", $hCtxt, "handle", $hPenArc, "float", $iW2 - ($iRadius - $iSize), "float", $iH2 - ($iRadius - $iSize), "float", $iDiameter - 2 * $iSize, "float", $iDiameter - 2 * $iSize, "float", $iAngle + $i * 45, "float", 45)
        EndIf
    Next
    _GDIPlus_PenSetColor($hPenArc, 0x20F0F0F0)
    DllCall($ghGDIPDll, "float", "GdipDrawArc", "handle", $hCtxt, "handle", $hPenArc, "float", $iW2 - ($iRadius - $iSize), "float", $iH2 - ($iRadius - $iSize), "float", $iDiameter - 2 * $iSize, "float", $iDiameter - 2 * $iSize, "float", 0, "float", 360)

    _GDIPlus_PenSetColor($hPenArc, 0x508ABDC3)
    For $i = 0 To 5
        If Not Mod($i, 2) Then
            DllCall($ghGDIPDll, "float", "GdipDrawArc", "handle", $hCtxt, "handle", $hPenArc, "float", $iW2 - ($iRadius - 2 * $iSize), "float", $iH2 - ($iRadius - 2 * $iSize), "float", $iDiameter - 4 * $iSize, "float", $iDiameter - 4 * $iSize, "float", $iAngle + $i * 60, "float", 60)
        EndIf
    Next
    _GDIPlus_PenSetColor($hPenArc, 0x30F0F0F0)
    DllCall($ghGDIPDll, "float", "GdipDrawArc", "handle", $hCtxt, "handle", $hPenArc, "float", $iW2 - ($iRadius - 2 * $iSize), "float", $iH2 - ($iRadius - 2 * $iSize), "float", $iDiameter - 4 * $iSize, "float", $iDiameter - 4 * $iSize, "float", 0, "float", 360)

    _GDIPlus_PenSetColor($hPenArc, 0x808ABDC3)
    For $i = 0 To 3
        If Not Mod($i, 2) Then
            DllCall($ghGDIPDll, "float", "GdipDrawArc", "handle", $hCtxt, "handle", $hPenArc, "float", $iW2 - ($iRadius - 3 * $iSize), "float", $iH2 - ($iRadius - 3 * $iSize), "float", $iDiameter - 6 * $iSize, "float", $iDiameter - 6 * $iSize, "float", $iAngle + $i * 90, "float", 90)
        EndIf
    Next
    _GDIPlus_PenSetColor($hPenArc, 0x20F0F0F0)
    DllCall($ghGDIPDll, "float", "GdipDrawArc", "handle", $hCtxt, "handle", $hPenArc, "float", $iW2 - ($iRadius - 3 * $iSize), "float", $iH2 - ($iRadius - 3 * $iSize), "float", $iDiameter - 6 * $iSize, "float", $iDiameter - 6 * $iSize, "float", 0, "float", 360)

    Local $hBrushCircle = _GDIPlus_BrushCreateSolid(0x60F0F0F0)
    _GDIPlus_GraphicsFillEllipse($hCtxt, $iW2 - $iSize2, $iH2 - $iSize2, $iSize, $iSize, $hBrushCircle)

    $iAngle += 4
    Local Const $hFormat = _GDIPlus_StringFormatCreate()
    Local Const $hFamily = _GDIPlus_FontFamilyCreate("Impact")
    Local Const $hFont = _GDIPlus_FontCreate($hFamily, $fFontSize)
    Local Const $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)
    Local Const $aInfo = _GDIPlus_GraphicsMeasureString($hCtxt, $sString, $hFont, $tLayout, $hFormat)
    Local Const $hBrushTxt = _GDIPlus_LineBrushCreate($iX, 0, DllStructGetData($aInfo[0], "Width"), 0, 0x90101010, 0xFFA0A0A0, 2)
    DllCall($ghGDIPDll, "uint", "GdipSetLineLinearBlend", "handle", $hBrushTxt, "float", $iX, "float", 1)
    DllStructSetData($tLayout, "X", ($iW - DllStructGetData($aInfo[0], "Width")) / 2)
    DllStructSetData($tLayout, "Y", ($iH - DllStructGetData($aInfo[0], "Height")) / 2)
    DllCall($ghGDIPDll, "uint", "GdipSetLineGammaCorrection", "handle", $hBrushTxt, "int", 1)
    _GDIPlus_GraphicsDrawStringEx($hCtxt, $sString, $hFont, $tLayout, $hFormat, $hBrushTxt)
    $iX += 0.02 * $iDir
    If $iX > 0.98 Or $iX < 0.02 Then $iDir *= -1

    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrushTxt)
    _GDIPlus_BrushDispose($hBrushTexture)
    _GDIPlus_BrushDispose($hBrushCircle)
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_PenDispose($hPenArc)
    If $bHBitmap Then
        Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
        _GDIPlus_BitmapDispose($hBitmap)
        Return $hHBITMAP
    EndIf
    Return $hBitmap
EndFunc

Func _GDIPlus_LineBrushCreate($nX1, $nY1, $nX2, $nY2, $iARGBClr1, $iARGBClr2, $iWrapMode = 0)
    Local $tPointF1, $pPointF1
    Local $tPointF2, $pPointF2
    Local $aResult
    $tPointF1 = DllStructCreate("float;float")
    $pPointF1 = DllStructGetPtr($tPointF1)
    $tPointF2 = DllStructCreate("float;float")
    $pPointF2 = DllStructGetPtr($tPointF2)
    DllStructSetData($tPointF1, 1, $nX1)
    DllStructSetData($tPointF1, 2, $nY1)
    DllStructSetData($tPointF2, 1, $nX2)
    DllStructSetData($tPointF2, 2, $nY2)
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "ptr", $pPointF1, "ptr", $pPointF2, "uint", $iARGBClr1, "uint", $iARGBClr2, "int", $iWrapMode, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[6]
EndFunc   ;==>_GDIPlus_LineBrushCreate

;==================================================================================================================================
; Function Name:         _GDIPlus_BMPFromMemory
; Description:            Loads an image which is saved as a binary string and converts it to a bitmap or hbitmap
;
; Parameters:            $bImage:    the binary string which contains any valid image which is supported by GDI+
; Optional:             $hHBITMAP:  if false a bitmap will be created, if true a hbitmap will be created
;
; Remark:               hbitmap format is used generally for GUI internal images, $bitmap is more a GDI+ image format
;                       Don't forget _GDIPlus_Startup() and _GDIPlus_Shutdown()
;
; Requirement(s):        GDIPlus.au3, Memory.au3 and _WinAPI_BitmapCreateDIBFromBitmap() from WinAPIEx.au3
; Return Value(s):        Success: handle to bitmap (GDI+ bitmap format) or hbitmap (WinAPI bitmap format),
;                       Error: 0
; Error codes:          1: $bImage is not a binary string
;                       2: unable to create stream on HGlobal
;                       3: unable to create bitmap from stream
;
; Author(s):            UEZ
; Additional Code:        thanks to progandy for the MemGlobalAlloc and tVARIANT lines and
;                        Yashied for _WinAPI_BitmapCreateDIBFromBitmap() from WinAPIEx.au3
; Version:              v0.98 Build 2012-08-29 Beta
;===================================================================================================================================
Func _GDIPlus_BMPFromMemory($bImage, $hHBITMAP = False)
    If Not IsBinary($bImage) Then Return SetError(1, 0, 0)
    Local $aResult
    Local Const $memBitmap = Binary($bImage) ;load image  saved in variable (memory) and convert it to binary
    Local Const $len = BinaryLen($memBitmap) ;get length of image
    Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory  ($GMEM_MOVEABLE = 0x0002)
    Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer
    Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct
    DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data
    _MemGlobalUnlock($hData) ;decrements the lock count  associated with a memory object that was allocated with GMEM_MOVEABLE
    $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents
    If @error Then Return SetError(2, 0, 0)
    Local Const $hStream = $aResult[3]
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface
    If @error Then Return SetError(3, 0, 0)
    Local Const $hBitmap = $aResult[2]
    Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr")
    DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _
                                           "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak
    $tMem = 0
    $tVARIANT = 0
    If $hHBITMAP Then
        Local Const $hHBmp = _WinAPI_BitmapCreateDIBFromBitmap($hBitmap)
        _GDIPlus_BitmapDispose($hBitmap)
        Return $hHBmp
    EndIf
    Return $hBitmap
EndFunc   ;==>_GDIPlus_BMPFromMemory

Func _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) ;create 32-bit bitmap v5 (alpha channel supported)
    Local $tBIHDR, $aRet, $tData, $pBits, $hResult = 0
    $aRet = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0)
    If (@error) Or ($aRet[0]) Then Return 0
    $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aRet[2], $aRet[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB)
    $pBits = DllStructGetData($tData, 'Scan0')
    If Not $pBits Then Return 0
    $tBIHDR = DllStructCreate(    'dword bV5Size;long bV5Width;long bV5Height;word bV5Planes;word bV5BitCount;dword bV5Compression;' & _ ;http://msdn.microsoft.com/en-us/library/windows/desktop/dd183381(v=vs.85).aspx
                                                                'dword bV5SizeImage;long bV5XPelsPerMeter;long bV5YPelsPerMeter;dword bV5ClrUsed;dword bV5ClrImportant;'  & _
                                                                'dword bV5RedMask;dword bV5GreenMask;dword bV5BlueMask;dword bV5AlphaMask;dword bV5CSType;' & _
                                                                'int bV5Endpoints[3];dword bV5GammaRed;dword bV5GammaGreen;dword bV5GammaBlue;dword bV5Intent;' & _
                                                                'dword bV5ProfileData;dword bV5ProfileSize;dword bV5Reserved')
    DllStructSetData($tBIHDR, 'bV5Size', DllStructGetSize($tBIHDR))
    DllStructSetData($tBIHDR, 'bV5Width', $aRet[2])
    DllStructSetData($tBIHDR, 'bV5Height', $aRet[3])
    DllStructSetData($tBIHDR, 'bV5Planes', 1)
    DllStructSetData($tBIHDR, 'bV5BitCount', 32)
    DllStructSetData($tBIHDR, 'bV5Compression', 0) ; $BI_BITFIELDS = 3, $BI_RGB = 0, $BI_RLE8 = 1, $BI_RLE4 = 2, $RGBA = 0x41424752
    DllStructSetData($tBIHDR, 'bV5SizeImage', $aRet[3] * DllStructGetData($tData, 'Stride'))
    DllStructSetData($tBIHDR, 'bV5AlphaMask', 0xFF000000)
    DllStructSetData($tBIHDR, 'bV5RedMask', 0x00FF0000)
    DllStructSetData($tBIHDR, 'bV5GreenMask', 0x0000FF00)
    DllStructSetData($tBIHDR, 'bV5BlueMask', 0x000000FF)
    DllStructSetData($tBIHDR, 'bV5CSType', 2) ; LCS_WINDOWS_COLOR_SPACE = 2
    DllStructSetData($tBIHDR, 'bV5Intent', 4) ; $LCS_GM_IMA
    $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0)
    If (Not @error) And ($hResult[0]) Then
        DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $aRet[2] * $aRet[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0'))
        $hResult = $hResult[0]
    Else
        $hResult = 0
    EndIf
    _GDIPlus_BitmapUnlockBits($hBitmap, $tData)
    $tData = 0
    $tBIHDR = 0
    Return $hResult
EndFunc   ;==>_WinAPI_BitmapCreateDIBFromBitmap

;Code below was generated by: 'File to Base64 String' Code Generator v1.12 Build 2013-03-27

Func _Background($bSaveBinary = False, $sSavePath = @ScriptDir)
    Local $Background
    $Background &= 'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAnFBMVEXX08vd2dHZ1c3b18/a1s7c2NDY1MzW0sre2tLTz8fg3NTU0Mjf29PV0cnRzcXh3dXPy8Pi3tbSzsbLx7/MyMDNycHOysLJxb3Kxr7QzMTIxLzHw7vj39fGwrrFwbnEwLjCvrbDv7fBvbXAvLS9ubG+urK7t6/k4Ni/u7O0sKi1sam3s6u8uLDl4dm4tKygnJSwrKTm4tqfm5OLh3+vBRlAAAAJ5ElEQVR4Xg3ORbIsyZIAUWMzZw+OyMz7qOBj8/731jVSkTNSyPRvstiR0BJpCcklS25k2FRHqyr20c/pShMF6cMxK/Nli99Q1BjqH/zSTXkUKuXlJ/FI+mvAQosvLb7BYyQN0thsp9RWvfRYiq9EcNCUBI8wr6PyPkZ+iPDCJX6DHN8F6QGCqe6TQErOoyhbx0ocBj95xJPFIR6b3ILLVIo0XFad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File = FileOpen($sSavePath & "\hexabump.png", 18)
        FileWrite($hFile, $bString)
        FileClose($hFile)
    EndIf
    Return  $bString
EndFunc   ;==>_Background

Func _Base64Decode($sB64String)
    Local $a_Call = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
    If @error Or Not $a_Call[0] Then Return SetError(1, 0, "")
    Local $a = DllStructCreate("byte[" & $a_Call[5] & "]")
    $a_Call = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $a, "dword*", $a_Call[5], "ptr", 0, "ptr", 0)
    If @error Or Not $a_Call[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($a, 1)
EndFunc   ;==>_Base64Decode
It will open the calculator and waits that it will be closed. This is the simualtion of runwait.

Does it fit to your needs?

Br,

UEZ

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

Link to comment
Share on other sites

@SirDarknight1200: what do you mean with "separate the background" exactly?

Br,

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

Link to comment
Share on other sites

He probably wants the animations as a floating window, without a background.

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Link to comment
Share on other sites

Sure, you can disable / remove the background for each example. The background images are embedded.

Example for _GDIPlus_RotatingBokeh.au3:

;coded by UEZ build 2013-05-02, idea from http://tympanus.net/codrops/2012/11/14/creative-css-loading-animations/
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <Memory.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

If @AutoItVersion < "3.3.8.0" Then Exit MsgBox(16 + 262144, "ERROR", "AutoIt version 3.3.8.0 or higher needed! Please update!", 180)

Global Const $hDwmApiDll = DllOpen("dwmapi.dll")
Global $sChkAero = DllStructCreate("int;")
DllCall($hDwmApiDll, "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($sChkAero))
Global $bAero = DllStructGetData($sChkAero, 1)
Global $fStep = 0.02
If Not $bAero Then $fStep = 1.25

_GDIPlus_Startup()
Global Const $STM_SETIMAGE = 0x0172, $IMAGE_BITMAP = 0
Global $iW = 400, $iH = 210
Global Const $hGUI = GUICreate("Rotating Bokeh", $iW, $iH, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOPMOST)
GUISetBkColor(0)
Global Const $hPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
GUICtrlSetState(-1, $GUI_DISABLE)
WinSetTrans($hGUI, "", 0)
GUISetState()
Global $hHBmp_BG, $hB, $iSleep = 20
GUIRegisterMsg($WM_TIMER, "PlayAnim")
DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iSleep, "int", 0)

Global $z, $iPerc
For $z = 1 To 255 Step $fStep
    WinSetTrans($hGUI, "", $z)
Next

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

Func PlayAnim()
    $hHBmp_BG = _GDIPlus_RotatingBokeh($iW, $iH, "Please wait..." & StringFormat("%05.2f %", $iPerc))
    $hB = GUICtrlSendMsg($hPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG)
    If $hB Then _WinAPI_DeleteObject($hB)
    _WinAPI_DeleteObject($hHBmp_BG)
    $iPerc += 0.1
    If $iPerc > 99.9 Then $iPerc = 0
EndFunc

Func _GDIPlus_RotatingBokeh($iW, $iH, $sString = "Please wait...", $bHBitmap = True)
    Local Const $hBrushBall1 = _GDIPlus_BrushCreateSolid(0xE004AC6B)
    Local Const $hBrushBall2 = _GDIPlus_BrushCreateSolid(0xC0E0AB27)
    Local Const $hBrushBall3 = _GDIPlus_BrushCreateSolid(0xD081B702)
    Local Const $hBrushBall4 = _GDIPlus_BrushCreateSolid(0xB0E70339)
    Local Const $hPen = _GDIPlus_PenCreate(0xFF303030)
    DllCall($ghGDIPDll, "uint", "GdipSetPenLineJoin", "handle", $hPen, "int", 2)
    Local $hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", $GDIP_PXF32ARGB, "ptr", 0, "int*", 0)
    $hBitmap = $hBitmap[6]

    Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2)
    _GDIPlus_GraphicsClear($hCtxt, 0xFF080810)
    Local Const $fDeg = ACos(-1) / 180, $iRadius = 40, $iBallSize = $iRadius / 1.77, $iCircleSize = $iBallSize + 2 * $iRadius, $iBallSize2 = $iBallSize / 2, _
                            $iCircleSize2 = $iCircleSize / 2, $fFontSize = 11, $iW2 = -1 + $iW / 2, $iH2 = -1 + $iH / 2
    Local Static $iAngle = 0
    DllCall($ghGDIPDll, "int", "GdipDrawEllipse", "handle", $hCtxt, "handle", $hPen, "float", $iW2 - $iCircleSize2, "float", $iH2 - $iCircleSize2, "float", $iCircleSize, "float", $iCircleSize)
    DllCall($ghGDIPDll, "int", "GdipFillEllipse", "handle", $hCtxt, "handle", $hBrushBall1, "float", -$iBallSize2 + $iW2 + Cos(2.25 * $iAngle * $fDeg) * $iRadius, "float", -$iBallSize2 + $iH2 + Sin(2.25 * $iAngle * $fDeg) * $iRadius,"float", $iBallSize, "float", $iBallSize)
    DllCall($ghGDIPDll, "int", "GdipFillEllipse", "handle", $hCtxt, "handle", $hBrushBall2, "float", -$iBallSize2 + $iW2 + Cos(1.75 * $iAngle * $fDeg) * $iRadius, "float", -$iBallSize2 + $iH2 + Sin(1.75 * $iAngle * $fDeg) * $iRadius,"float", $iBallSize, "float", $iBallSize)
    DllCall($ghGDIPDll, "int", "GdipFillEllipse", "handle", $hCtxt, "handle", $hBrushBall3, "float", -$iBallSize2 + $iW2 + Cos(1.66 * $iAngle * $fDeg) * $iRadius, "float", -$iBallSize2 + $iH2 + Sin(1.66 * $iAngle * $fDeg) * $iRadius,"float", $iBallSize, "float", $iBallSize)
    DllCall($ghGDIPDll, "int", "GdipFillEllipse", "handle", $hCtxt, "handle", $hBrushBall4, "float", -$iBallSize2 + $iW2 + Cos(1.33 * $iAngle * $fDeg) * $iRadius, "float", -$iBallSize2 + $iH2 + Sin(1.33 * $iAngle * $fDeg) * $iRadius,"float", $iBallSize, "float", $iBallSize)
    $iAngle += 2.5

    Local Const $hFormat = _GDIPlus_StringFormatCreate()
    Local Const $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    Local Const $hFont = _GDIPlus_FontCreate($hFamily, $fFontSize, 2)
    Local Const $hBrushTxt = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    Local Const $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)
    Local Const $aInfo = _GDIPlus_GraphicsMeasureString($hCtxt, $sString, $hFont, $tLayout, $hFormat)
    DllStructSetData($tLayout, "X", ($iW - DllStructGetData($aInfo[0], "Width")) / 2)
    DllStructSetData($tLayout, "Y", $iH / 2 + $iRadius + $iBallSize)
    _GDIPlus_GraphicsDrawStringEx($hCtxt, $sString, $hFont, $tLayout, $hFormat, $hBrushTxt)

    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrushTxt)
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_BrushDispose($hBrushBall1)
    _GDIPlus_BrushDispose($hBrushBall2)
    _GDIPlus_BrushDispose($hBrushBall3)
    _GDIPlus_BrushDispose($hBrushBall4)
    _GDIPlus_PenDispose($hPen)
    If $bHBitmap Then
            Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
            _GDIPlus_BitmapDispose($hBitmap)
            Return $hHBITMAP
    EndIf
    Return $hBitmap
EndFunc

Br,

UEZ

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

Link to comment
Share on other sites

  • 2 weeks later...

Added _GDIPlus_PacmanProgressbar and _GDIPlus_StripProgressbar animations (see 1st post).

I removed the code boxes because it is a pita to modify it with the browser. Just download the attachment where you can find all the examples.

Have fun.

Br,

UEZ

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

Link to comment
Share on other sites

;coded by UEZ build 2013-08-14
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>

_GDIPlus_Startup()
Global Const $STM_SETIMAGE = 0x0172;, $IMAGE_BITMAP = 0
Global $iW = 400, $iH = 25, $iBGColor = 0xFFFFFF
Global Const $hGUI = GUICreate("Monochromatic Blinker", $iW, $iH, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOPMOST)
GUISetBkColor($iBGColor)
Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()
Global $hHBmp_BG, $hB, $iSleep = 30
GUIRegisterMsg($WM_TIMER, "PlayAnim")
DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iSleep, "int", 0)
Global $fPerc = 0, $aPos, $iPosX, $iPosY
Global $aColors[5][2] = [[0xFFEE5F5B, 0xFFF07673],[0xFFABCC04, 0xFFBBD636],[0xFF78CCEE, 0xFF93D6F1],[0xFFFFBB58, 0xFFFFC97A],[0xFFFF6677, 0xFFFF8795]]
Global $iRandom = Random(0, UBound($aColors) - 1, 1)
$aPos = WinGetPos($hGUI)
$iPosX = $aPos[0]
$iPosY = $aPos[1] + $aPos[3]

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

Func PlayAnim()
    $hHBmp_BG = _GDIPlus_StripProgressbar($fPerc, $iW, $iH, 0xFF000000 + $iBGColor, $aColors[$iRandom][0], $aColors[$iRandom][1])
    $hB = GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG)
    If $hB Then _WinAPI_DeleteObject($hB)
    _WinAPI_DeleteObject($hHBmp_BG)
    $fPerc += 0.25
    If $fPerc > 100 Then $fPerc = 0
    ToolTip(StringFormat("%02d %", $fPerc), $iPosX + $fPerc / 100 * $iW - 1, $iPosY, "", "", 3)
    $H_TOOLTIP1 = WinGetHandle(StringFormat("%02d %", $fPerc))

DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $H_TOOLTIP1, "wstr", "", "wstr", "")
DllCall("user32.dll", "int", "SendMessage", "hwnd", $H_TOOLTIP1, "int", 1043, "int", 0xe8e6d9, "int", 0)
EndFunc   ;==>PlayAnim

Func _GDIPlus_StripProgressbar($fPerc, $iW, $iH, $iBgColorGui = 0xFFF0F0F0, $iFgColor = 0xFFEE5F5B, $iBGColor = 0xFFF07673, $sText = "Loading...", $iTextColor = 0x000000, $iDir = -1, $iSpeed = 1, $sFont = "Arial", $bFlip = False, $bHBitmap = True)
    If $fPerc < 0 Then $fPerc = 0
    If $fPerc > 100 Then $fPerc = 100
    Local $hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", $GDIP_PXF32ARGB, "ptr", 0, "int*", 0)
    $hBitmap = $hBitmap[6]
    Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsClear($hCtxt, $iBgColorGui)
    
    Local $iWidth = $iH * 2, $iLen = $iWidth / 2, $iY
    Local $hBmp = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iH, "int", 0, "int", $GDIP_PXF32ARGB, "ptr", 0, "int*", 0)
    $hBmp = $hBmp[6]
    Local Const $hCtxt_Bmp = _GDIPlus_ImageGetGraphicsContext($hBmp)
    Local $hPen = _GDIPlus_PenCreate($iFgColor), $iPenSize = Int($iH / 12)
    Local $hPen2 = _GDIPlus_PenCreate(0x40000000, $iPenSize)
    
    _GDIPlus_GraphicsClear($hCtxt_Bmp, $iBGColor)
    Local Static $iX = 0
    For $iY = 0 To $iH - 1
        Switch $iDir
            Case 1
                _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, $iX + $iY, $iY, $iX + $iY + $iLen, $iY, $hPen)
                _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, $iX + $iY - 2 * $iLen, $iY, $iX + $iY - 1 * $iLen, $iY, $hPen)
            Case Else
                _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, -$iX + $iY, $iY, -$iX + $iY + $iLen, $iY, $hPen)
                _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, -$iX + $iY + 2 * $iLen, $iY, -$iX + $iY + 3 * $iLen, $iY, $hPen)
        EndSwitch
    Next
    Local $tPoint1 = DllStructCreate("float;float")
    Local $tPoint2 = DllStructCreate("float;float")
    DllStructSetData($tPoint1, 1, $iW / 2) ;x1
    DllStructSetData($tPoint2, 1, $iW / 2) ;x2
    Local $hLineBrush
    
    If $bFlip Then
        _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, 0, 0, $iWidth, 0, $hPen2)
        DllStructSetData($tPoint2, 2, $iH * 2 / 3) ;y2
        DllStructSetData($tPoint1, 2, $iH / 3) ;y1
        $hLineBrush = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "struct*", $tPoint1, "struct*", $tPoint2, "uint", 0x00FFFFFF, "uint", 0xB0FFFFFF, "int", 0, "int*", 0)
        $hLineBrush = $hLineBrush[6]
        _GDIPlus_GraphicsFillRect($hCtxt_Bmp, 0, $iH * 2 / 3 + 1, $iW, $iH / 3, $hLineBrush)
    Else
        _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, 0, $iH - $iPenSize / 2, $iWidth, $iH - $iPenSize / 2, $hPen2)
        DllStructSetData($tPoint1, 2, 0) ;y1
        DllStructSetData($tPoint2, 2, $iH / 3) ;y2
        $hLineBrush = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "struct*", $tPoint1, "struct*", $tPoint2, "uint", 0xB0FFFFFF, "uint", 0x00FFFFFF, "int", 0, "int*", 0)
        $hLineBrush = $hLineBrush[6]
        _GDIPlus_GraphicsFillRect($hCtxt_Bmp, 0, 0, $iW, $iH / 3, $hLineBrush)
    EndIf
    $iX = Mod($iX + $iSpeed, $iWidth)
    
    Local $hTextureBrush = DllCall($ghGDIPDll, "uint", "GdipCreateTexture", "handle", $hBmp, "int", 0, "int*", 0)
    $hTextureBrush = $hTextureBrush[3]
    
    _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $fPerc / 100 * $iW, $iH, $hTextureBrush)
    If $bFlip Then DllCall($ghGDIPDll, "uint", "GdipImageRotateFlip", "handle", $hBitmap, "int", 6)
    
    DllCall($ghGDIPDll, "int", "GdipSetTextRenderingHint", "handle", $hCtxt, "int", 4)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0x40000000 + $iTextColor)
    Local $hFormat = _GDIPlus_StringFormatCreate()
    Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
    Local $hFont = _GDIPlus_FontCreate($hFamily, $iH * 3 / 5, 2)
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH)
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    _GDIPlus_GraphicsDrawStringEx($hCtxt, $sText, $hFont, $tLayout, $hFormat, $hBrush)

    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_PenDispose($hPen2)
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_GraphicsDispose($hCtxt_Bmp)
    _GDIPlus_BitmapDispose($hBmp)
    _GDIPlus_BrushDispose($hTextureBrush)
    _GDIPlus_BrushDispose($hLineBrush)
    If $bHBitmap Then
        Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
        _GDIPlus_BitmapDispose($hBitmap)
        Return $hHBITMAP
    EndIf
    Return $hBitmap
EndFunc   ;==>_GDIPlus_StripProgressbar

tooltip color :)

Link to comment
Share on other sites

Thank you mesale0077 for the idea to change the color of the tooltip. I will adapt it.

Br,

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

Link to comment
Share on other sites

;thank you UEZ
;coded by UEZ build 2013-08-15
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>

_GDIPlus_Startup()
Global Const $STM_SETIMAGE = 0x0172;, $IMAGE_BITMAP = 0
Global $iW = 400, $iH = 25, $iBGColor = 0xFFFFFF
Global Const $hGUI = GUICreate("Strip Progressbar", $iW, $iH, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOPMOST)
GUISetBkColor($iBGColor)
Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()
Global $hHBmp_BG, $hB, $iSleep = 30, $hTooltip
GUIRegisterMsg($WM_TIMER, "PlayAnim")
DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iSleep, "int", 0)
Global $fPerc = 0, $aPos, $iPosX, $iPosY
Global $aColors[7][2] = [[0xFFEE5F5B, 0xFFF07673],[0xFFABCC04, 0xFFBBD636],[0xFF78CCEE, 0xFF93D6F1],[0xFFFFBB58, 0xFFFFC97A],[0xFFFF6677, 0xFFFF8795],[0xFF78CCEE,0xFFFFC97A],[0xFF78CCEE,0xe8e5d9]]
Global $iRandom = Random(0, UBound($aColors) - 1, 1)
$aPos = WinGetPos($hGUI)
$iPosX = $aPos[0]
$iPosY = $aPos[1] + $aPos[3]
Global $iColorTP = BitShift(BitAND(BitAND(0x00FFFFFF, $aColors[$iRandom][1]), 0xFF), -16) + BitAND(0x0000FF00, $aColors[$iRandom][1]) + BitShift(BitAND(BitAND(0x00FFFFFF, $aColors[$iRandom][1]), 0xFF0000), 16) ;convert to BGR


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

Func PlayAnim()
$fPerc += 0.25

If $fPerc > 100 Then $fPerc = 0
Switch $fPerc
Case 0 To 19
$iRandom = 1
Case 20 To 29
$iRandom = 2
Case 30 To 49
$iRandom = 3
Case 50 To 69
$iRandom = 4
Case 70 to 89
$iRandom = 5
Case 90 to 100
$iRandom = 6
EndSwitch
$iColorTP = BitShift(BitAND(BitAND(0x00FFFFFF, $aColors[$iRandom][1]), 0xFF), -16) + BitAND(0x0000FF00, $aColors[$iRandom][1]) + BitShift(BitAND(BitAND(0x00FFFFFF, $aColors[$iRandom][1]), 0xFF0000), 16) ;convert to BGR
$hHBmp_BG = _GDIPlus_StripProgressbar($fPerc, $iW, $iH, 0xFF000000 + $iBGColor, $aColors[$iRandom][0], $aColors[$iRandom][1])
$hB = GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG)
If $hB Then _WinAPI_DeleteObject($hB)
_WinAPI_DeleteObject($hHBmp_BG)

ToolTip(StringFormat("%02d %", $fPerc), $iPosX + $fPerc / 100 * $iW - 1, $iPosY, "", "", 3)
$hTooltip = WinGetHandle(StringFormat("%02d %", $fPerc))
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hTooltip, "wstr", "", "wstr", "")
DllCall("user32.dll", "int", "SendMessage", "hwnd", $hTooltip, "int", 1043, "int", $iColorTP, "int", 0)
EndFunc ;==>PlayAnim

Func _GDIPlus_StripProgressbar($fPerc, $iW, $iH, $iBgColorGui = 0xFFF0F0F0, $iFgColor = 0xFFEE5F5B, $iBGColor = 0xFFF07673, $sText = "Loading...", $iTextColor = 0x000000, $iDir = -1, $iSpeed = 1, $sFont = "Arial", $bFlip = False, $bHBitmap = True)
If $fPerc < 0 Then $fPerc = 0
If $fPerc > 100 Then $fPerc = 100
Local $hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", $GDIP_PXF32ARGB, "ptr", 0, "int*", 0)
$hBitmap = $hBitmap[6]
Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsClear($hCtxt, $iBgColorGui)

Local $iWidth = $iH * 2, $iLen = $iWidth / 2, $iY
Local $hBmp = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iH, "int", 0, "int", $GDIP_PXF32ARGB, "ptr", 0, "int*", 0)
$hBmp = $hBmp[6]
Local Const $hCtxt_Bmp = _GDIPlus_ImageGetGraphicsContext($hBmp)
Local $hPen = _GDIPlus_PenCreate($iFgColor), $iPenSize = Int($iH / 12)
Local $hPen2 = _GDIPlus_PenCreate(0x40000000, $iPenSize)

_GDIPlus_GraphicsClear($hCtxt_Bmp, $iBGColor)
Local Static $iX = 0
For $iY = 0 To $iH - 1
Switch $iDir
Case 1
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, $iX + $iY, $iY, $iX + $iY + $iLen, $iY, $hPen)
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, $iX + $iY - 2 * $iLen, $iY, $iX + $iY - 1 * $iLen, $iY, $hPen)
Case Else
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, -$iX + $iY, $iY, -$iX + $iY + $iLen, $iY, $hPen)
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, -$iX + $iY + 2 * $iLen, $iY, -$iX + $iY + 3 * $iLen, $iY, $hPen)
EndSwitch
Next
Local $tPoint1 = DllStructCreate("float;float")
Local $tPoint2 = DllStructCreate("float;float")
DllStructSetData($tPoint1, 1, $iW / 2) ;x1
DllStructSetData($tPoint2, 1, $iW / 2) ;x2
Local $hLineBrush

If $bFlip Then
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, 0, 0, $iWidth, 0, $hPen2)
DllStructSetData($tPoint2, 2, $iH * 2 / 3) ;y2
DllStructSetData($tPoint1, 2, $iH / 3) ;y1
$hLineBrush = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "struct*", $tPoint1, "struct*", $tPoint2, "uint", 0x00FFFFFF, "uint", 0xB0FFFFFF, "int", 0, "int*", 0)
$hLineBrush = $hLineBrush[6]
_GDIPlus_GraphicsFillRect($hCtxt_Bmp, 0, $iH * 2 / 3 + 1, $iW, $iH / 3, $hLineBrush)
Else
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, 0, $iH - $iPenSize / 2, $iWidth, $iH - $iPenSize / 2, $hPen2)
DllStructSetData($tPoint1, 2, 0) ;y1
DllStructSetData($tPoint2, 2, $iH / 3) ;y2
$hLineBrush = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "struct*", $tPoint1, "struct*", $tPoint2, "uint", 0xB0FFFFFF, "uint", 0x00FFFFFF, "int", 0, "int*", 0)
$hLineBrush = $hLineBrush[6]
_GDIPlus_GraphicsFillRect($hCtxt_Bmp, 0, 0, $iW, $iH / 3, $hLineBrush)
EndIf
$iX = Mod($iX + $iSpeed, $iWidth)

Local $hTextureBrush = DllCall($ghGDIPDll, "uint", "GdipCreateTexture", "handle", $hBmp, "int", 0, "int*", 0)
$hTextureBrush = $hTextureBrush[3]

_GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $fPerc / 100 * $iW, $iH, $hTextureBrush)
If $bFlip Then DllCall($ghGDIPDll, "uint", "GdipImageRotateFlip", "handle", $hBitmap, "int", 6)

DllCall($ghGDIPDll, "int", "GdipSetTextRenderingHint", "handle", $hCtxt, "int", 4)
Local $hBrush = _GDIPlus_BrushCreateSolid(0x40000000 + $iTextColor)
Local $hFormat = _GDIPlus_StringFormatCreate()
Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
Local $hFont = _GDIPlus_FontCreate($hFamily, $iH * 3 / 5, 2)
Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH)
_GDIPlus_StringFormatSetAlign($hFormat, 1)
_GDIPlus_GraphicsDrawStringEx($hCtxt, $sText, $hFont, $tLayout, $hFormat, $hBrush)

_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hPen2)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_GraphicsDispose($hCtxt_Bmp)
_GDIPlus_BitmapDispose($hBmp)
_GDIPlus_BrushDispose($hTextureBrush)
_GDIPlus_BrushDispose($hLineBrush)
If $bHBitmap Then
Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
_GDIPlus_BitmapDispose($hBitmap)
Return $hHBITMAP
EndIf
Return $hBitmap
EndFunc ;==>_GDIPlus_StripProgressbar

;thank you UEZ

Link to comment
Share on other sites

This is probably one of my favorite threads here on the forum

I'm a graphic designer, artist, and writer by hobby (and I'm pretty damn good), so this thread shows so many possibilities available to me with delving in deep into the autoit language.

Thank you UEZ, these examples are top notch! :thumbsup:

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Link to comment
Share on other sites

Thanks for your comments!  :thumbsup:

 

Just for my curiosity: are the source codes easily to understand and can easily be adapted to your own program?

I know that the comments mostly missing....

Br,

UEZ

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

Link to comment
Share on other sites

  • 1 month later...

Added one or two more examples since last update (see 1st post).

Br,

UEZ

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

Link to comment
Share on other sites

  • 3 weeks later...

Very creative work, UEZ!

I would like to adapt the StripProgressBar Example 1 to complete filling the progress bar based on a time value, like fill in "10 seconds" or fill in "30 seconds". Below is my feeble attempt at making it run only once and be limited to a time period, but it would be better if the progress was directly linked to the time period desired.

Also, is it possible to change the text, "Loading...", in the background or omit it?

Thank you.

;coded by UEZ build 2013-08-15
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include "_GDIPlus_StripProgressbar.au3"

_GDIPlus_Startup()
Global Const $STM_SETIMAGE = 0x0172, $IMAGE_BITMAP = 0
Global $iW = 400, $iH = 25, $iBGColor = 0xFFFFFF
Global Const $hGUI = GUICreate("Strip Progressbar", $iW, $iH, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOPMOST)
GUISetBkColor($iBGColor)
Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()
Global $hHBmp_BG, $hB, $iSleep = 30, $hTooltip
GUIRegisterMsg($WM_TIMER, "PlayAnim")
DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iSleep, "int", 0)
Global $fPerc = 0, $aPos, $iPosX, $iPosY
Global $aColors[5][2] = [[0xFFEE5F5B, 0xFFF07673],[0xFFABCC04, 0xFFBBD636],[0xFF78CCEE, 0xFF93D6F1],[0xFFFFBB58, 0xFFFFC97A],[0xFFFF6677, 0xFFFF8795]]
Global $iRandom = Random(0, UBound($aColors) - 1, 1)
$aPos = WinGetPos($hGUI)
$iPosX = $aPos[0]
$iPosY = $aPos[1] + $aPos[3]
Global $iColorTP = BitShift(BitAND(BitAND(0x00FFFFFF, $aColors[$iRandom][1]), 0xFF), -16) + BitAND(0x0000FF00, $aColors[$iRandom][1]) + BitShift(BitAND(BitAND(0x00FFFFFF, $aColors[$iRandom][1]), 0xFF0000), 16) ;convert to BGR


Sleep (10000)

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

Func PlayAnim()
    $hHBmp_BG = _GDIPlus_StripProgressbar($fPerc, $iW, $iH, 0xFF000000 + $iBGColor, $aColors[$iRandom][0], $aColors[$iRandom][1])
    $hB = GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG)
    If $hB Then _WinAPI_DeleteObject($hB)
    _WinAPI_DeleteObject($hHBmp_BG)
    $fPerc += 0.25
    If $fPerc >= 100.5 Then
        $fPerc = 0
        $iRandom = Random(0, UBound($aColors) - 1, 1)
        $iColorTP = BitShift(BitAND(BitAND(0x00FFFFFF, $aColors[$iRandom][1]), 0xFF), -16) + BitAND(0x0000FF00, $aColors[$iRandom][1]) + BitShift(BitAND(BitAND(0x00FFFFFF, $aColors[$iRandom][1]), 0xFF0000), 16) ;convert to BGR
    EndIf
;~  ToolTip(StringFormat("%02d %", $fPerc), $iPosX + $fPerc / 100 * $iW - 1, $iPosY, "", "", 3)
;~  $hTooltip = WinGetHandle(StringFormat("%02d %", $fPerc))
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hTooltip, "wstr", "", "wstr", "")
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hTooltip, "int", 0x0413, "int", $iColorTP, "int", 0) ;$TTM_SETTIPBKCOLOR = 0x0413
EndFunc   ;==>PlayAnim

BTW, your script named "_GDIPlus_StripProgressbar"  (no example) does nothing on my W8 64b system. No compile errors but whether I use the 3.3.9.21 beta or the 3.3.8.x it exits immediately upon running. Just FYI. :ermm:  (Doh! Why do I bother trying to work on this stuff late at night!?)

Edited by timmy2
Link to comment
Share on other sites

@timmy2: _GDIPlus_StripProgressbar.au3 is only the UDF. That means nothing will happen when you start it. The other "UDFs" have examples included.

When I have some time I will change from percentage to time format.

 

Br,

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

Link to comment
Share on other sites

@timmy2: _GDIPlus_StripProgressbar.au3 is only the UDF. That means nothing will happen when you start it. The other "UDFs" have examples included.

When I have some time I will change from percentage to time format.

 

Br,

UEZ

Thank you, UEZ.   Is it possible to change the text ("Loading...") inside the progress bar, or omit it?

Link to comment
Share on other sites

Sure, you have to pass the 7th argument in the function call to change the text. It is pre defined.

Br,

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

Link to comment
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
 Share

×
×
  • Create New...