绿色风's Blog
专注AutoIT(Au3)
  • 首页
  • 流●年
  • 笔●记
    • 学习随记
    • 源码示例
  • 脚●本
    • UDF(收集)
    • 工作室UDF
    • 工具●教程
    • 教程之GDI
  • 作●品
  • 下●载
  • 情怀ExcelTip
12月272015

AU3复制/移动文件的进度条显示方法

作者:绿色风   发布:2015-12-27 11:13 Sunday   分类:   阅读:18633次   评论:0条  

1,简单化的SHELL对象来实现

 ;_DirCopy('d:\sf','d:\aaa')
;_DirMove("d:\abc","e:\ooq")

Func _DirCopy($SourceDir,$Destdir)
;说明:利用Shell对象来实现复制文件对话框
;作者:Sanhen
    Local $Shell
    Local $FOF_SIMPLEPROGRESS = 16
    If Not FileExists($Destdir) Then DirCreate($Destdir)
    $Shell = ObjCreate("shell.application")
    $Shell.namespace($Destdir).CopyHere($SourceDir,$FOF_SIMPLEPROGRESS)
EndFunc

Func _DirMove($SourceDir,$Destdir)
;说明:利用Shell对象来实现移动文件对话框
;作者:Sanhen
     Local $Shell
     Local $FOF_CREATEPROGRESSDLG = 16
     If Not FileExists($Destdir) Then DirCreate($Destdir)
     $Shell = ObjCreate("Shell.Application")
 $Shell.NameSpace($Destdir).MoveHere($SourceDir, $FOF_CREATEPROGRESSDLG)
EndFunc 






2,DLL方法实现

Global Const $FO_COPY = 0x0002
Global Const $FOF_ALLOWUNDO = 0x0040

_ExplorerCopy("f:\XPBAK.gho", "D:\")

Func _ExplorerCopy($source, $dest)

    Local $SHFILEOPSTRUCT, $source_struct, $dest_struct

    $SHFILEOPSTRUCT = DllStructCreate("hwnd hWnd;uint wFunc;ptr pFrom;ptr pTo;int fFlags;" & _
                                      "int fAnyOperationsAborted;ptr hNameMappings;ptr lpszProgressTitle")

    $source_struct = DllStructCreate("char[" & StringLen($source) + 2 & "]")
    DllStructSetData($source_struct, 1, $source)
    DllStructSetData($source_struct, 1, 0, StringLen($source) + 2)

    $dest_struct = DllStructCreate("char[" & StringLen($dest) + 2 & "]")
    DllStructSetData($dest_struct, 1, $dest)
    DllStructSetData($dest_struct, 1, 0, StringLen($dest) + 2)

    DllStructSetData($SHFILEOPSTRUCT, "hWnd", 0)
    DllStructSetData($SHFILEOPSTRUCT, "wFunc", $FO_COPY)
    DllStructSetData($SHFILEOPSTRUCT, "pFrom", DllStructGetPtr($source_struct))
    DllStructSetData($SHFILEOPSTRUCT, "pTo", DllStructGetPtr($dest_struct))
    DllStructSetData($SHFILEOPSTRUCT, "fFlags", $FOF_ALLOWUNDO)

    DllCall("shell32.dll", "int", "SHFileOperation", "ptr", DllStructGetPtr($SHFILEOPSTRUCT))
EndFunc   ;==>_ExplorerCopy






本文固定链接: http://www.jianyiit.com/post-158.html

blogger
该日志由 绿色风 于2015-12-27 11:13 Sunday发表在 分类下。
版权所有:《绿色风's Blog》 → 《AU3复制/移动文件的进度条显示方法》;
除特别标注,本博客很多文章均为原创. 互联分享,尊重版权,转载请以链接形式标明本文地址;
本文标签:

扫描二维码,在手机上阅读
上一篇::Win服务器定时计划任务
下一篇:64码网络电视-加了个exe壳

热门文章

相关文章

  • AU3 - ANSI|Unicode UTF 8(16)URL编码及逆转还原
  • 获取当前系统 的DPI值
  • AU3的强制注册表刷新
  • 解压WinHttp返回gzip格式的数据流
  • Au3的A*星寻路算法与示例
取消回复

发表评论

亲,头像对么?

10 + 83 =

提交中,请稍候……


木有头像就木JJ啦!还木有头像吗?点这里申请属于你的个性Gravatar头像吧!


    站点统计
    • 运行时间: 20254 天
    • 日志总数: 365 篇
    • 评论数量: 7238 条
    • 微语数量: 6 条
    • 附件总量: 388 件
  • 逝出的青春

  • 打赏"绿色风"



      扫码关注本站公众号 可搜本站内容

  • Autoit V3 脚本交流群

      常驻群1:905774875
      常驻群2:40672266


  • 链接

    • AU3中文论坛
    • Excel资料库
    • 完美者博客
    • 顺网小哥'S Blog
    • 猛牛哥的博客
    • 网吧系统下载
  • 分类

    • 流●年(66)
    • 笔●记(0)
    • 脚●本(0)
    • 作品(21)
    • 学习随记(51)
    • 源码示例(68)
    • UDF(收集)(26)
    • 工作室UDF(30)
    • 工具●教程(62)
    • 教程之GDI(24)
Copyright © 2013 绿色风's Blog. Powered by emlog. Theme by 射雕天龙. 鄂ICP备2021011689号-1 鄂公网安备42102302000078号 sitemap