...es scheint hier zu eine Art Puffer- oder Speicherüberlauf zu kommen ?
Durch setzen von AdlibEnable - Neuaufruf der Funktion kann dieser nicht mehr entstehen.
Auch die CPU-Last bei ca. 5% finde ich vertretbar !
Spoiler anzeigen
; Graphic-Uhr by Oscar
; mit Anpassungen von Bernd670
; mit Anpassungen von Ritzelrocker04
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
Opt('MustDeclareVars', 1)
Opt('GUIOnEventMode', 1)
Global $gui_digit[6], $dColor = 0xff2222, $eColor = 0x000000, $bgColor = 0xc0c0c0
Global $s = -1, $m = -1, $h = -1, $hh, $hm, $hs, $ls, $rs
Global $number, $digit ;by RR04
[/autoit] [autoit][/autoit] [autoit]GUICreate('test', 800, 480, -1, -1, $WS_POPUP, BitOr($WS_EX_TOOLWINDOW, $WS_EX_LAYERED))
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, '_MoveWindow')
GUISetOnEvent($GUI_EVENT_CLOSE,'_End')
GUISetBKColor($bgColor) ; Hintergrundfarbe setzen
$gui_digit[0] = GUICtrlCreateGraphic(20, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
$gui_digit[1] = GUICtrlCreateGraphic(60, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
_Colon(103, 20)
$gui_digit[2] = GUICtrlCreateGraphic(120, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
$gui_digit[3] = GUICtrlCreateGraphic(160, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
_Colon(203, 20)
$gui_digit[4] = GUICtrlCreateGraphic(220, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
$gui_digit[5] = GUICtrlCreateGraphic(260, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
GUICtrlCreatePic(@ScriptDir & '\nicht loeschen.gif', 0, 0, 1, 1) ; wird für die Transparenz benötigt (nicht löschen)
GUISetState()
AdlibEnable("_DigitShow", 400) ;by RR04
[/autoit] [autoit][/autoit] [autoit]While 1
$hh = @HOUR
If $hh <> $h Then
GUISetState(@SW_LOCK)
If $hh = "00" Then
GUICtrlDelete($gui_digit[0])
GUICtrlDelete($gui_digit[1])
$gui_digit[0] = GUICtrlCreateGraphic(20, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
$gui_digit[1] = GUICtrlCreateGraphic(60, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
EndIf
$ls = StringLeft($hh, 1)
$rs = StringRight($hh, 1)
_DigitShow($gui_digit[0], $ls)
_DigitShow($gui_digit[1], $rs)
$h = $hh
GUISetState(@SW_UNLOCK)
EndIf
$hm = @MIN
If $hm <> $m Then
GUISetState(@SW_LOCK)
If $hm = "00" Then
GUICtrlDelete($gui_digit[2])
GUICtrlDelete($gui_digit[3])
$gui_digit[2] = GUICtrlCreateGraphic(120, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
$gui_digit[3] = GUICtrlCreateGraphic(160, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
EndIf
$ls = StringLeft($hm, 1)
$rs = StringRight($hm, 1)
_DigitShow($gui_digit[2], $ls)
_DigitShow($gui_digit[3], $rs)
$m = $hm
$h = -1
GUISetState(@SW_UNLOCK)
EndIf
$hs = @SEC
If $hs <> $s Then
GUISetState(@SW_LOCK)
If $hs = "00" Then
GUICtrlDelete($gui_digit[4])
GUICtrlDelete($gui_digit[5])
$gui_digit[4] = GUICtrlCreateGraphic(220, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
$gui_digit[5] = GUICtrlCreateGraphic(260, 20, 32, 56)
GUICtrlSetBkColor(-1, $bgColor)
EndIf
$ls = StringLeft($hs, 1)
$rs = StringRight($hs, 1)
_DigitShow($gui_digit[4], $ls)
_DigitShow($gui_digit[5], $rs)
$s = $hs
GUISetState(@SW_UNLOCK)
EndIf
Sleep(10)
WEnd
Func _Colon($PosX, $PosY)
GUICtrlCreateGraphic($PosX, $PosY, 10, 56)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $eColor, $dColor)
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 12, 10, 10)
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 36, 10, 10)
EndFunc
Func _DigitShow($digit, $number)
Switch $number ; g
Case 2, 3, 4, 5, 6, 8, 9
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $eColor, $dColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 0, 28)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 24)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24, 24)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 32, 28)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24, 32)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 32)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 0, 28)
Case 0, 1, 7
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $bgColor, $bgColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 2, 28)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 9, 24)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 23, 24)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 30, 28)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 23, 32)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 9, 32)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 2, 28)
EndSwitch
Switch $number ; a
Case 0, 2, 3, 5, 6, 7, 8, 9
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $eColor, $dColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 0, 0)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8,
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24,
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 32, 0)
Case 1, 4
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $bgColor, $bgColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 1, 0)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 9,
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 23,
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 31, 0)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 1, 0)
EndSwitch
Switch $number ; b
Case 0, 1, 2, 3, 4, 7, 8, 9
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $eColor, $dColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 32, 0)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24,
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24, 24)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 32, 28)
Case 5, 6
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $bgColor, $bgColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 32, 1)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24, 9)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24, 23)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 32, 27)
EndSwitch
Switch $number ; c
Case 0, 1, 3, 4, 5, 6, 7, 8, 9
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $eColor, $dColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 32, 28)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24, 32)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24, 48)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 32, 56)
Case 2
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $bgColor, $bgColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 32, 29)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24, 33)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24, 48)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 32, 55)
EndSwitch
Switch $number ; d
Case 0, 2, 3, 5, 6, 8, 9
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $eColor, $dColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 0, 56)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 48)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 24, 48)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 32, 56)
Case 1, 4, 7
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $bgColor, $bgColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 1, 56)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 9, 48)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 23, 48)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 31, 56)
EndSwitch
Switch $number ; e
Case 0, 2, 6, 8
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $eColor, $dColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 0, 28)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 32)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 48)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 0, 56)
Case 1, 3, 4, 5, 7, 9
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $bgColor, $bgColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 0, 29)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 33)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 47)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 0, 55)
EndSwitch
Switch $number ; f
Case 0, 4, 5, 6, 8, 9
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $eColor, $dColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 0, 0)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8,
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 24)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 0, 28)
Case 1, 2, 3, 7
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $bgColor, $bgColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 0, 1)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 9)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 23)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 0, 27)
EndSwitch
Switch $Number
Case 1
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $bgColor, $bgColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 0, 0)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 0)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 56)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 0, 56)
Case 4
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $bgColor, $bgColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 0, 33)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 33)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 56)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 0, 56)
Case 7
GUICtrlSetGraphic($digit, $GUI_GR_COLOR, $bgColor, $bgColor)
GUICtrlSetGraphic($digit, $GUI_GR_MOVE, 0, 9)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 9)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 8, 56)
GUICtrlSetGraphic($digit, $GUI_GR_LINE, 0, 56)
EndSwitch
GUICtrlSetGraphic($digit, $GUI_GR_REFRESH)
EndFunc
Func _MoveWindow()
Local $DifX, $DifY, $MouseData = GUIGetCursorInfo(@GUI_WinHandle)
Local $WinPos = WinGetPos(@GUI_WinHandle)
Local $MPos = MouseGetPos()
$DifX = $MPos[0] - $WinPos[0]
$DifY = $MPos[1] - $WinPos[1]
Do
Sleep(15)
$MPos = MouseGetPos()
$MouseData = GUIGetCursorInfo(@GUI_WinHandle)
Until ($WinPos[0] <> ($MPos[0] - $DifX)) Or ($WinPos[1] <> ($MPos[1] - $DifY)) Or (Not $MouseData[2])
While $MouseData[2]
$MPos = MouseGetPos()
$WinPos = WinGetPos(@GUI_WinHandle)
If ($WinPos[0] <> ($MPos[0] - $DifX)) Or ($WinPos[1] <> ($MPos[1] - $DifY)) Then
WinMove(@GUI_WinHandle, '', $MPos[0] - $DifX, $MPos[1] - $DifY)
EndIf
Sleep(15)
$MouseData = GUIGetCursorInfo(@GUI_WinHandle)
WEnd
EndFunc
Func _End()
Exit
EndFunc
Weiterhin viel Erfolg!