找回密码 注册 QQ登录
一站式解决方案

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?快速3D打印 手板模型CNC加工服务在线3D打印服务,上传模型,自动报价
查看: 15871|回复: 0
打印 上一主题 下一主题

CAA CATIA::About HRESULT

[复制链接]
跳转到指定楼层
1
发表于 2005-1-14 17:26:39 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
About HRESULT
HRESULT is a Microsoft specific return value to report execution conditions to calling functions. QueryInterface in both COM and CNext returns an HRESULT. The methods you expose in your interfaces should also return an HRESULT. They so become OLE compliant.
  
HRESULT is encoded on 32 bits and is divided into three areas. The first bit is the severity and reports whether the method called succeeds or fails. The following 15 bits contain the facility code which gives information about the type and the origin of the return code, and the last 16 bits contain the actual return code the method is returning. Here is a map of the HRESULT's structure.
  
Common HRESULT codes fall in the following categories. A successful return code contains S_ in its name, while a failure code contains E_ in its name.  
  
S_OK to report that the function succeeds  
S_FALSE to report that the function succeeds, but returns the boolean value False  
E_NOINTERFACE returned by QueryInterface to report that the queried object doesn't support the requested interface  
E_UNEXPECTED to report an unexpected failure  
E_OUTOFMEMORY to report that the function called cannot allocate the required memory  
E_FAIL to report an unspecified failure.  
[Top]
  
How to Test a Returned HRESULT?
You should never test the HRESULT value, but use the SUCCEEDED or FAILED macros as follows:
  
HRESULT rc = pCATBaseUnKnownOnComp->QueryInterface(IID_CATIXX,
                                                   (void**) [$pIXXOnComp)]
if (FAILED(rc))
{
  ... // Process the error
}
else if (SUCCEEDED(rc))
{
  pIXXOnComp->MXX1();
  ...

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2024-11-30 06:46 , Processed in 0.022197 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表