SHFileOperation: ERROR_FILE_NOT_FOUND 和 ERROR_PATH_NOT_FOUND 的区别

我在看 SHFileOperation 用法 的时候,在 Winerror.h 的说明 里,看到了这段话

ERROR_FILE_NOT_FOUND

2 (0x2)

The system cannot find the file specified.

ERROR_PATH_NOT_FOUND

3 (0x3)

The system cannot find the path specified.

我自己写了一段测试代码:

SHFILEOPSTRUCTA shfo;
shfo.wFunc = FO_DELETE;
shfo.pFrom = "no_such_folder\\test.txt\0"
ret =SHFileOperation(&shfo);

返回值却是 DE_INVALIDFILES(0x7c)

请问,ERROR_FILE_NOT_FOUND和ERROR_PATH_NOT_FOUND 区别在哪里?怎么才能让返回值为 ERROR_PATH_NOT_FOUND ?

谢谢您的解答

阅读 6.2k
1 个回答
新手上路,请多包涵

"Z:\test.txt"这样你试过么

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进