Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3034 closed Feature Request (Completed)

_Timer_SetTimer() doc example

Reported by: c.haslam Owned by: J-Paul Mesnage
Milestone: 3.3.13.21 Component: Documentation
Version: Severity: None
Keywords: Cc:

Description

A simple example for newbies might be helpful:

#include <timers.au3>
Global $giMsecs = 0, $gsResult = ''

_Example_TimeOut()

Func _Example_TimeOut()
	Local $hGUI = GUICreate("", 140, 64, -1, -1, 0)
	GUICtrlCreateLabel("Insert a CD into the tray", 8, 8, 115, 17)
	GUISetState(@SW_SHOW)
	Local $iIDtimer = _Timer_SetTimer($hGUI, 1000, "Check_mounted") ; create timer
	While $gsResult=''
		sleep(200)
	WEnd
	MsgBox(0,'',$gsResult)
	_Timer_KillTimer($hGUI,$iIDtimer)
	GUIDelete($hGUI)
EndFunc

Func Check_mounted($hWnd, $iMsg, $iIDTimer,$iTime)
	$gsResult = ''
	If FileExists('E:\') Then	; CD drive letter
		$gsResult = 'inserted'
	Else
		$giMsecs += 1000
		If $giMsecs=10000 Then
			$gsResult = 'timed out'
		EndIf
	EndIf
EndFunc

This exmaple might also be included for _Timer_KillTimer.

Attachments (0)

Change History (6)

comment:1 by c.haslam, 11 years ago

Insert this line into Check_mounted():

#forcedef $hWnd, $iMsg, $iIDTimer,$iTime

comment:2 by J-Paul Mesnage, 11 years ago

Type: BugFeature Request

comment:3 by J-Paul Mesnage, 11 years ago

it is request not a bug

comment:4 by J-Paul Mesnage, 11 years ago

Summary: _Timer_SetTimer_Timer_SetTimer() doc example

comment:5 by J-Paul Mesnage, 11 years ago

Milestone: 3.3.13.21
Owner: set to J-Paul Mesnage
Resolution: Completed
Status: newclosed

Added by revision [11310] in version: 3.3.13.21

comment:6 by TicketCleanup, 11 years ago

Version: 3.3.13.20

Automatic ticket cleanup.

Modify Ticket

Action
as closed The owner will remain J-Paul Mesnage.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.