Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delay
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Delay
Divers
Thread ID:
00082094
Message ID:
00082206
Vues:
29
>>I have a function that must be executed continously over a period of one second.
>>
>>I've previously achieved this with the following code:
>>
>>st = GetTickCount() + 1000
>>do while GetTickCount() < st
>> TMValidSession(session_handle)
>>enddo
>>
>>(The function GetTickCount() is a KERNEL32.DLL API Call, and the
>>function TMValidSession() is an API-call to a DLL that communicates
>>with a network of temperature sensors)
>>
>>The problem with the above code, is the amount of CPU-power it consumes. This causes problems for other applications running
>>on my system.
>>
>>I've been told that this C-code is more CPU-friendly:
>>
>>for (i = 0; i < 5; i++)
>>{
>>   TMValidSession(session_handle);
>>   Sleep(200);
>>}
>>
>>How can I write function similar to Sleep(), in FoxPro?
>>
>>---
>>
>>Werner Vesteraas, SIMGUARD AS
>
>In addition to George and Edward's suggestions, possibly use the INKEY() function?
>
>Bill

I second on this one!
INKEY is a wait state that consume no processor time (or so little...)

:0)
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform