Export (0) Print
Expand All
MFC
TRY
Expand Minimize
This topic has not yet been rated - Rate this topic

AfxCheckError

This function tests the passed SCODE to see if it is an error.

void AFXAPI AfxCheckError(
   SCODE sc 
);
throw CMemoryException*
throw COleException*

If it is an error, the function throws an exception. If the passed SCODE is E_OUTOFMEMORY, the function throws a CMemoryException by calling AfxThrowMemoryException. Otherwise, the function throws a COleException by calling AfxThrowOleException.

This function can be used to check the return values of calls to OLE functions in your application. By testing the return value with this function in your application, you can properly react to error conditions with a minimal amount of code.

NoteNote

This function has the same effect in debug and non-debug builds.


AfxCheckError(::CoCreateInstance(clsidWMP, NULL, CLSCTX_INPROC_SERVER, 
   IID_IDispatch, (LPVOID*)&pWMPDispatch));

oddWMP.AttachDispatch(pWMPDispatch, TRUE);


Header: afxdisp.h

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.