Jump to content

Idling Affects GUI


Biatu
 Share

Recommended Posts

I have come across an issue that affects the performance of a few of my scripts over a period of a few years now. I notice it on Windows 7, 8, and 10.

It happens when I have script run a function that calls other functions, and an adlib is running gui updates. After a few seconds the gui stops responding, or slows

down immediately when my cursor stops moving. If i move the cursor around the screen the script speeds up, weather or not its moving within the gui.

 

Anyone else noticing this?

What is what? What is what.

Link to comment
Share on other sites

;I found that this issue had to do with the adlib loop and GuiGetMsg.
$iProgress=0
$iStop=0
$hGUI=GUiCreate("",512+64,32)
$idProgress=GUICtrlCreateProgress(0,0,512,32)
$idStart=GUICtrlCreateButton("Start",512,0,64,32)
GuiSetState()
While 1
    $iMsg=GuiGetMsg()
    Switch $iMsg
        Case -3
            Exit
        Case $idStart
            AdlibRegister("Update",10)
            GUICtrlSetData($idStart,"Stop")
            Start()
            AdlibUnRegister("Update")
            GUICtrlSetData($idStart,"Start")
            GUICtrlSetData($idProgress,100)
            $iStop=0
    EndSwitch
WEnd

Func Update()
    GUICtrlSetData($idProgress,$iProgress)
    $iMsg=GuiGetMsg()
    Switch $iMsg
        Case -3
            Exit
        Case $idStart
            $iStop=1
    EndSwitch
EndFunc

Func Start()
    For $i=0 to 1000000
        If $iStop Then ExitLoop
        $iProgress=($i/1000000)*100
    Next
EndFunc

 

Edited by Biatu

What is what? What is what.

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...