public class ApiCopyFile
{
private const int FO_COPY = 0x0002;
private const int FOF_ALLOWUNDO = 0x00044;
//显示进度条 0x00044 // 不显示一个进度对话框 0x0100 显示进度对话框单不显示进度条 0x0002显示进度条和对话框
private const int FOF_SILENT = 0x0002;//0x0100;
//
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = )]
public struct SHFILEOPSTRUCT
{
public IntPtr hwnd;
[MarshalAs(UnmanagedType.U4)]
public int wFunc;
public string pFrom;
public string pTo;
public short fFlags;
[MarshalAs(UnmanagedType.Bool)]
public bool fAnyOperationsAborted;
public IntPtr hNameMappings;
public string lpszProgressTitle;
}
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
static extern int SHFileOperation(ref SHFILEOPSTRUCT FileOp);
public static bool DoCopy(string strSource, string strTarget)
{
SHFILEOPSTRUCT fileop = new SHFILEOPSTRUCT();
fileop.wFunc = FO_COPY;
fileop.pFrom = strSource;
fileop.lpszProgressTitle = "复制大文件";
fileop.pTo = strTarget;
//fileop.fFlags = FOF_ALLOWUNDO;
fileop.fFlags = FOF_SILENT;
return SHFileOperation(ref fileop) == ;
}
}

最新文章

  1. win7 解决IE浏览器不能打开网页的问题
  2. Django form 中文提交 错误
  3. (转)JITComplier、NGen.exe及.NET Native
  4. Vs程序自动获取windows7/vista系统管理员权限
  5. CF Gym 100685A Ariel
  6. hive中关于数据库与表等的基本操作
  7. echo输出到stderr
  8. ionicModal中的监听事件
  9. web的各种前端打印方法之CSS控制网页打印样式
  10. HTML5 修改浏览器url而不刷新页面
  11. SQL SERVER中如何格式化日期
  12. 内核ring buffer -- kfifo
  13. 前端使用moment.js 获取当前时间往前的时间
  14. day13_H5_CSS_2
  15. rinetd 通过公网连接云数据库
  16. git忽视修改的文件
  17. go标准库的学习-database/sql/driver
  18. xftp和xshell有什么区别
  19. Page5:状态转移矩阵及性质、连续线性系统离散化及其性质[Linear System Theory]
  20. MySql:触发器

热门文章

  1. freemarker list集合去重,实现hashset
  2. source 1.7 中不支持 lambda 表达式(请使用 -source 8 或更高版本以启用 lambda 表达式)
  3. Python打包成exe,pyc
  4. Exploded location overlaps an existing deployment解决办法
  5. 去BAT,你应该要看一看的面试经验总结
  6. js 对象细节
  7. 条款26:尽可能延后变量定义式的出现时间(Postpone variable definitions as long as possible)
  8. Linux文本检索命令grep笔记
  9. windows 上使用virtualenv进行python多版本转换
  10. LeetCode02-两数相加