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 ?

谢谢您的解答

c VC windows win32api

xy00792 11 years, 5 months ago

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

道长用飘柔 answered 11 years, 5 months ago

Your Answer