Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is a SCX open somewhere
Message
De
12/02/2009 17:56:07
 
 
À
12/02/2009 13:34:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Divers
Thread ID:
01381369
Message ID:
01381454
Vues:
33
>How do I determine if a form is open for editing somewhere and then bypass my attempt to open the .SCX

TRY - CATCH - ENDTRY would be the best; but alas, it is not available in vers 7. You can use an ON ERROR handler but that could be cumbersome. I would try the following:
lcFilePath = GETDIR()
IF !EMPTY(lcFilePath)
  lcFilePath = ADDBS(lcFilePath)
  lnFileCnt = ADIR(laFiles,lcFilePath+"*.scx")
  FOR lnFile=1 TO lnFileCnt
    lcFile = lcFilePath + laFiles[lnFile,1]
    lhFile = FOPEN(lcFile,0)
    IF lhFile > 0
       =FCLOSE(lhFile)
       USE (lcFile) IN 0 ALIAS my_scx
    ELSE
      WAIT WINDOW "File in Use: " + lcFile
    ENDIF
  ENDFOR
ENDIF
The FOPEN command will not throw an exception if it cannot open the file -- the file handle returned of 0 indicates failure. Whereas, USE will cause an error.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform