在 Windows 服务中使用 SHFileOperation [英] Using SHFileOperation within a Windows service

查看:55
本文介绍了在 Windows 服务中使用 SHFileOperation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是可能的,但是在 Windows 服务中使用 SHFileOperation 是否合适?shell32.dll 中的所有 SHxxx API 函数似乎都是用用户级程序编写的.我可以确定 SHFileOperation 永远不会显示 GUI 吗?

It's possible, but is it appropriate to use SHFileOperation within a Windows service? All those SHxxx API functions in shell32.dll seem to have been written with user level programs in mind. Can I be certain SHFileOperation won't display GUI ever?

推荐答案

我想说,这不是不合适或不可取的.大多数 shell32 API 都是在基本了解它们将用于交互式进程的情况下编写的.我认为没有任何方法可以保证 SHFileOperation 永远不会显示 UI 组件.事实上,如果你看看 IFileOperation(这是取代SHFileOperation的Vista新界面),它明确指出:

I would say, not it's not appropriate or advisable. Most of the shell32 APIs were written with a basic understanding that they would be used in interactive processes. I don't think there is any way you can guarantee that SHFileOperation will never display a UI component. In fact, if you look at IFileOperation (which is the new Vista interface that replaces SHFileOperation), it clearly states:

公开复制、移动、重命名、创建和删除 Shell 项目的方法以及提供进度和错误对话框的方法.该接口替代了 SHFileOperation 函数.

Exposes methods to copy, move, rename, create, and delete Shell items as well as methods to provide progress and error dialogs. This interface replaces the SHFileOperation function.

这篇关于在 Windows 服务中使用 SHFileOperation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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