` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please add your comments to this article. Please note that you must provide both a name and a valid email address in order for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Windows API: Using SHFileOperation to copy files using progress window
2005-08-08 -- John Christ
 
Newsgroups: softvelocity.public.clarion6 > Secondly, is there perhaps a better way of doing it. How about using SHFileOperation? GLOBAL embeds, Before File Declarations ! ! Shell File Operations ! FO_MOVE EQUATE(0001h) FO_COPY EQUATE(0002h) FO_DELETE EQUATE(0003h) FO_RENAME EQUATE(0004h) FOF_MULTIDESTFILES EQUATE(0001h) FOF_CONFIRMMOUSE EQUATE(0002h) FOF_SILENT EQUATE(0004h) ! don't create progress/report FOF_RENAMEONCOLLISION EQUATE(0008h) FOF_NOCONFIRMATION EQUATE(0010h) ! Don't prompt the user. ! Fill in SHFILEOPSTRUCT.hNameMappings ! Must be freed using SHFreeNameMappings FOF_WANTMAPPINGHANDLE EQUATE(0020h) FOF_ALLOWUNDO EQUATE(0040h) FOF_FILESONLY EQUATE(0080h) ! on *.*, do only files FOF_SIMPLEPROGRESS EQUATE(0100h) ! means don't show names of files ! don't confirm making any needed dirs FOF_NOCONFIRMMKDIR EQUATE(0200h) FOF_NOERRORUI EQUATE(0400h) ! don't put up error UI ! dont copy NT file Security Attributes FOF_NOCOPYSECURITYATTRIBS EQUATE(0800h) FOF_NORECURSION EQUATE(1000h) ! don't recurse into directories. ! don't operate on connected elements. FOF_NO_CONNECTED_ELEMENTS EQUATE(2000h) ! during delete operation, ! warn if nuking instead of recycling ! (partially overrides FOF_NOCONFIRMATION) FOF_WANTNUKEWARNING EQUATE(4000h) SHFILEOPgroup GROUP, TYPE hwnd UNSIGNED wFunc UNSIGNED pFrom LONG pTo LONG fFlags USHORT fAnyOperationsAborted LONG hNameMappings LONG lpszProgressTitle LONG END ========== GLOBAL embeds, Inside the Global Map MODULE('Windows.lib') SHFileOperation(LONG pSHFILEOPgroup), LONG, PASCAL, | RAW, DLL,NAME('SHFileOperationA') END ========== Data SHFileOp LIKE(SHFILEOPgroup) Source CSTRING(256) Destination CSTRING(256) ========== Insert this where you want to perform the copy: ! This copies an entire directory - note the terminating <0> Source = 'C:\TheSourceDirectory\*.*' & '<0>' ! This would copy 2 files ! The filenames are separated by <0> ! The list is terminated by <0><0> Source = 'file1.exe<0>file2.exe<0><0> Destination = 'C:\TheDestinationDirectory' CLEAR(SHFileOp) SHFileOp.hWnd = 0{PROP:Handle} SHFileOp.wFunc = FO_COPY SHFileOp.pFROM = ADDRESS(Source) SHFileOp.pTo = ADDRESS(Destination) SHFileOp.fFlags = FOF_NOCONFIRMATION + FOF_NOCONFIRMMKDIR SHFileOperation(ADDRESS(SHFileOp)) John


Today is November 23, 2024, 2:24 am
This article has been viewed 35340 times.
Google search has resulted in 139 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: