Habe ein paar Scripte zusammengebastelt und eine neue GUI-Form kreiert.
Credits:
- Authenticity (US-Forum) für Glass-Effekt
- Mr_gitarre (von hier): Progress-Color
Have fun!
Code
#region header
#include<SendMessage.au3>
#include <Date.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#Include <GuiImageList.au3>
#include<ProgressConstants.au3>
Opt("MustDeclareVars", 1)
If Not IsDeclared("WM_DWMCOMPOSITIONCHANGED") Then Global Const $WM_DWMCOMPOSITIONCHANGED = 0x031E
Global Const $PBST_NORMAL = 0x0001
Global Const $PBST_ERROR = 0x0002
Global Const $PBST_PAUSED = 0x0003
Global $i = 0
Global $go = True
Global Const $pauseimg = _GUIImageList_Create(23, 23, 5, 3, 6)
_GUIImageList_AddIcon($pauseimg, "imageres.dll", 102, True)
;~ _GUIImageList_AddIcon($pauseimg, "shell32.dll", 212, True); hover image
Global Const $restartimg = _GUIImageList_Create(23, 23, 5, 3, 6)
_GUIImageList_AddIcon($restartimg, "imageres.dll", 101, True)
;~ _GUIImageList_AddIcon($restartimg, "shell32.dll", 212, True); hover image
Global Const $stopimg = _GUIImageList_Create(23, 23, 5, 3, 6)
_GUIImageList_AddIcon($stopimg, "imageres.dll", 100, True)
;~ _GUIImageList_AddIcon($stopimg, "shell32.dll", 212, True); hover image
Global Const $exitimg = _GUIImageList_Create(23, 23, 5, 3, 6)
_GUIImageList_AddIcon($exitimg, "imageres.dll", 218, True)
;~ _GUIImageList_AddIcon($stopimg, "shell32.dll", 212, True); hover image
#endregion header
Global $hGUI = GUICreate ("Loading...", 110, 83, -1, -1, 0x00400000)
Global $p = GUICtrlCreateProgress (5, 20-14, 340-240, 20)
Global $pause = GUICtrlCreateButton ("", 5, 45-15, 50, 25, 0x0040);Pause
_GUICtrlButton_SetImageList ($pause, $pauseimg, 2)
Global $stop = GUICtrlCreateButton ("", 55, 45-15, 50, 25);Stop
_GUICtrlButton_SetImageList ($stop, $stopimg, 2)
GUICtrlSetImage ($stop, @SystemDir & "\imagere.dll", 101)
Global $hTheme = _WinAPI_OpenThemeData($hGUI, "globals")
Global $childgui = GUICreate ("", 17, 17, 109, 45, 0x80000000, 0x00000040, $hGUI)
_GUICreateRoundRect($childgui, 5, 5)
Global $exit = GUICtrlCreateButton ("", -5, -5+1, 26, 26)
_GUICtrlButton_SetImageList ($exit, $exitimg, 2)
GUIRegisterMsg($WM_ERASEBKGND, "_WM_ERASEBKGND")
GUIRegisterMsg($WM_DWMCOMPOSITIONCHANGED, "_WM_DWMCOMPOSITIONCHANGED")
_SendMessage($hGUI, $WM_DWMCOMPOSITIONCHANGED)
GUISetState (@SW_SHOW, $hGUI)
GUISetState (@SW_SHOW, $childgui)
Global $timer = TimerInit ()
While 1
If $i = 101 Then
GUICtrlSetData ($pause, "Start")
$i = 0
$go = False
EndIf
If $i <= 100 And $go Then
If TimerDiff ($timer) >= 100 Then
GUICtrlSetData ($p, $i+1)
GUICtrlSetData ($p, $i)
$i += 1
$timer = TimerInit ()
EndIf
EndIf
Switch GUIGetMsg ()
Case -3
Exit 0
Case $exit
Exit 0
Case $pause
If $go Then
$go = False
_GUICtrlProgress_SetState($p, $PBST_PAUSED)
_GUICtrlButton_SetImageList ($pause, $restartimg, 2)
ElseIf Not $go Then
$go = True
_GUICtrlProgress_SetState($p, $PBST_NORMAL)
_GUICtrlButton_SetImageList ($pause, $pauseimg, 2)
EndIf
Case $stop
$go = False
_GUICtrlProgress_SetState($p, $PBST_ERROR)
$i = 0
_GUICtrlButton_SetImageList ($pause, $restartimg, 2)
EndSwitch
WEnd
#region functions
_WinAPI_CloseThemeData($hTheme)
GUIDelete()
Exit
Func _WM_ERASEBKGND($hWnd, $iMsg, $iwParam, $ilParam)
Local $hDC = $iwParam
Local $tClientRect = _WinAPI_GetClientRect($hWnd)
Local $hBrush = _WinAPI_GetStockObject($BLACK_BRUSH)
_WinAPI_FillRect($hDC, DllStructGetPtr($tClientRect), $hBrush)
[/autoit] [autoit][/autoit] [autoit]Return 1
EndFunc
Func _WM_DWMCOMPOSITIONCHANGED($hWnd, $iMsg, $iwParam, $ilParam)
Local $tMargs = DllStructCreate($tagMARGINS)
If _WinAPI_DwmIsCompositionEnabled() Then
For $i = 1 To 4
DllStructSetData($tMargs, $i, -1)
Next
_WinAPI_DwmExtendFrameIntoClientArea($hWnd, $tMargs)
EndIf
Return 0
EndFunc
Func _WinAPI_DwmExtendFrameIntoClientArea($hWnd, ByRef $tMargins)
Local $aResult = DllCall("dwmapi.dll", "int", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($tMargins))
If @error Then Return SetError(@error, @extended, -1)
Return $aResult[0]
EndFunc
Func _WinAPI_DwmIsCompositionEnabled()
Local $aResult = DllCall("dwmapi.dll", "int", "DwmIsCompositionEnabled", "int*", 0)
If @error Then Return SetError(@error, @extended, -1)
Return SetError($aResult[0], 0, $aResult[1])
EndFunc
Func _WinAPI_OpenThemeData($hWnd, $sClassList)
Local $aResult = DllCall("uxtheme.dll", "hwnd", "OpenThemeData", "hwnd", $hWnd, "wstr", $sClassList)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] = 0 Then Return SetError(1, 0, 0)
Return SetError(0, 0, $aResult[0])
EndFunc
Func _WinAPI_CloseThemeData($hTheme)
Local $aResult = DllCall("uxtheme.dll", "int", "CloseThemeData", "hwnd", $hTheme)
If @error Then Return SetError(@error, @extended, 0)
Return SetError(0, 0, $aResult[0] = 0)
EndFunc
Func _GUICtrlProgress_SetState($iProgress, $iState)
; Author: Prog@ndy
Switch IsHWnd($iProgress)
Case True
Return _SendMessage($iProgress, $PBM_SETSTATE, $iState, 0)
Case Else
Return GUICtrlSendMsg($iProgress, $PBM_SETSTATE, $iState, 0)
EndSwitch
EndFunc ;==>_GUICtrlProgress_SetState
Func _GUICreateRoundRect($hwnd, $radx=15,$rady=15)
Local $pos = WinGetPos($hwnd)
Local $1 = 0
Local $2 = 0
Local $3 = $pos[2]
Local $4 = $pos[3]
Local $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $1, "long", $2, "long", $3, "long", $4,"long",$radx,"long",$rady)
DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hwnd, "long", $ret[0], "int", 1)
EndFunc ;==>_GUICreateRoundRect
#endregion functions