Jump to content

Wanted a timer that does not use WM_TIMER for callback


Recommended Posts

Hi,

I need a timer that does not pause when the windows title bar has the mouse button held down on it.

For an example:

HotKeySet("{esc}","_exit")
Global $ticks = 0

GUICreate("hold mouse down on title")
GUISetState(@SW_SHOW)

AdlibRegister("tick",100)
while True
WEnd

Func tick()
$ticks +=1
ToolTip($ticks)
EndFunc

Func _Exit()
Exit
EndFunc

I suspect AdLibRegister is responding to the WM_TIMER event.

ditto for _TIMER_SETTIMER UDF

Note: sometimes the timer stops when other windows are mouse downed (e.g. the system taskbar)

So I am looking for something that allows you to call it with a callback, returns to the code then invokes a callback at a certain point in the future.

Thanks

Link to comment
Share on other sites

Check this

Hold the click but the still the function would be executed.

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

$hGUI = GUICreate("")
WinSetOnTop($hGUI, "", 1) ;So that you can see the Window even you click the Taskbar

Global $iLabel = GUICtrlCreateLabel("100", 10, 10)
$iTimer = _Timer_SetTimer($hGUI, 250, "CountDown") ;Set the TIMER
GUISetState()

While GUIGetMsg() <> $GUI_EVENT_CLOSE
Sleep(10)
WEnd
_Timer_KillTimer($hGUI, $iTimer)

Func CountDown($hWnd, $iMsg, $wParam, $lParam)

$iRead = Int(GUICtrlRead($iLabel))
If $iRead = 0 Then $iRead = 10001
GUICtrlSetData($iLabel, $iRead - 1)

EndFunc

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

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