简体   繁体   English

如何让CopyFileEx报告回来以便我可以取消文件复制操作?

[英]How do I get CopyFileEx to report back so I can cancel a file copy operation?

I'm trying to use the FileUtilities.CopyFile wrapper for CopyFileEx from here . 我正在尝试从此处使用CopyFileExFileUtilities.CopyFile包装器。 But the CopyFileCallbackAction doesn't get called until after the file is copied (I've tried copying a large file). 但是在复制文件之后才会调用CopyFileCallbackAction (我试过复制一个大文件)。 How do I get it to report back so I can cancel the copy if the user so wishes? 我如何让它报告回来,如果用户愿意,我可以取消该副本?

EDIT: 编辑:

See Why is FileUtilities.CopyFile wrapper for CopyFileEx interfering with winforms? 请参阅为什么CopyFileEx的FileUtilities.CopyFile包装器会干扰winforms?

The edit to my question (sending to Why is FileUtilities.CopyFile wrapper for CopyFileEx interfering with winforms? ) sends to the answer (by david-heffernan ) – I had all on one thread. 编辑我的问题(发送到为什么FileUtilities.CopyFile包装,因为CopyFileEx干扰了winforms? )发送给答案(由david-heffernan ) - 我在一个线程上都有。

EDIT: No. It seems that I had a this.Update(); 编辑:不。看来我有一个this.Update(); missing. 失踪。 See How can I get code to run after a form is shown? 请参阅如何在显示表单后运行代码? (Trouble with "Shown".) . (麻烦“显示”。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM