Using SHFileOperation within a Windows service

后端 未结 4 957
鱼传尺愫
鱼传尺愫 2021-01-21 23:19

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 pr

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-21 23:53

    I have to agree: not appropriate or advisable.

    The prinicpal reason to use SHFileOperation is to perform operations with a UI, and/or which are reversable. I.e. using SHFileOperation to delete files is going to place the files in a recycle bin rather than deleting them allowing the current interactive user to undelete, or undo the operation performed. As the services run on a non interactive desktop, no one will ever be able to clear that recycle bin out.

提交回复
热议问题