Dealing With HRESULTS|
Here's a little macro and function combo you might find useful when dealing
#define Report(function) _Report(__FILE__, __LINE__, #function, function)
HRESULT _Report(const char* szFileName, int nLine, const char* szFunction, HRESULT hResult)
cerr << szFileName << " [" << nLine << "] - FAILED. Result: " << hResult << endl;
This makes some pretty easy to understand code, for example:
if (Report(pDDS->Flip(NULL, DDFLIP_DONOTWAIT )) == DDERR_WASSTILLDRAWING)
// Do some AI...
I think this provides a simple, yet effective way of logging errors that may
occur. If you want something more versatile, you could try transforming the
_Report function to a singleton class, complete with file logging.
The zip file viewer built into the Developer Toolbox made use
of the zlib library, as well as the zlibdll source additions.