程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> .NET實例教程 >> HRESULT 返回值

HRESULT 返回值

編輯:.NET實例教程

The following table lists the values of common HRESULT values. More values are contained in the header file winerror.h.


Name
Description
Value
S_OK
Operation successful
0x00000000
E_UNEXPECTED
Unexpected failure
0x8000FFFF
E_NOTIMPL
Not implemented
0x80004001
E_OUTOFMEMORY
Failed to allocate necessary memory
0x8007000E
E_INVALIDARG
One or more arguments are invalid
0x80070057
E_NOINTERFACE
No such interface supported
0x80004002
E_POINTER
Invalid pointer
0x80004003
E_HANDLE
Invalid handle
0x80070006
E_ABORT
Operation aborted
0x80004004
E_FAIL
UnspecifIEd failure
0x80004005
E_AccessDENIED
General Access denIEd error
0x80070005
S_FALSE
Operation failure
 

 

HRESULT 其實是一個雙字節的值,其最高位(bit)如果是0表示成功,1表示錯誤。我們在程序中如果需要判斷返回值,則可以使用比較運算符號;switch開關語句;也可以使用VC提供的宏:

      HRESULT hr = 調用組件函數;      if( SUCCEEDED( hr ) ){...} // 如果成功      ......      if( FAILED( hr ) ){...} // 如果失敗 
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved