Hallo allerseits,
wie kann ich eine schleife sowohl über zeit asl auch über GuiGetMsg steuern?
Hintergrung:
Wenn eine zeit X abgelaufen ist und keine Eingabe erfolgt ist soll einfach weiter verfahren werden.
Hinweis:
Die zeitsteuerung aus der MsgBox kann ich nicht verwenden da ich den Button (beschriftung) selbst erstellen muß.
Mein Code (zugegeben etwas lang):
C
;------------------------------------------------------------------------------------
; Name: Process Checker
;
; Autor: Herbert Piljer
;
; Date: 20.07.2007
;
; Comments: Kills applications declared in processcheck.ini located in the windows directory.
; Syntax of the processcheck.ini:
; - [title] contains the main window description
; - [text] contains the main window content
; - [title_2] contains the warning window description
; - [text_2] contains the warning window content
; - [button] contains the buttons content
; - [set_button] set the button visible or not
; - [process] contains the name of processes to kill
;
;------------------------------------------------------------------------------------
#include <GUIConstants.au3>
Dim $msg, $okbutton, $Handel
Opt("GUICoordMode", 1)
$i = 0
$UHD = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\DaimlerChrysler\Environment", "LocalUHD")
$Text_Array = IniReadSection(EnvGet("windir") & "\processcheck.ini", "text")
$Title_Array = IniReadSection(EnvGet("windir") & "\processcheck.ini", "title")
$Button_Array = IniReadSection(EnvGet("windir") & "\processcheck.ini", "button")
$Pr_Name_Array = IniReadSection(EnvGet("windir") & "\processcheck.ini", "proces")
$Title_2_Array = IniReadSection(EnvGet("windir") & "\processcheck.ini", "titel_2")
$Text_2_Array = IniReadSection(EnvGet("windir") & "\processcheck.ini", "text_2")
$Visible_Array = IniReadSection(EnvGet("windir") & "\processcheck.ini", "set_button")
if @error Then
MsgBox(0,"Error Message", "An error is occured. Please inform the " & $UHD)
Exit
EndIf
$close = 0
$msg = 1
$t = 0
$visible = $Visible_Array[0][0]
$Sl_Time = 5000
$S2_Time = 60000
$Lang_id = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "MultiUILanguageId")
$Lang_id = StringRight($Lang_id, 4)
For $i = 1 to $Text_Array[0][0]
If ($Lang_id = $Text_Array[$i][0]) Then
$Text = $Text_Array[$i][1]
$Title = $Title_Array[$i][1]
$Button = $Button_Array[$i][1]
$Text_2 = $Text_2_Array[$i][1]
$Title_2 = $Title_2_Array[$i][1]
ExitLoop
Else
If ($Text_Array[$i][0] = 0409) Then
$Text = $Text_Array[$i][1]
$Title = $Title_Array[$i][1]
$Button = $Button_Array[$i][1]
$Text_2 = $Text_2_Array[$i][1]
$Title_2 = $Title_2_Array[$i][1]
EndIf
EndIf
Next
For $r = 0 to UBound($Pr_Name_Array) - 1
$Pr_Name = $Pr_Name_Array[$r][0]
While ProcessExists($Pr_Name)
While 1
If WinExists($Title)Then
WinSetOnTop($Title, "", 1)
$x = @DesktopWidth / 2 - 225
$y = @DesktopHeight / 2 -60
WinMove($Title, "", $x, $y, 450, 220)
ExitLoop
ElseIf Not WinExists("Box Demo") Then
$Handel = GUICreate($Title, 450,220)
$x = @DesktopWidth / 2 - 225
$y = @DesktopHeight / 2 - 60
GUICtrlCreateLabel($Text ,20 , 50 , 400, 100, $SS_CENTER , $DS_MODALFRAME )
if ($visible = 1)Then
$okbutton = GUICtrlCreateButton ($Button, 150, 160, 150, 40)
EndIf
GUISetState ()
ExitLoop
EndIf
WEnd
While 1
If (GUIGetMsg() And Not Sleep ($S2_Time) < 0)Then
;If (($msg = GUIGetMsg()))Then
$msg = GUIGetMsg()
select
Case $msg = $GUI_EVENT_CLOSE
GUIDelete($Handel)
MsgBox(0, $Title_2, $Text_2, 5)
While ProcessExists($Pr_Name)
ProcessClose($Pr_Name)
WEnd
ExitLoop
Case $msg = $GUI_EVENT_PRIMARYDOWN
ExitLoop
Case $msg = $GUI_EVENT_MINIMIZE
sleep ($Sl_Time)
GUIDelete($Handel)
ExitLoop
Case $msg = $GUI_EVENT_RESTORE
ExitLoop
Case $msg = $GUI_EVENT_CLOSE
GUIDelete($Handel)
sleep ($Sl_Time)
ExitLoop
Case $msg = $okbutton
GUIDelete($Handel)
While ProcessExists($Pr_Name)
ProcessClose($Pr_Name)
WEnd
ExitLoop
EndSelect
;#comments-start
Else
sleep ($S2_Time)
GUIDelete($Handel)
While ProcessExists($Pr_Name)
ProcessClose($Pr_Name)
WEnd
ExitLoop
EndIf
;#comments-end
If Not ProcessExists($Pr_Name) Then
ExitLoop
EndIf
WEnd
WEnd
Next
Alles anzeigen