Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Timer base class
Message
De
08/02/2004 17:17:30
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
08/02/2004 17:09:44
Victor Lapid
Phil. Long Distance Tel. Co.
Manila, Philippines
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00875287
Message ID:
00875289
Vues:
21
>Hi,
>
> I've created a DLL using a timer object to perform a certain task continuosly. I tried to create the object manually in VFP using createobject
>and it seems to work but the timer doesn't work continuosly.
>
> code:
> define class Process as custom olepublic
> ADD OBJECT TimerObj as Timer
>
> interval = 5000
> Enabled = .T.
>
> Procedure timer
>
> cEwsdFle="F:\ewsd\notes.og"
> if !file((cEwsdFle))
> cPath=fcreate((cEwsdFle),0)
> else
> cPath=fopen((cEwsdFle),2)
> =FPUTS(cPath,"creating log file,this is only a test")
> =fclose(cPath)
> endif
> endproc
>
>enddefine
> Thanks for any help

The logging to a file can be greatly simplified with the StrToFile() command. Use the last parameter (third, is it?), to append instead of overwriting the file.

As to the timer, it will not execute if VFP, or Windows, is busy doing something else. In VFP, the timer will only execute when VFP is waiting for user input - it will NOT trigger during the execution of a long query, for instance. The timer from www.bbcontrols.com is supposed to solve this problem. But an independently running EXE might also work.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform