Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6 and Excel
Message
De
18/11/2003 09:46:26
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00806542
Message ID:
00850973
Vues:
26
>Hilmar
>
>I used your code...
* If you can obtain R/W access to a file, delete it
local lnMyFile
lnMyFile = fopen("c:\global\clientstats.xls", 2)
if lnMyFile > 0
  fclose(lnMyFile)
  * Some command is missing here
endif
Well, the original idea is to insert something into the place marked with "some command is missing here". Here, you can delete an un-needed file, or perhaps call up the e-mail program. All this, AFTER closing the file with fclose(), and only if the test (if lnMyFile > 0) is true.

Also, perhaps my code maintains the file open. fclose() is supposed to close it, however.

All this code is designed to test whether you have access to the file. Only if you have access should you start the e-mail process, or whatever.

Oh, and also, I forgot that you must disable the Timer object, once the check is positive. Otherwise, it will continue opening and closing the file every 5 seconds!

Let's assume the entire code above is in the Timer:
* If you can obtain R/W access to a file, delete it
local lnMyFile
lnMyFile = fopen("c:\global\clientstats.xls", 2)
if lnMyFile > 0
  fclose(lnMyFile)
  This.Enabled = .F. && This will disable the timer
  * Invoke the e-mail processing here
endif
Perhaps you can figure out what is the best moment to enable the Timer (to start checking if it can access the file).

HTH,

Hilmar.
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