Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copying files and reading directories
Message
De
09/02/2002 21:26:46
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00617463
Message ID:
00617945
Vues:
45
>This is a serious question even though it sounds sarcastic: If that's all you need, what is all the other stuff in Ed's example for? I'm sure it all serves a purpose since it wouldn't make any sense for him to throw in a bunch of stuff you don't need. I guess what I'm asking is what does his do that yours doesn't? Which probably isn't the best question for you since you said you hadn't used his. :) But maybe someone else reading the thread has used Ed's example and can chime in?

SHFileOperation() will do considerably more than CopyFile() - it allows the specification of multiple source file masks, multiple target directories, overwrite behaviors, recovery from errors encountered in the execution, the display of the Windows dialog and animations and recursion of subfolders when copying. It supports undo operations and confirmation dialogs. It also will handle Delete, Move and Rename functions. It supports collision prevention (rename files when the file currently exists in the target directory.) It will perform a copy when the file is open as long as it is shared and no write locks have been issued. It will work without having the WSH installed, as long as the necessary Shell version has been installed.

IOW, the two are not the same - SHFileOperation() offers support for the functions done by CopyFile(), and much more.

>>Michelle,
>>
>>Only a kind of answer to Q1. Never used SHFileOperation.
>>It's straight and simple
>>
>>
>>declare Integer CopyFile in win32api string @, string @, Integer
>>local FileFrom, FileTo
>>
>>FileFrom ='C:\tmp\xxx'
>>FileTo = 'c:\tmp\yyy'
>>if( empty(CopyFile(@File_From, @File_To, 0)) )
>>	return FALSE && Failed
>>endif
>>
>>you can find the doc at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/filesio_0x9h.asp
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform