Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Timers
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Timers
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01521261
Message ID:
01521364
Vues:
64
Thanks for the info !

>In the code below, a timer:
>
>- is not affected by INKEY()
>- blocked by Sleep API
>- runs behind a MESSAGEBOX dialog
>
>One can clearly notice that an execution of a method, or a call, or some background household activity definitely slows it down a bit.
>
>
CLEAR
>PUBLIC oForm
>oForm = CREATEOBJECT('MyForm')
>oForm.Visible = .T.
>
>DEFINE CLASS MyForm As Form
>	Autocenter = .T.
>	MessageBoxShown = .F.
>	StoredSeconds = 0
>
>	ADD OBJECT Timer1 As Timer
>
>PROCEDURE Activate
>	WITH THIS
>		IF NOT .MessageBoxShown
>			.MessageBoxShown = .T.
>			.StoredSeconds = SECONDS()
>			.Timer1.Interval = 500
>
>			.WriteStr('INKEY fires...')
>			= INKEY(2) && 2 seconds
>
>			.WriteStr('SLEEP fires...')
>			DECLARE Sleep IN kernel32 INTEGER dwMilliseconds
>			= Sleep(2000) && 2 seconds
>
>			.WriteStr('MESSAGEBOX fires...')
>			= MESSAGEBOX(VERSION())
>			.WriteStr('MESSAGEBOX exited')
>		ENDIF
>	ENDWITH
>
>PROCEDURE WriteStr(vValue)
>	ACTIVATE SCREEN
>	? vValue
>
>PROCEDURE Timer1.Timer
>	nNewSeconds = SECONDS()
>	ThisForm.WriteStr(nNewSeconds - ThisForm.StoredSeconds)
>	ThisForm.StoredSeconds = nNewSeconds
>
>ENDDEFINE
>
Tommy Tillman A+ NetWork+ MCP
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform