esk
asked on
API -> CopyFile - DeleteFile - RenameFile ( functions )
i use this functions in my program, and i'm wondering if theese functions is enough good or is better available?
Esk
I agree with TheNeil, you could use the shellapi stuff with fo_copy,fo_rename etc or copyfileex etc(nt) but why complicate things..
ASKER
Do you have any function?
Esk
Esk
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
progressform: TProgressForm;
undeclared intentifier
Esk
undeclared intentifier
Esk
ASKER
progressform: TProgressForm;
undeclared intentifier
Esk
undeclared intentifier
Esk
? form1 : tform1 ...
What about using SHFileOperation, I've used this wrapper with Win95:
function FileOperation(FFrom, FTo: string; Funct, Flags: integer): boolean;
{ Funct values:
FO_COPY Copy the files specified by the pFrom member to the
location specified by the pTo member.
FO_DELETE Delete the files specified by the pFrom member.
The pTo member is ignored.
FO_MOVE Move the files specified by the pFrom member to the
location specified by the pTo member.
FO_RENAME Rename the files specified by the pFrom member.
The pTo member is ignored.
Flags values:
FOF_ALLOWUNDO The specified file is deleted to the recycle bin.
FOF_FILESONLY The operation is performed only on files if a
wildcard filename is specified (i.e. *.pas).
FOF_MULTIDESTFILES The pTo member contains one destination file for
each source file instead of one directory to which
all source files are deposited.
FOF_NOCONFIRMATION The user is never asked for confirmation, and the
operation continues as if a response of
‘yes to all’ was indicated.
FOF_NOCONFIRMMKDIR Automatically creates a new directory if one is
needed.
FOF_NOERRORUI There is not visual indication if an error occurs.
FOF_RENAMEONCOLLISION The source file is automatically given a new name,
such as ‘Copy #1 of..’, in a move, copy, or rename
operation if a file in the target directory already
has the same name.
FOF_SILENT Does not display a progress dialog box.
FOF_SIMPLEPROGRESS Displays a progress dialog box, but does not show
filenames.
FOF_WANTMAPPINGHANDLE The hNameMappings member receives a handle to a
filename mapping object.
}
var
FileDetails: TSHFileOpStruct;
begin
with FileDetails do
begin
Wnd := Application.Handle;
wFunc := Funct;
pFrom := PChar(FFrom + #0);
pTo := PChar(FTo + #0);
fFlags := Flags;
end;
Result := (SHFileOperation(FileDetai ls) = 0);
end;
I've also seen several shareware & freeware components that probably do something similar.
Walter McKie
function FileOperation(FFrom, FTo: string; Funct, Flags: integer): boolean;
{ Funct values:
FO_COPY Copy the files specified by the pFrom member to the
location specified by the pTo member.
FO_DELETE Delete the files specified by the pFrom member.
The pTo member is ignored.
FO_MOVE Move the files specified by the pFrom member to the
location specified by the pTo member.
FO_RENAME Rename the files specified by the pFrom member.
The pTo member is ignored.
Flags values:
FOF_ALLOWUNDO The specified file is deleted to the recycle bin.
FOF_FILESONLY The operation is performed only on files if a
wildcard filename is specified (i.e. *.pas).
FOF_MULTIDESTFILES The pTo member contains one destination file for
each source file instead of one directory to which
all source files are deposited.
FOF_NOCONFIRMATION The user is never asked for confirmation, and the
operation continues as if a response of
‘yes to all’ was indicated.
FOF_NOCONFIRMMKDIR Automatically creates a new directory if one is
needed.
FOF_NOERRORUI There is not visual indication if an error occurs.
FOF_RENAMEONCOLLISION The source file is automatically given a new name,
such as ‘Copy #1 of..’, in a move, copy, or rename
operation if a file in the target directory already
has the same name.
FOF_SILENT Does not display a progress dialog box.
FOF_SIMPLEPROGRESS Displays a progress dialog box, but does not show
filenames.
FOF_WANTMAPPINGHANDLE The hNameMappings member receives a handle to a
filename mapping object.
}
var
FileDetails: TSHFileOpStruct;
begin
with FileDetails do
begin
Wnd := Application.Handle;
wFunc := Funct;
pFrom := PChar(FFrom + #0);
pTo := PChar(FTo + #0);
fFlags := Flags;
end;
Result := (SHFileOperation(FileDetai
end;
I've also seen several shareware & freeware components that probably do something similar.
Walter McKie
hi walter ,
guess you missed my earlier comment,
nice wrapper for it you've pasted here though ..
guess you missed my earlier comment,
nice wrapper for it you've pasted here though ..
ASKER
Thanks Barry!
Esk
Esk
inthe
Yes I did miss your earlier comment, sorry I realy must read things properly, however if my FileOperation function is useful thats good.
Walter
Yes I did miss your earlier comment, sorry I realy must read things properly, however if my FileOperation function is useful thats good.
Walter
The Neil =:)