CopyFileEx doesnt work

I need to run one thread, which copies files to other location (the files can be quite big) and another one, which watches over the first thread and kills it after some timeout.
I don't want to create the state, when the copying thread is killed before completing it's work. So if the coping is OK, I want the copying thread to send some signs of life to the killing thread so that only in the case there is no any sign during the long time the watching thread would execute the killing.

CopyFileEx doesn't work for some reason.
[556 byte] By [Dan Epst] at [2007-11-20 11:43:09]
# 1 Re: CopyFileEx doesnt work
I hope you understand that we can't help you with the description you gave. What do you mean it doesn't work? What error does it return?
cilu at 2007-11-10 22:24:31 >
# 2 Re: CopyFileEx doesnt work
Doesn't work- it means doesn't copy files (the action it supposed to do).
The function doesn't return error code, it returns boolean - false without any explanations.
I am very sorry, but if I could explain more, perhaps I could solve the problem by myself and not disturb others.
Thank you in advance.
Dan Epst at 2007-11-10 22:25:31 >
# 3 Re: CopyFileEx doesnt work
The function doesn't return error code, it returns boolean - false without any explanations.
Did you try GetLastError() ( http://msdn2.microsoft.com/en-us/library/ms679360.aspx)?

- petter
wildfrog at 2007-11-10 22:26:29 >
# 4 Re: CopyFileEx doesnt work
Did you try GetLastError() (http://msdn2.microsoft.com/en-us/library/ms679360.aspx)?

- petter
Now yes. Thank you for you advise.
The error received is (1235) "The request was aborted."
If I change my routine to be NULL, it does copying. :-(

The code now looks like

BOOL bCancel = FALSE;

BOOL bRes = CopyFileEx("C:\\tmp.txt","C:\\tmp1.txt",
NULL,NULL,&bCancel,FALSE);

and if I change it to

BOOL bCancel = FALSE;
BOOL bRes = CopyFileEx("C:\\tmp.txt","C:\\tmp1.txt", (LPPROGRESS_ROUTINE)MyCopyProgressRoutine,NULL,&bCancel,FALSE);

it enters MyCopyProgressRoutine just one time and than fails.
Dan Epst at 2007-11-10 22:27:34 >
# 5 Re: CopyFileEx doesnt work
do you return PROGRESS_CONTINUE or PROGRESS_QUIET from MyCopyProgressRoutine ?
Kurt
ZuK at 2007-11-10 22:28:28 >
# 6 Re: CopyFileEx doesnt work
do you return PROGRESS_CONTINUE or PROGRESS_QUIET from MyCopyProgressRoutine ?
Kurt
That was the right question!
The answer was NO, I just returned TRUE;

But now I return PROGRESS_CONTINUE and it works!!!!

A lot of thanks.
Dan Epst at 2007-11-10 22:29:27 >