在 CopyFileEx 启动后发送标志以取消它 [英] Send flag to cancel CopyFileEx after it has started

查看:66
本文介绍了在 CopyFileEx 启动后发送标志以取消它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发备份软件,我使用 File.Copy() 来复制文件.

I am currently developing backup software, which I was using File.Copy() to copy files.

但是 File.Copy() 没有取消的选项,所以经过一番谷歌搜索后我发现 CopyFileEx 可以.我查看了 P/Invoke 文档,但我无法解决如何在不再次调用整个函数的情况下实际发送标志以取消它.

However File.Copy() doesn't have the option to cancel, so after a bit of googling I found CopyFileEx does. I had a look through the P/Invoke docs but I can't work out how I can actually send the flag to cancel it without calling the whole function again.

我是否可以只设置一个 bool 值并引用它,如果我从其他地方更改它,CopyFileEx 是否会检测到它已更改?

Can I just set a bool value and reference that, and will CopyFileEx detect that it has changed if I change it from somewhere else?

感谢任何帮助或示例.

推荐答案

是的,请参阅 http://msdn.microsoft.com/en-us/library/windows/desktop/aa363852(v=vs.85).aspx

如果此标志在复制操作期间设置为 TRUE,则取消操作.否则,复制操作将继续完成.

If this flag is set to TRUE during the copy operation, the operation is canceled. Otherwise, the copy operation will continue to completion.

这篇关于在 CopyFileEx 启动后发送标志以取消它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆