Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#3034 closed Feature Request (Completed)

_Timer_SetTimer() doc example

Reported by: c.haslam Owned by: Jpm
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 Changed 3 years ago by c.haslam

Insert this line into Check_mounted():

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

comment:2 Changed 3 years ago by Jpm

  • Type changed from Bug to Feature Request

comment:3 Changed 3 years ago by Jpm

it is request not a bug

comment:4 Changed 3 years ago by Jpm

  • Summary changed from _Timer_SetTimer to _Timer_SetTimer() doc example

comment:5 Changed 3 years ago by Jpm

  • Milestone set to 3.3.13.21
  • Owner set to Jpm
  • Resolution set to Completed
  • Status changed from new to closed

Added by revision [11310] in version: 3.3.13.21

comment:6 Changed 3 years ago by TicketCleanup

  • Version 3.3.13.20 deleted

Automatic ticket cleanup.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jpm.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.