Using SHFileOperation within a Windows service

后端 未结 4 958
鱼传尺愫
鱼传尺愫 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:46

    According to the SHFILEOPTSTRUCT documentation, you can use the following flags to prevent any UI from appearing:

    FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR
    

    or (if you're targeting Windows Vista), FOF_NO_UI, which is the same as the above.

    Looking in the ShellAPI.h header file in the Windows SDK, the comment against FOF_NO_UI says "don't display any UI at all", so from this I assume it's OK to use SHFileOperation.

提交回复
热议问题