Muss aber doch nochmal doof nachfragen:
in --> Func __GUIctrlCreateLabel_Blink_Blink($hWnd, $Msg, $iIDTimer, $dwTime)
werden zwar Parameter angegeben - aber wofür? Sie tauchen nicht in der Funktion selbst auf oder werden übergeben. Zwar werden die Parameter in der ersten Funktion als "Default" geseetzt, aber welchen Sinn steckt hier dahinter?!?!
Die ganze Timergeschichte läuft über DLLCallbacks ab. Da gibts ein bestimmtes Schema, das gewahrt werden muss. Schuld ist Microsoft.
Entfern mal Testweise die Paramter aus dem Funktionksaufruf (also so:)
Spoiler anzeigen
#include <Array.au3>
#include <Timers.au3>
$hGui = GUICreate("")
_GuiCtrlCreateLabel_Blink("Test", 20, 20, 1000)
_GuiCtrlCreateLabel_Blink("Test 2 ", 30, 200, 200)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
EndSwitch
WEnd
Func _GuiCtrlCreateLabel_Blink($sText, $iPosX, $iPosY, $iBlinkRate, $iFontSize = 8.5, $sFont = 'Microsoft Sans Serif', $sColor = 0x000000, $sBlinkColor = 0xff0000)
Local Static $aStaticLabel
Local Static $hTimerGUI
Local $hLabel
If $sText = "~RETURN_ARRAY" Then Return $aStaticLabel
If $sText = "~RETURN_THGUI" Then Return $hTimerGUI
If $sText = "~SET_ARRAY" Then
$aStaticLabel = $iPosX
Return 0
EndIf
GUISetFont($iFontSize, 400, 0, $sFont)
GUICtrlSetColor($hLabel, $sColor)
$hLabel = GUICtrlCreateLabel($sText, $iPosX, $iPosY)
Local $hGui = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", GUICtrlGetHandle($hLabel))
$hGui = $hGui[0]
If $hTimerGUI <> $hGui Then $hTimerGUI = $hGui
GUICtrlSetFont($hLabel, $iFontSize, Default, $sFont) ;
[/autoit] [autoit][/autoit] [autoit]Local $aLabel = $aStaticLabel
Local $iUB = UBound($aLabel)
If $iUB > 0 Then ReDim $aLabel[$iUB + 1][6]
If $iUB = 0 Then Local $aLabel[2][6], $iUB = 1
$aLabel[$iUB][0] = $hLabel
$aLabel[$iUB][1] = TimerInit()
$aLabel[$iUB][2] = $iBlinkRate
$aLabel[$iUB][3] = $sColor
$aLabel[$iUB][4] = $sBlinkColor
$aLabel[$iUB][5] = False
$aStaticLabel = $aLabel
__GUIctrlCreateLabel_Blink_Blink()
Return $hLabel
EndFunc ;==>_GuiCtrlCreateLabel_Blink
[/autoit] [autoit][/autoit] [autoit]Func __GUIctrlCreateLabel_Blink_Blink()
Local $hTimerGUI = _GuiCtrlCreateLabel_Blink("~RETURN_THGUI", 0, 0, 0), $iTimerMin = -1
Local $aArray = _GuiCtrlCreateLabel_Blink("~RETURN_ARRAY", 0, 0, 0), $iUB = UBound($aArray)
_Timer_KillAllTimers($hTimerGUI)
For $i = 1 To $iUB - 1
If TimerDiff($aArray[$i][1]) > $aArray[$i][2] Then
$aArray[$i][1] = TimerInit()
$aArray[$i][5] = Not $aArray[$i][5]
GUICtrlSetColor($aArray[$i][0], ($aArray[$i][4] * ($aArray[$i][5] = True)) + ($aArray[$i][3] * ($aArray[$i][5] = False)))
EndIf
If ($iTimerMin = -1) Or ($aArray[$i][2] - TimerDiff($aArray[$i][1]) < $iTimerMin) Then
$iTimerMin = ($aArray[$i][2] - TimerDiff($aArray[$i][1]))
EndIf
Next
_Timer_SetTimer($hTimerGUI, $iTimerMin, "__GUIctrlCreateLabel_Blink_Blink")
_GUIctrlCreateLabel_Blink("~SET_ARRAY",$aArray,0,0)
EndFunc ;==>__GUIctrlCreateLabel_Blink_Blink
[/autoit]Das Script wird abstürzen / aufhängen. Lange Rede kurzer Sinn: Es muss einfach dahin
EDIT: Hier auch nochmal zum Nachlesen:
http://msdn.microsoft.com/de-de/library/49313fdf.aspx
ZitatAlles anzeigenA time-out value is specified, and every time a time-out occurs, the system posts a WM_TIMER message to the installing application's message queue or passes the message to an application-defined TimerProc callback function.
The lpfnTimer callback function need not be named TimerProc, but it must be defined as follows:
void CALLBACK EXPORT TimerProc(
HWND hWnd, // handle of CWnd that called SetTimer
UINT nMsg, // WM_TIMER
UINT nIDEvent // timer identification
DWORD dwTime // system time
);