“此对象未完全初始化”的正确 HRESULT
我正在编写一个 COM 对象,该对象提供对必须显式连接的服务的访问权限,调用才能成功。
是否有一个通用的 HRESULT
代码来描述被调用者对象处于未准备好处理调用的状态,最好暗示这是调用者的错误?
目前我正在使用 E_FAIL
,这对我来说太通用了; OLE_E_BLANK
可能是一个选项,但这不是 OLE 对象,我不想返回令人困惑的错误代码。
I'm writing a COM object that provides access to a service that must be explicitly connected before calls can succeed.
Is there a generic HRESULT
code that describes that the callee object is in a state where it is unprepared to handle calls, ideally with the implication that this is the caller's fault?
Currently I'm using E_FAIL
, which is too generic for my taste; OLE_E_BLANK
might be an option, however this is not an OLE object and I'd rather not return a confusing error code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议 E_NOT_VALID_STATE 最接近您想要传达的内容。
但是,正如 Hans 所说,实现 IErrorInfo 来给出章节和诗句。
I would suggest that E_NOT_VALID_STATE would be closest to what you want to convey.
But, as Hans says, implement IErrorInfo to give chapter and verse.