Essential COM

, . , RESULT. COM- , , RPC- . RESULT 32- , , ( , , ). , ( , Visual Basic, Java), HRESULT- (programmatic exceptions).

 . 2.2. hresult

. 2.2, HRESULT- : (severity bit), . , , , HRESULT, . SDK (software development kit - ) , HRESULT:

 #define SUCCEEDED(hr) (long(hr) >= 0) #def1ne FAILED(hr)    (long(hr) < 0)  

, RESULT .

SDK HRESULT. HRESULT , HRESULT, :

 <facility>_<severity>_<information>  

, HRESULT STG_S_CONVERTED , FACILITY_STORAGE. , (Structured Storage) (Persistence). SEVERITY_SUCCESS. , . CONVERTED , . HRESULT- , , FACILITY_NULL, . HRESULT- FACILITY_NULL:

 S_OK -        S_FALSE -         false        E_FAIL -      E_NOTIMPL -        E_UNEXPECTED -            

FACILITY_ITF HRESULT- HRESULT, . FACILITY_ITF . MAKE_HRESULT HRESULT :

 const HRESULT CALC_E_IAMHOSED =                  MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0 200 + 15);  

HRESULT , 0 200, , HRESULT- . , , . , HRESULT , API FormatMessage. HRESULT, , , , .

, HRESULT- , IDL retval. retval , , , . IDL- :

 HRESULT Method2([in] short arg1, [out, retval] short *parg2);  

Java :

 public short Method2(short arg1);  

Visual Basic :

 Function Method2(arg1 as Integer) As Integer  

C++ - , Microsoft C++ :

 virtual HRESULT _stdcall Method2(short arg1, short *parg2) = 0;  

, C++:

 short sum = 10;  short s;  HRESULT hr = pItf->Method2(20, &s);  if (FAILED(hr))    throw hr;  sum += s;  

Java- :

 short sum == 10;  short s = Itf.Method2(20);  sum += s;  

HRESULT, , , Java Virtual Machine HRESULT Java. C++ HRESULT, , .



Suschnost' tehnologii SOM
Essential COM
ISBN: 0201634465
EAN: 2147483647
Year: N/A
Pages: 103
Authors: Don Box

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net