#include Once "window9.bi"

Dim Shared As Guint w9T(50000)

Sub KillTimer (hwnd As hwnd = 0 , idTimer As Long)
	
	If w9T(idTimer) Then
		
		g_source_remove_ (w9T(idTimer))
		
	Endif
	
	w9T(idTimer) = 0

End Sub

Sub SetTimer (hwnd As hwnd = 0 , Byref idTimer As Long , iElapse As Long , pTimerProc As Any Ptr)
	
	Dim As Guint pTimer
	
	If w9T(idTimer) Then
	
		KillTimer(0,idTimer)

	Endif
	
	If pTimerProc = 0 Then
	
		pTimer = g_timeout_add(iElapse , @timersfunc , @idTimer)
		
	Else
	
		pTimer = g_timeout_add(iElapse , pTimerProc , @idTimer)

	Endif
	
	w9T(idTimer) = pTimer

End Sub