1. CopyFileEx

Hello,

is there anybody who has some code with function CopyFileEx?
I need to copy files with progress bar.

Thanx Vlado

new topic     » topic index » view message » categorize

2. Re: CopyFileEx

Vlado Kusnirak wrote:
> 
> Hello,
> 
> is there anybody who has some code with function CopyFileEx?
> I need to copy files with progress bar.

Hi Vlado

I have looked in to this as recently as yesterday :)

A search of the EUForum for "CopyFileEx" reveals some good posts from Matt Lewis
including a nice looking generalised example of it.  Unfortunately when I tried
it it crashed on "return PROGRESS_CONTINUE" in the callback but did copy the
file.

So yeah, "me too" smile

The trick seems to be using ftpr.e to allow more than 9 parameters to the
callback function.  But as I said, I get a Machine Level Exception returning from
the callback.

Speaking of which, does anyone know a way to get more info on a machine level
exception, ie what type, code, registers, etc?

Gary

new topic     » goto parent     » topic index » view message » categorize

3. Re: CopyFileEx

> The trick seems to be using ftpr.e to allow more than 9 parameters to the
> callback function.  But as I said, I get a Machine Level Exception returning from
> the callback.

I have some useful code demonstrating this. I'll dig it up when I get
home from work.

~Greg

new topic     » goto parent     » topic index » view message » categorize

4. Re: CopyFileEx

Vlado Kusnirak wrote:
> is there anybody who has some code with function CopyFileEx?
> I need to copy files with progress bar.

If you search for win32ext in the archives I've wrapped the ShFileOperation
Windows function that will let you copy a file and shows the dialog where the
file "moves" from one folder to another.

HTH

Jonas Temple
http://www.yhti.net/~jktemple

new topic     » goto parent     » topic index » view message » categorize

5. Re: CopyFileEx

Hi,

i've tried it, but I always get "A machine-level exception..."
In your win32ext I see only demo with function GetTimeZoneInformation().
Do you have some working example with function ShFileOperation ?

Vlado

> If you search for win32ext in the archives I've wrapped the ShFileOperation
> Windows function that will let you copy a file and shows the dialog where the
> file "moves" from one folder to another.
>

new topic     » goto parent     » topic index » view message » categorize

6. Re: CopyFileEx

Hmmm...I sent a reply to this yesterday but it never showed up.  Maybe I didn't
hit the "send" button.

Anyway, here's an example of using the routine to manipulate temporary files
downloaded to a PC from a host:

-- Now that all files have been transferred loop through each temp file
        for i = 1 to length(object_list) do
            local_file = local_path & "\\" & object_list[i]
            local_temp_file = local_path & "\\~" & object_list[i]
-- If the user did not cancel the update then delete/rename the temp
            file
            if not cancel_upd then
                -- Delete the local file
rtn_seq = SHFileOperation(getHandle(Main), FO_DELETE,
                local_file, "",
or_all({FOF_SILENT, FOF_NOERRORUI, FOF_NOCONFIRMATION}), 0,
                    "")
                -- Rename the local temp file to the local file name
rtn_seq = SHFileOperation(getHandle(Main), FO_RENAME,
                local_temp_file,
                    local_file, FOF_SILENT, 0, "")
            -- Else the user cancelled the component update
            else
                -- Delete the temp file
rtn_seq = SHFileOperation(getHandle(Main), FO_DELETE,
                local_temp_file, "",
or_all({FOF_SILENT, FOF_NOERRORUI, FOF_NOCONFIRMATION}), 0,
                    "")
            end if
        end for


I suggest taking a look at the MSDN docs for this function, it will give you a
better understanding of how to use the routine in win32ext.  Here's the link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shfileoperation.asp

HTH!

Jonas Temple
http://www.yhti.net/~jktemple

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu