Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File in Use Question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00135468
Message ID:
00136185
Vues:
36
>>>Using vfp6.0
>>>
>>>I have a program that creates a .dbf file (fox2 format) to be used by MS Word for mail merge. Everytime a user creates labels, it also issues a 'copy to myMrgFile type fox2'. My .exe file never opens the file. But --- heres a scenerio I am expecting:
>>>
>>>1) User has my .exe and MS Word open.
>>>2) User is in the middle of a mail merge and notices names are missing.
>>>3) User switches to my vfp .exe and pulls another query.
>>>4) Vfp .exe file attempts to 'copy to myMrgFile type fox2' but since Word has it open - it fails.
>>>
>>>I am dealing with very elderly people, most of which do not know how to use mail merges. I don't want to use a putfile().
>>>
>>>Question:
>>>How can I find out if myMrgFile.dbf is open by another program (not necessarily Word)?
>>>
>>>Robert
>>
function inuse
>>lparameters cfilename
>>handle=fopen(cfilename)
>>if handle>0
>> =fclose(handle)
>> return .f.
>>endif
Cetin
>
>
>Cetin,
>This worked great. Thanks.
>
>Robert

Hello Robert,

Though Cetin is right but it would be better to find out what caused FOPEN() to return -1. I mean error could be something else. I sugget you to use FERROR() function to determine exact error. It this error is 'File Access Denied'. then do whatever you want to do.

Bye
Jayesh
- Jayesh
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform