Another question on this subject. When copying files from a CD-rom to the hard drive, those files have the read-only attribute by default.
In order to enable later updates (file replacements) the files should'nt have this attrib. Of course, I know how to change their attribs one-by-one (after SHFileOperation has been performed), but it would be far nicer if an attrib-reset could be integrated in SHFileOperation.
Don't find anything about this in Win32.hlp, unfortunately.
Is it possible?
------------------
mailto:[email protected][email protected]</A>
www.basicguru.com/zijlema/
[This message has been edited by Egbert Zijlema (edited February 14, 2001).]
Announcement
Collapse
No announcement yet.
File operations, using ShFileOpStruct
Collapse
X
-
Yes, better to refresh from the directory list, since it is possible the file list may have been changed by other apps or processes and if you do not recurse the directory you may be out of sync with the real directory contents.
Yes, you'll need to add them all one-by-one. However, to speed up the operation, set the redraw state of the listbox to FALSE before the list update, and then reenable the redraw state at the end.
See %WM_SETREDRAW for more information.
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Leave a comment:
-
Tom,
Thanks very much!
I've struggled too long with ASCIIZ-strings, thinking they have already a CHR$(0) at the end. A dynamic string, as in your example, does the job perfectly.
Now about my second question. When a callback function uses %LBS_GETSELCOUNT in order to trace a multiple selection (instead of -for instance- %LBS_GETCURSEL), you don't know the relative position of the selected elements within the listbox-array. How to erase the names of the deleted files from the array? Somebody out there?
I was thinking about the following:
1. reset the listbox (box is empty now)
2. recollect the leftover files in the directory
3. replace the refreshed array in the listbox. BUT: how? LISTBOX ADD only accepts one element, not an array. Replace them one by one?
------------------
mailto:[email protected][email protected]</A>
www.basicguru.com/zijlema/
[This message has been edited by Egbert Zijlema (edited February 07, 2001).]
Leave a comment:
-
The file list works something like:
Code:sFilesToDelete$ = "file1.txt" + CHR$(0) + "file2.txt" + CHR$(0, 0) foo.pFrom = STRPTR(sFilesToDelete$)
there's an easier way.
------------------
Tom Hanlin
PowerBASIC Staff
Leave a comment:
-
File operations, using ShFileOpStruct
Hello fellows,
I'm playing around with file operations (copy, delete, move) using SHFILEOPSTRUCT.
The names of the files to delete are displayed in a listbox. As long as the user selects only one filename, there is no problem. But what if a multiple selection will take place?
Two questions:
1. How to delete a bundle of files in 1 run? According to Win32.hlp this should be possible, but either I don't understand Microsoft's explanation or this explanation fails. Quote: "pFrom - Pointer to a buffer that specifies one or more source file names. Multiple names must be null-separated. The list of names must be double null-terminated."
2. How to remove the deleted files from the array list? That can only be done if you know the element's relative position in the listbox array, but how to retrieve it?
------------------
mailto:[email protected][email protected]</A>
www.basicguru.com/zijlema/
[This message has been edited by Egbert Zijlema (edited February 07, 2001).]Tags: None
Leave a comment: