COM:如何获取有关 COM 错误的更多详细信息?
您好,
在使用 DirectX 时,您会得到一个名为 DxErr9.h 的漂亮标头 #include,它具有非常有用的功能,例如:
DXGetErrorString9
它们
DXGetErrorDescription9
会告诉您有关给定 HR 的错误的所有信息。
但现在使用 COM 和 OLE,我发现我只能自己处理从 COM 函数返回的 HRESULTS。 现在真的只有我和 MSDN 吗?或者 OLE DB 中是否有类似的辅助函数,但我还没有遇到过?
Greets,
When working with DirectX, you get this nice header to #include called DxErr9.h which has really helpful functions like:
DXGetErrorString9
and
DXGetErrorDescription9
They tell you everything you need to know about the error given the HR.
But now working with COM and OLE, I find I'm kind of on my own with the HRESULTS that come back from COM functions. Is it really just me and MSDN at this point, or are there similar helper functions in OLE DB that I just haven't come across yet?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此外,您还应该查看错误信息。 COM系统的一部分是错误信息的概念,它是一个per-线程全局,可以在不同时间设置和清除。 您查询它以响应错误,如果是设置,它将比仅仅查看 <代码>HRESULT。
Additionally, you should look at the error info. Part of the COM system is the concept of the error information, which is a per-thread global which can be set and cleared at various times. You query for it in response to an error, and if it is set, it will have more useful information than just looking at the
HRESULT
.使用 _com_error 获取有意义的字符串:
Use _com_error to get a meaningful string: