Copy file API

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
nilsandrey
Junior Member
Junior Member
Posts: 32
Joined: 2003-11-10, 21:44 UTC
Location: Cuba

Copy file API

Post by *nilsandrey »

Hi, this is a developer question, I'm sorry to post it here...but I used this program for many years and I know Christian can answer me the best.

I want to copy a lot of files from one location to another, taking control of the progress from a certain program i'm making on Delphi 7, I find out the Windows API's function CopyFileEx is only for WinNT based system. I can see totalcmd use another thing....can you illustrate me?

I know it sounds as a rookie programmer, and I don't, but never had done anything with file manipulation.
gigaman
Member
Member
Posts: 131
Joined: 2003-02-14, 11:28 UTC

Post by *gigaman »

Hm, I'd like to know why current MSDN says it's available on Win9x when it's obviously not true... oh well.

Anyway, you can make your own copy routine - that is, open the source and target file, allocate a block of memory and read/write the data block by block, using the memory buffer.
You could also use memory-mapped files (and simply move the memory), but that probably wouldn't work for big files.
Or, you could use the Shell API (SHFileOperation) - that should provide you with the same "progress dialog" as Explorer uses.
User avatar
nilsandrey
Junior Member
Junior Member
Posts: 32
Joined: 2003-11-10, 21:44 UTC
Location: Cuba

Copy File API - MSDN are right

Post by *nilsandrey »

Hi gigaman, you wrote:

Hm, I'd like to know why current MSDN says it's available on Win9x when it's obviously not true... oh well.

I read the MSDN too, and I just think it's not clear. If you're watching the same page than I, you can read at the bottom, in the requirements, it says Windows NT based for the server and Windows 98 on the client machine. The point must be that the copy can be from a machine running windows 98, but the code must be executing on a NT based system.

You wrote:
Anyway, you can make your own copy routine - that is, open the source and target file, allocate a block of memory and read/write the data block by block, using the memory buffer.

Probably the solution I'll use for Win98. But maybe I left my application not to run on a Win98 because it'll be a server.

You wrote:
Or, you could use the Shell API (SHFileOperation) - that should provide you with the same "progress dialog" as Explorer uses.

I evaluated that too, and it's fine, but I need more control over the process, the operation can be long, and my users must be monitoring from a web page or a windows based application, either of two in any moment ( a requirement for my application by the boss :) )

Thanks a lot anyway and sorry again for discussing the developing of an non-relevant software in a totalcmd forum.
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2nilsandrey
AFAIK CopyFileEx is implemented in Win9x, but it simply maps to CopyFile.
I switched to Linux, bye and thanks for all the fish!
gigaman
Member
Member
Posts: 131
Joined: 2003-02-14, 11:28 UTC

Post by *gigaman »

I read the MSDN too, and I just think it's not clear. If you're watching the same page than I, you can read at the bottom, in the requirements, it says Windows NT based for the server and Windows 98 on the client machine. The point must be that the copy can be from a machine running windows 98, but the code must be executing on a NT based system.
It's really wrong. The list at the bottom says on what "client" operating systems it's available and on what server operating systems it's available - it doesn't have anything to do with where you copy the file from/to. The same description is given for other API functions as well, no matter if they access files / computers.
AFAIK CopyFileEx is implemented in Win9x, but it simply maps to CopyFile
No, the function isn't implemented - it doesn't do anything and just returns.
User avatar
nilsandrey
Junior Member
Junior Member
Posts: 32
Joined: 2003-11-10, 21:44 UTC
Location: Cuba

Post by *nilsandrey »

Yes! you'll right, thanks.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed CopyFileEx doesn't work on Win9x, that's why compatibility mode is disabled there...
Author of Total Commander
https://www.ghisler.com
Post Reply