SendMessage 中的 ERROR_FILE_NOT_FOUND 意味着什么?

发布于 2024-08-06 18:36:11 字数 134 浏览 4 评论 0原文

SendMessage 返回 0,GetLastError 返回 2 (ERROR_FILE_NOT_FOUND)。 ERROR_ACCESS_DENIED 有记录,但没有记录。有人知道这意味着什么吗?

SendMessage returning 0 and GetLastError returning 2 (ERROR_FILE_NOT_FOUND). ERROR_ACCESS_DENIED is documented but not this. Anyone have any idea what this means?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

转身泪倾城 2024-08-13 18:36:11

SendMessage 返回 0 并不表示也不可能表示失败。 SendMessage 仅返回 WindowProc 返回的值,该值通常为 0。无法判断 - 仅通过 SendMessage 的返回 - SendMessage 是否无法传递消息(可能是因为窗口无效或属于更高完整性级别的进程) )。

如果消息被记录为返回 0 以外的内容,那么,再次根据消息,查看 GetLastError() 来了解消息处理失败的原因可能是有效的。

此外,没有任何操作系统函数会清除最后一个错误代码,因此 GetLastError() 中的任何值都可能完全是偶然的。调用 API 然后调用 GetLastError() 可能意味着之前的 API 调用中发生了错误,或者内部调用的 API 执行了某些“失败”的操作,但已得到处理并且 API 本身成功。

SendMessage returning 0 does not, and cannot, indicate failure. SendMessage just returns the value returned by the WindowProc which is frequently 0. There is no way to tell - just via the return from SendMessage - if SendMessage could not deliver the message (perhaps because the window is invalid or belongs to a higher integrity level process).

If the message is documented as returning something other than 0, then, again depending on the message, it might be valid to look at GetLastError() to see why the message processing failed.

Also, no OS functions ever clear the last error code, so any value in GetLastError() can be entirely incidental. Calling an API and then calling GetLastError() might mean the error happened in a previous API call, OR that the API called internally did some operation that 'failed' but was handled and the API itself succeeded.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文