QueryInterface

QueryInterface

, , QueryInterface B A, QueryInterface A . ,

 QI(A)->B 

 QI(QI(A)->B)->A 

 . 4.2.   queryinterface

, . 4.2, , , , :

 void AssertSymmetric(ICar *pCar)  {     if (pCar) {          IPlane *pPlane = 0;           // request a second type of interface            //                  HRESULT hr = pCar->QueryInterface(IID_IPlane, (void**)&pPlane);         if (SUCCEEDED(hr)) {             ICar *pCar2 = 0;               // request original type of interface                //                      hr = pPlane->QueryInterface(IID_ICar, (void**)&pCar2);               // if the following assertion fails, pCar               // did not point to a valid   object               //            ,               //   pCar          -             assert(SUCCEEDED(hr));             pCar2->Release();         }          pPlane->Release();     }  } 

QueryInterface , , , .



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