While-Schleife bleibt stehen ?

  • Guten Abend,

    Ich habe momentan dieses Script:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <ListviewConstants.au3>
    #include <GuiListView.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $x=0

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Fenster = GUICreate("Server Manager", 810, 330, 275, 234)
    $Input_Message = GUICtrlCreateInput("", 30, 55, 200, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $Button_Send = GUICtrlCreateButton("Send", 250, 55, 40, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $ListView_Online = GUICtrlCreateListView("Online Users", 32, 100, 90, 200)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $ListView_Banned = GUICtrlCreateListView("Banned Users", 132, 100, 90, 200)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $ListView_Verlauf = GUICtrlCreateListView("Von|An|Text", 250, 100, 520, 200)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    GUICtrlCreatePic(@ScriptDir & "\vistatrends_wallpaper_avantzone.jpg", 0, 0, 812, 332, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    GUICtrlCreateLabel("Verlauf", 450, 55, 100, 20, $SS_CENTER)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetColor(-1, 0x27A9FF)
    GUICtrlSetBkColor(-1, $gui_bkcolor_transparent)
    GUICtrlCreateLabel("AutoIt Server Management", 180, 16, 250, 26, $SS_CENTER)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetColor(-1, 0x27A9FF)
    GUICtrlSetBkColor(-1, $gui_bkcolor_transparent)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateListViewItem("Server|Alle|[12:04:34]Jetzt wird ein Packet vom Server an Alle Benutzer die Online sind gesendet",$ListView_Verlauf)

    [/autoit] [autoit][/autoit] [autoit]

    Do
    Sleep(10)
    $x+=1
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $x = ' & $x & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $msg = GUIGetMsg()
    Until $msg == -3

    [/autoit]

    Das Problem ist jetzt: Sobald ich in den "Header" des Fensters klicke oder auf die Scrollbar beim Listview des Verlaufs zählt die Variable $x nicht mehr weiter hoch bzw. die While- Schleife läuft nicht weiter 8|

    Hat jemand vielleicht eine Idee, wie ich diese Situation überbrücken kann, damit $x sich ständig hochzählt ?

    Vielen Dank im Voraus

    Lg, Fabian

    Einmal editiert, zuletzt von Fabian (20. Juli 2010 um 21:42)

  • Kann ich leider nicht nachvollziehen. Bei mir läuft die Schleife Problemlos weiter.

    Sorry, habe mich falsch gedrückt..

    Wenn ich mit mit der Linken Maustaste drauf drücke und dann die Maustaste halte bleibt die Schleife stehen, bis ich die Maustaste wieder loslasse.

  • Aaaah, das macht schon mehr Sinn.
    Das ist Windows Verhalten, das man nur mit dreckigen Tricks umgehen kann:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <Timers.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Global $x = 0

    [/autoit] [autoit][/autoit] [autoit]

    #region ### START Koda GUI section ### Form=
    $Fenster = GUICreate("Server Manager", 810, 330, 275, 234)
    $Input_Message = GUICtrlCreateInput("", 30, 55, 200, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $Button_Send = GUICtrlCreateButton("Send", 250, 55, 40, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $ListView_Online = GUICtrlCreateListView("Online Users", 32, 100, 90, 200)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $ListView_Banned = GUICtrlCreateListView("Banned Users", 132, 100, 90, 200)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $ListView_Verlauf = GUICtrlCreateListView("Von|An|Text", 250, 100, 520, 200)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    GUICtrlCreatePic(@ScriptDir & "\vistatrends_wallpaper_avantzone.jpg", 0, 0, 812, 332, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    GUICtrlCreateLabel("Verlauf", 450, 55, 100, 20, $SS_CENTER)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetColor(-1, 0x27A9FF)
    GUICtrlSetBkColor(-1, $gui_bkcolor_transparent)
    GUICtrlCreateLabel("AutoIt Server Management", 180, 16, 250, 26, $SS_CENTER)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetColor(-1, 0x27A9FF)
    GUICtrlSetBkColor(-1, $gui_bkcolor_transparent)
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateListViewItem("Server|Alle|[12:04:34]Jetzt wird ein Packet vom Server an Alle Benutzer die Online sind gesendet", $ListView_Verlauf)
    _Timer_SetTimer($Fenster, 10, "_GUIGetMsg")
    While Sleep(10)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUIGetMsg($hWnd, $Msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    $x += 1
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $x = ' & $x & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
    $msg = GUIGetMsg()
    Switch $msg
    Case -3
    _Timer_KillAllTimers($Fenster)
    Exit
    EndSwitch
    EndFunc ;==>_GUIGetMsg

    [/autoit]

    LG

  • Danke, kann es sein, dass es zu Problemen führt, wenn man noch Adlibregister hat?
    Weil zwischendurch hängt sich mein Script einfach auf..

  • Ich hab nicht umsonst "dreckige Tricks" gesagt. Das ganze ist sehr instabil (lass mal zum Spaß die Parameter der _GUIGetMsg() Funktion weg :P)


    Ich kann dein Problem mit AdlibRegister aber nicht nachvollziehen.
    Ohne dein Script zu sehen kann ich da leider nicht viel zu sagen.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <Timers.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Global $x = 0

    [/autoit] [autoit][/autoit] [autoit]

    #region ### START Koda GUI section ### Form=
    $Fenster = GUICreate("Server Manager", 810, 330, 275, 234)
    $Input_Message = GUICtrlCreateInput("", 30, 55, 200, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $Button_Send = GUICtrlCreateButton("Send", 250, 55, 40, 20)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $ListView_Online = GUICtrlCreateListView("Online Users", 32, 100, 90, 200)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $ListView_Banned = GUICtrlCreateListView("Banned Users", 132, 100, 90, 200)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    $ListView_Verlauf = GUICtrlCreateListView("Von|An|Text", 250, 100, 520, 200)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x716F64)
    GUICtrlCreatePic(@ScriptDir & "\vistatrends_wallpaper_avantzone.jpg", 0, 0, 812, 332, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    GUICtrlCreateLabel("Verlauf", 450, 55, 100, 20, $SS_CENTER)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetColor(-1, 0x27A9FF)
    GUICtrlSetBkColor(-1, $gui_bkcolor_transparent)
    GUICtrlCreateLabel("AutoIt Server Management", 180, 16, 250, 26, $SS_CENTER)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetColor(-1, 0x27A9FF)
    GUICtrlSetBkColor(-1, $gui_bkcolor_transparent)
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateListViewItem("Server|Alle|[12:04:34]Jetzt wird ein Packet vom Server an Alle Benutzer die Online sind gesendet", $ListView_Verlauf)
    _Timer_SetTimer($Fenster, 10, "_GUIGetMsg")
    AdlibRegister("_AdlibTest",250)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While Sleep(10)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUIGetMsg($hWnd, $Msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    $x += 1
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $x = ' & $x & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
    $Msg = GUIGetMsg()
    Switch $Msg
    Case -3
    _Timer_KillAllTimers($Fenster)
    Exit
    EndSwitch
    EndFunc ;==>_GUIGetMsg

    [/autoit] [autoit][/autoit] [autoit]

    Func _AdlibTest()
    Local Static $iCnt = 0
    $iCnt += 1
    ConsoleWrite(@CRLF & @CRLF & @CRLF & "+========================> TEST #" & $iCnt & @CRLF & @CRLF & @CRLF)
    EndFunc ;==>_AdlibTest

    [/autoit]