Jump to content

Script stops on drag


Recommended Posts

Why script stops when drag that window?

here is example - when drag windows the $label_1-time is not true :)

#include <GuiConstants.au3>
#include <Date.au3>

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Label_1 = GuiCtrlCreateLabel(_NowTime(), 120, 100, 180, 70)

GuiSetState()

AdlibEnable("now", 1000)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

Func now()
    GUICtrlSetData($Label_1,_NowTime())
EndFunc

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

Not in every prog, like in some installation programs like NSIS ...

:)

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Progress_1 = GuiCtrlCreateProgress(40, 120, 320, 20)

GuiSetState()
    For $i = 10 to 100 Step 1
    GUICtrlSetData($Progress_1,$i)
    Sleep(100)
    Next
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

I thought it might have something to do with not being able to update when the window moves, so the program paused until the window stopped moving when it got to a function that required it to update a moving window, but the pause effect occurred even when no window updates are occuring

GUICreate("Window test",200,200)
GUISetState()

For $z = 0 To 2000000
    If Mod($z,100000) = 0 Then ConsoleWrite($z & @CRLF)
Next

maybe it pauses just in case it finds a window update

but theres a good chance i have no idea what im talking about whatsoever

Edited by crzftx
Link to comment
Share on other sites

Not in every prog, like in some installation programs like NSIS ...

:)

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Progress_1 = GuiCtrlCreateProgress(40, 120, 320, 20)

GuiSetState()
    For $i = 10 to 100 Step 1
    GUICtrlSetData($Progress_1,$i)
    Sleep(100)
    Next
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
;;;
    EndSelect
WEnd
Exit

Hello! Example from this forum:

#include <GuiConstants.au3>

;Global Const $WM_TIMER = 0x0113 ;For old autoit version uncomment this string

Dim $progress = 0

$hGui = GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$StartBtn = GUICtrlCreateButton("Start", 20, 250, 50, 25)
$StopBtn = GUICtrlCreateButton("Stop", 320, 250, 50, 25)

$Progress_1 = GuiCtrlCreateProgress(40, 120, 320, 20)

GuiSetState()

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        TimerDisable($hGui)
        ExitLoop
    Case $msg = $StartBtn
        TimerEnable("Progress", $hGui, 100)
    Case $msg = $StopBtn
        TimerDisable($hGui)
    EndSelect
WEnd

Func TimerEnable($sFunction, $hWnd, $sTime = 100)
    GUIRegisterMsg($WM_TIMER, $sFunction)
    DllCall("User32.dll", "int", "SetTimer", "hwnd", $hWnd, "int", 50, "int", $sTime, "int", 0)
EndFunc

Func TimerDisable($hWnd)
    GUIRegisterMsg($WM_TIMER, "")
    DllCall("user32.dll", "int", "KillTimer", "hwnd", $hWnd, "int*", 50)
EndFunc

Func Progress()
    $progress += 1
    If $progress >= 100 Then $progress = 0
    GUICtrlSetData($Progress_1, $progress)
EndFunc

:P

Edited by rasim
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...