很挫的 SHFileOperation 用法 2011-07-18 11:42
今天编写一个局域网文件拷贝的demo 。其中有一个 SHFileOperation 的用法,这个函数有个参数SHFILEOPSTRUCT。查看msdn有如下解释:
Wildcard characters are not supported.
Copy
and Move operations can specify destination directories that do not
exist and the system will attempt to create them. The system normally
displays a dialog box to ask the user if they want to create the new
directory. To suppress this dialog box and have the directories created
silently, set the FOF_NOCONFIRMMKDIR flag in fFlags.
For Copy and
Move operations, the buffer can contain multiple destination file names
if the fFlags member specifies FOF_MULTIDESTFILES.
Pack multiple names into the string in the same way as for pFrom.
Use only fully-qualified paths. Using relative paths will have unpredictable results.
明白否,不明白看在线msdn的解释
pFrom
Type: LPCTSTR
Note This string must be double-null terminated.
A pointer to one or more source file names. These names should be fully-qualified paths to prevent unexpected results.
Standard MS-DOS wildcard characters, such as "*", are permitted only in the file-name position. Using a wildcard character elsewhere in the string will lead to unpredictable results.
Although
this member is declared as a single null-terminated string, it is
actually a buffer that can hold multiple null-delimited file names. Each
file name is terminated by a single NULL character. The last file name
is terminated with a double NULL character ("\0\0") to indicate the end
of the buffer.
pTo
Type: LPCTSTR
Note This string must be double-null terminated.
A
pointer to the destination file or directory name. This parameter must
be set to NULL if it is not used. Wildcard characters are not allowed.
Their use will lead to unpredictable results.
Like pFrom, the pTo member is also a double-null terminated string and is handled in much the same way. However, pTo must meet the following specifications:
- Wildcard characters are not supported.
- Copy
and Move operations can specify destination directories that do not
exist. In those cases, the system attempts to create them and normally
displays a dialog box to ask the user if they want to create the new
directory. To suppress this dialog box and have the directories created
silently, set the FOF_NOCONFIRMMKDIR flag in fFlags. - For Copy and Move operations, the buffer can contain multiple destination file names if the fFlags member specifies FOF_MULTIDESTFILES.
- Pack multiple names into the pTo string in the same way as for pFrom.
- Use fully-qualified paths. Using relative paths is not prohibited, but can have unpredictable results.
这样写就行
string strSrc("F:\\tools\\WINXPSP3.GHO");
strSrc += '\0';
string strDesc("\\\\192.168.1.11\\test");
strDesc += '\0';
CopyFolder( strSrc, strDesc );
这样写就不行CopyFolder( std::string("D:\\2.txt\0"), std::string("e:\\3.txt\0") );
饿的那个神啊。记住了这很挫的方式。
很挫的 SHFileOperation 用法 2011-07-18 11:42的更多相关文章
- 日本IT行业劳动力缺口达22万 在日中国留学生迎来就业好时机 2017/07/18 11:25:09
作者:倪亚敏 来源:日本新华侨报 发布时间:2017/07/18 11:25:09 据日本政府提供的数据,日本2018年应届毕业生的“求人倍率”已经达到了1.78倍.换言之,就是100名大学生 ...
- 2021.07.18 P2290 树的计数(prufer序列、组合数学)
2021.07.18 P2290 树的计数(prufer序列.组合数学) [P2290 HNOI2004]树的计数 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 重点: 1.pru ...
- [CareerCup] 18.11 Maximum Subsquare 最大子方形
18.11 Imagine you have a square matrix, where each cell (pixel) is either black or white. Design an ...
- [18/11/11] java标识符及变量
一.标识符规范 1.必须以字母.下划线 .美元符号开头. 即数字不能作为开头,其它位随便 2.不可以是java关键字(即保留字), 如static .class.new 等 . 注:int 年 ...
- XPath语法 在C#中使用XPath示例 【转http://www.cnblogs.com/yukaizhao/archive/2011/07/25/xpath.html】非常详细的文章
XPath语法 在C#中使用XPath示例 XPath可以快速定位到Xml中的节点或者属性.XPath语法很简单,但是强大够用,它也是使用xslt的基础知识. 示例Xml: <?xml ve ...
- 摘自(http://www.ruanyifeng.com/blog/2011/07/linux_load_average_explained.html)
理解Linux系统负荷 作者: 阮一峰 一.查看系统负荷 如果你的电脑很慢,你或许想查看一下,它的工作量是否太大了. 在Linux系统中,我们一般使用uptime命令查看(w命令和top命令也行) ...
- 在不开启事件循环的线程中使用QTimer(QThread::run函数自带事件循环,在构造函数里创建线程,是一种很有意思的线程用法) good
引入 QTimer是Qt自带的定时器类,QTimer运行时是依赖于事件循环的,简单来说,在一个不开启事件循环(未调用exec() )的线程中,QTimer是无法使用的.通过分析Qt源码可发现,调用QT ...
- 18 11 07 pygame 继续使用
---恢复内容开始--- 1 给原来的游戏不定时 增加一些敌机 用到了pygame的定时器 定时器就是每隔一段时间 就进行一次相同的操作 2 pyagame 在捕获键盘操作有两种 1 ...
- 很不错的Intent用法 适用于正在开发的伙伴。自己看到了,也分享给大家吧。
本文介绍Android中Intent的各种常见作用. 1 Intent.ACTION_MAIN String: android.intent.action.MAIN 标识Activity为一个程序的开 ...
随机推荐
- p44_IP数据包格式
一.IP数据报格式 二.IP分片 数据链路层每帧可封装数据有上限,IP数据超过的要分片. 标识:同一数据报的分片使用同一标识 标志: 片偏移(13bit):用于还原数据报顺序,指出某片在原分组1中的相 ...
- Python 简明教程 --- 24,Python 文件读写
微信公众号:码农充电站pro 个人主页:https://codeshellme.github.io 过去的代码都是未经测试的代码. 目录 无论是哪种编程语言,IO 操作都是非常重要的部分.I 即Inp ...
- 图论相关知识(DFS、BFS、拓扑排序、最小代价生成树、最短路径)
图的存储 假设是n点m边的图: 邻接矩阵:很简单,但是遍历图的时间复杂度和空间复杂度都为n^2,不适合数据量大的情况 邻接表:略微复杂一丢丢,空间复杂度n+m,遍历图的时间复杂度为m,适用情况更广 前 ...
- vue的双向数据绑定实现原理(简单)
如果有人问你,学vue学到了什么,那双向数据绑定,是必然要说的. 我们都知道,在vue中,使用数据双向绑定我们都知道是v-modle实现的. 实现原理是通过Object.defineProperty的 ...
- 手动触发浏览器resize
今天做echarts图表 发现饼图不能居中,resize之后才会居中. 于是想手动触发resize方法,但是不改变浏览器窗口 JQ $(window).trigger('risize'); JS ...
- 阿里云OSS服务器的使用
关于文件上传,我们一般使用OSS服务器.大致为两种上传方式: 详情官网参考:https://help.aliyun.com/document_detail/31927.html?spm=a2c4g.1 ...
- python学习笔记1 -- 函数式编程之高阶函数 sorted排序
python提供了很强大的内置排序函数,妈妈再也不担心我不会写冒泡排序了呀,sorted函数就是这个排序函数,该函数参数准确的说有四个,sorted(参数1,参数2,参数3,参数4). 参数1 是需要 ...
- Skill art函数遍历字典
https://www.cnblogs.com/yeungchie/ code procedure(ycartGo(length1) prog(() for(x 1 length1 printf(&q ...
- P3565 由简单的树形dp 引入 长链刨分
这道题感觉不太行 因为自己没想出来. 先说一下暴力吧,取三个点 让两两之间的距离相等怎么做呢,看起来是很复杂的样子的,但是仔细观察发现 答案出自一个点的儿子之间 或者儿子和父亲之间. 暴力枚举三个点然 ...
- luogu P4606 [SDOI2018]战略游戏
LINK:战略游戏 一道很有价值的题目.这道题 一张无向联通图 每次询问给出K个关键点 问摧毁图中哪个点可以使得这K个关键的两两之间有一对不能联通 去掉的这个点不能是关键点 求方案数. 可以发现 当K ...