It is not clear from your post what is bw->ReportProgress(nPercent) and how it calls bwDoCount_ProgressChanged. Some code is missing to understand this.
Anyway, comment off ReportProgress line and try to reproduce the cancelling problem: what happens?