During an error condition most 3DXI functions set a global error code. Two global functions are available are GetLastIGameError() for retrieving the last error code and GetLastIGameErrorText() for the last error message.
An error callback object can also be registered using SetErrorCallback(). This event is fired when the global error is set, so it can be trapped before the calling method at fault has actually returned. This approach is a convenient way to provide a full diagnostic dump for the user after an export completes. The following code shows a simple example:
class MyErrorProc : public IGameErrorCallBack { public: void ErrorProc(IGameError error) { TCHAR * buf = GetLastIGameErrorText(); DebugPrint("ErrorCode = %d ErrorText = %s\n", error,buf); } }; MyErrorProcpErrorProc; SetErrorCallBack(&pErrorProc);