Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's wrong?
Message
De
01/10/2004 09:03:52
 
 
À
01/10/2004 08:42:46
Km Kwun
Eastop Consultants Limited
Nt, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00947862
Message ID:
00947906
Vues:
15
SLEEP(1000) has a BIG advantage over inkey(1). It does not eat all processor time! Actually, it amply uses processor time. Inkey(1) consumes almost 100 percent.

>Hi Fabio,
>
>Thank for confirming that this is a bug of INKEY(1). I solved the problem by replacing it with the SLEEP() API function.
>
>This is an application to monitor the content change of a special shared folder. Every second, it writes a summary of the content change into a new record of a DBF (also displayed on screen using "?") for future analysis. There is neither any form nor control on the screen.
>
>I use a loop rather than the Timer because it is simpler and easier to stepping through to debug.
>
>Very often, the application is run unattendedly as a scheduled task. Therefore "ON SHUTDOWN ..." is necessary so that the running task can be stopped by choosing the STOP option of the Windows Scheduler menu.
>
>KM
>
>
>>>Can anybody tell me what's wrong with this code? Or, can anybody suggest a workaround?
>>>
>>>
>>>x=.T.
>>>On Shutdown x=.F.
>>>
>>>o=Createobject('MyClass')
>>>
>>>Define Class MyClass As Custom
>>>	Function Init
>>>	Do While x
>>>		? Datetime()
>>>		=Inkey(1)
>>>	EndDo
>>>EndDefine
>>>
>>>
>>>In either development time or run time, when we try to close the application, VFP crashes!
>>>
>>>TIA
>>
>>A bug.
>>
>>Crash into VFP8 and VFP9b
>>
>>Preconditions:
>>- On Shutdown is not empty
>>- VFP wait for a keypress with INKEY() or CHRSAW()
>>-
_VFP
process a WM_CLOSE message
>>
>>A more simple repro:
>>
>>DECLARE SHORT PostMessage IN user32;
>>    INTEGER   hWnd,;
>>    INTEGER   Msg,;
>>    INTEGER   wParam,;
>>    INTEGER   lParam
>>
>>On Shutdown KEYBOARD '{SPACEBAR}'
>>
>>=PostMessage(_VFP.hWnd,16,0,0)
>>=CHRSAW(1)
>>
>>
>>WorkAround:
>>use READ EVENTS
>>Fabio
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform