Article View: borland.public.cppbuilder.nativeapi
Article #11153CopyFileEx doesnt want to cancle
From: ScOe
Date: Mon, 23 Feb 2004 23:47
Date: Mon, 23 Feb 2004 23:47
46 lines
2278 bytes
2278 bytes
I've made Form which i use as progress window. I call it before CopyFileEx
and change progressbar in progress routine.
Before CopyFileEx i set Application->ProcessMessages ()
On cancle button hit on progress form i set bool flag which i check in
progress routine.
But it seems that progress form doesnt process button click.
What do i need to do to make it work ?
int cancel = 0;
frmProgress->Show ();
frmProgress->StaticText1->Caption = String("Copying file: "+FileToGet+" to
"+NewFile);
Application->ProcessMessages ();
if (!CopyFileEx (FileToGet.c_str (),
NewFile.c_str (),
cbFunc,
NULL,
&cancel,
COPY_FILE_FAIL_IF_EXISTS)) {
frmProgress->Close ();
return false;
}
frmProgress->Close ();
DWORD WINAPI cbFunc(
LARGE_INTEGER fsz,
LARGE_INTEGER bytx,
LARGE_INTEGER strmsz,
LARGE_INTEGER strmtx,
DWORD strmno,
DWORD cbReason,
HANDLE hsrc,
HANDLE hdest,
LPVOID data)
{
char vbuf[40];
if (frmProgress->ProgressBar1->Max != strmsz.LowPart)
frmProgress->ProgressBar1->Max = strmsz.LowPart;
if (frmProgress->IsCancelHit ()) {
frmProgress->SetCancelHit (false);
return PROGRESS_CANCEL;
}
frmProgress->ProgressBar1->Position = strmtx.LowPart;
return PROGRESS_CONTINUE;
and my progress doesnt work as it should :)
Technical Details
Message-ID:
<403a917f@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.chello.at!amsnews04.chello.com!amsnews01.chello.com!border2.nntp.ash.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,16b36170c4bd300c,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-02-23 15:50:47 PST From: "ScOe" <cbinders@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: CopyFileEx doesnt want to cancle Date: Tue, 24 Feb 2004 00:47:49 +0100 Lines: 48 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 193.198.138.186 Message-ID: <403a917f@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1077580159 193.198.138.186 (23 Feb 2004 15:49:19 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.chello.at!amsnews04.chello.com!amsnews01.chello.com!border2.nntp.ash.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail