没有合适的资源?快使用搜索试试~ 我知道了~
PB使用SHFileOperation函数复制文件夹(文件)API
4星 · 超过85%的资源 需积分: 49 158 下载量 99 浏览量
2011-11-02
13:21:03
上传
评论
收藏 952B TXT 举报
温馨提示
试读
2页
在工作中遇到的问题,结合网上的各方资料现整理出此脚本! 此脚本在PB环境中已经测试通过,请放心使用,如有疑问请密我!
资源推荐
资源详情
资源评论
在pb中建立工程,按照如下步骤实施:
1:申明外部函数
Function long SHFileOperation(ref SHFILEOPSTRUCT lpFileOp) Library "shell32.dll" Alias FOR "SHFileOperationA;ansi"
2:定义结构体
global type shfileopstruct from structure
long hwnd
long wfunc
blob pfrom
blob pto
long fflags
long fanyoperationsaborted
long hnamemappings
string lpszprogresstitle
end type
3:定义复制函数
//文件(文件夹)复制函数
//返回:0成功 1失败
//参数:gs_frompath、gs_topath
SHFILEOPSTRUCT udtPath
udtPath.fflags = 592 //默认自动覆盖
udtPath.hwnd = handle(this)
udtPath.wFunc = 2
udtPath.pFrom = blob(gs_frompath,EncodingANSI!) + blob(char(0),EncodingANSI!) + blob(char(0),EncodingANSI!)
udtPath.pTo = blob(gs_topath,EncodingANSI!) + blob(char(0),EncodingANSI!) + blob(char(0),EncodingANSI!)
IF SHFileOperation(udtPath) = 0 Then
Return 0
Else
Return 1
1:申明外部函数
Function long SHFileOperation(ref SHFILEOPSTRUCT lpFileOp) Library "shell32.dll" Alias FOR "SHFileOperationA;ansi"
2:定义结构体
global type shfileopstruct from structure
long hwnd
long wfunc
blob pfrom
blob pto
long fflags
long fanyoperationsaborted
long hnamemappings
string lpszprogresstitle
end type
3:定义复制函数
//文件(文件夹)复制函数
//返回:0成功 1失败
//参数:gs_frompath、gs_topath
SHFILEOPSTRUCT udtPath
udtPath.fflags = 592 //默认自动覆盖
udtPath.hwnd = handle(this)
udtPath.wFunc = 2
udtPath.pFrom = blob(gs_frompath,EncodingANSI!) + blob(char(0),EncodingANSI!) + blob(char(0),EncodingANSI!)
udtPath.pTo = blob(gs_topath,EncodingANSI!) + blob(char(0),EncodingANSI!) + blob(char(0),EncodingANSI!)
IF SHFileOperation(udtPath) = 0 Then
Return 0
Else
Return 1
young_洋
- 粉丝: 1
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页