Guest User

Untitled

a guest
Jun 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. HRESULT CDemo::Div(/*[in]*/ LONG a, /*[in]*/LONG b, /*[out,retval]*/ LONG* pRet)
  2. {
  3. if (pRet == NULL)
  4. return E_POINTER;
  5.  
  6. if (b == 0)
  7. {
  8. *pRet = 0; // is this redundant?
  9. return E_INVALIDARG;
  10. }
  11.  
  12. *pRet = a/b;
  13. return S_OK;
  14. }
  15.  
  16. ISmth *pSmth = NULL;
  17. pObj->GetSmth(&pSmth); // HRES is ignored
  18. if (pSmth) // Assumes that if GetSmth failed then pSmth is still NULL
  19. {
  20. pSmth->Foo();
  21. pSmth->Release();
  22. }
  23.  
  24. HRESULT GetSmth( [out] ISmth** );
Add Comment
Please, Sign In to add comment