Difference !!!
-
Hi all, What is difference between E_FAIL and S_FALSE ??? Thanks for helps ... My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie
-
Hi all, What is difference between E_FAIL and S_FALSE ??? Thanks for helps ... My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie
E_FAIL (0x80004005) indicates, that the function fails. No further processing is possible (e.g. an object cannot be instanciated). Script languages are throwing exceptions in this case. S_FALSE (0x00000001) indicates, that the function has no effect or has no results. In script languages no exception will occur. Volker
-
E_FAIL (0x80004005) indicates, that the function fails. No further processing is possible (e.g. an object cannot be instanciated). Script languages are throwing exceptions in this case. S_FALSE (0x00000001) indicates, that the function has no effect or has no results. In script languages no exception will occur. Volker
These can also be used to inform of fatal and non-fatal errors. S_FALSE may be returned from a method when it partially succeeded. For example numbers were calculated correctly but were of insufficient range. HRESULT Calculate(int x, int y) { if( x > 5000 || y > 5000) return E_FAIL; // return failure because these numbers are greater than // possible range expected if( (x + y) < 500 ) return S_FALSE; // return false because it worked but just wasn't high enough else return S_OK; }
-
These can also be used to inform of fatal and non-fatal errors. S_FALSE may be returned from a method when it partially succeeded. For example numbers were calculated correctly but were of insufficient range. HRESULT Calculate(int x, int y) { if( x > 5000 || y > 5000) return E_FAIL; // return failure because these numbers are greater than // possible range expected if( (x + y) < 500 ) return S_FALSE; // return false because it worked but just wasn't high enough else return S_OK; }
E_FAIL will also throw an exception if you use Visual Basic, and S_FALSE will not.