Comment savoir si un fichier est ouvert ?

Résolu
cs_soulama Messages postés 8 Date d'inscription lundi 13 mars 2006 Statut Membre Dernière intervention 7 mai 2007 - 24 mars 2006 à 09:50
cs_tsiky Messages postés 10 Date d'inscription mercredi 5 avril 2006 Statut Membre Dernière intervention 24 juillet 2006 - 6 avril 2006 à 14:03
je dois copier des fichiers de minimum 5G Byte dun pc1 vers pc2.
Lor du procecus de copy je teste avec FileOpen(Fichier, share_exclusiv) mais ca me di toujour que le fichier né pas
ouver?

7 réponses

cs_soulama Messages postés 8 Date d'inscription lundi 13 mars 2006 Statut Membre Dernière intervention 7 mai 2007
24 mars 2006 à 12:18
merci pour linfo, tu ma bocoup aidé
3
vaughan Messages postés 198 Date d'inscription mardi 6 août 2002 Statut Membre Dernière intervention 29 octobre 2008
24 mars 2006 à 12:00
C'est normal la copie d'un fichier n'ouvre pas le fichier.

Si tu utilise copyfile, test le retour pour avoir la fin de copie Ok

Voir sdk

The CopyFile function copies an existing file to a new file.


BOOL CopyFile(


LPCTSTR lpExistingFileName, // pointer to name of an existing file
LPCTSTR lpNewFileName, // pointer to filename to copy to
BOOL bFailIfExists // flag for operation if file exists
);



Parameters


lpExistingFileName


Points to a null-terminated string that specifies the name of an existing file.


lpNewFileName


Points to a null-terminated string that specifies the name of the new file.


bFailIfExists


Specifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.


Return Values


If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.


Remarks


Security attributes for the existing file are not copied to the new file.
File attributes (FILE_ATTRIBUTE_*) for the existing file are copied to the new file. For example, if an existing file has the FILE_ATTRIBUTE_READONLY file attribute, a copy created through a call to CopyFile will also have the FILE_ATTRIBUTE_READONLY file attribute. For further information on file attributes, see CreateFile.


See Also


CreateFile, MoveFile

vaughan
0
cs_soulama Messages postés 8 Date d'inscription lundi 13 mars 2006 Statut Membre Dernière intervention 7 mai 2007
24 mars 2006 à 12:20
le probleme c que je copie le fichier pas avec une procedur delphi mais externe
0
vaughan Messages postés 198 Date d'inscription mardi 6 août 2002 Statut Membre Dernière intervention 29 octobre 2008
24 mars 2006 à 13:30
Alors il te reste à tester l'existance et la taille de ton fichier d'arrivé

vaughan
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_tsiky Messages postés 10 Date d'inscription mercredi 5 avril 2006 Statut Membre Dernière intervention 24 juillet 2006
6 avril 2006 à 10:51
et comment fait-on pour savoir qu'un fichier est ouvert ou pas?
j'accède à un fichier par une procédure buttonclik mais j'ai besoin de savoir dans une autre procédure (qui se déclenche en cas d'erreur) si le fichier a été ouvert ou pas pour pouvoir le fermer à partir de cette autre procédure. est-ce possible?
0
vaughan Messages postés 198 Date d'inscription mardi 6 août 2002 Statut Membre Dernière intervention 29 octobre 2008
6 avril 2006 à 11:17
Simplement en faisant un test d'ouverture, voici un code by nono40 ...

http://delphi.developpez.com/sources/?page=sec_fic_recherche#nono40source0049

vaughan
0
cs_tsiky Messages postés 10 Date d'inscription mercredi 5 avril 2006 Statut Membre Dernière intervention 24 juillet 2006
6 avril 2006 à 14:03
merci beaucoup, c'était exactement ce que je cherchais!!!
0
Rejoignez-nous