Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease 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!
Back to article list Search Articles Add Comment Printer friendly Direct link Windows API: Using SHFileOperation to copy files using progress window 2002-10-31 -- Leonid Chudakov Newsgroups: softvelocity.products.c55ee
SHFILEOPSTRUCT GROUP,TYPE
hWnd LONG
wFunc LONG
pFrom LONG
pTo LONG
fFlags SHORT
fAnyOperationsAborted LONG
hNameMappings LONG
lpszProgressTitle LONG
END
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.
FOF_WANTMAPPINGHANDLE EQUATE(0020H) ! Fill in
SHFILEOPSTRUCT.hNameMappings
! Must be freed using
SHFreeNameMappings
FOF_ALLOWUNDO EQUATE(0040H)
FOF_FILESONLY EQUATE(0080H) ! on *.*, do only files
FOF_SIMPLEPROGRESS EQUATE(0100H) ! means don't show names of files
FOF_NOCONFIRMMKDIR EQUATE(0200H) ! don't confirm making any needed
dirs
FOF_NOERRORUI EQUATE(0400H) ! don't put up error UI
FOF_NOCOPYSECURITYATTRIBS EQUATE(0800H) ! dont copy NT file Security
Attributes
result LONG
fileop LIKE(SHFILEOPSTRUCT)
Source CSTRING(128)
Dest CSTRING(128)
code
fileop.hwnd = 0{prop:handle}
fileop.wFunc = FO_COPY
!The files to copy separated by Nulls and terminated by 2 nulls
Source = Clip(Source) & '<0,0>'
fileop.pFrom = Address(Source)
!The directory or filename(s) to copy into terminated in 2 nulls
Dest = Clip(Dest) & '<0,0>'
fileop.pTo = Address(Dest)
fileop.fFlags = FOF_ALLOWUNDO+FOF_SIMPLEPROGRESS
result = SHFileOperation(fileop)
If result <> 0 Then !Operation failed
Message('Error')
Else
If fileop.fAnyOperationsAborted <> 0 Then
Message('Operation Failed')
End
End
"Franjo"
Today is November 21, 2024, 6:34 am This article has been viewed 35221 times. Google search has resulted in 189 hits on this article since January 25, 2004.
|
|