#include #include using namespace std; // Entry point void main() { // MESSAGE BOX MODE // Enabled by default cout << "\nMessage box mode\n"; mnDNS("ERROR"); // Cause error (mnStart needs to be used before mnDNS) // SAVE MODE cout << "\nSave mode\n"; mnToggleErrorMode(EM_MESSAGE_BOX); // Disable error message boxes mnToggleErrorMode(EM_SAVE); // Enable save mode mnDNS("ERROR"); // Cause error // mnGetErrorFlag or the return value can be used // to determine if an error has occurred. mnGetErrorFlag // overcomes the problem that some commands return different // values upon error if(mnGetErrorFlag() == true) { cout << "An error occurred whilst " << mnGetErrorOperation() << '\n'; } // EXCEPTION MODE cout << "\nException mode\n"; mnToggleErrorMode(EM_SAVE); // Disable save mode mnToggleErrorMode(EM_EXCEPTION); // Enable exception mode try { mnDNS("ERROR"); // Cause error } catch(clError & Error) { cout << "An error occurred whilst " << Error.sOperation << '\n'; } // MULTIPLE MODES // In this case: exception and message box // Note: exception mode is already on cout << "\nException and message box mode (at the same time)\n"; mnToggleErrorMode(EM_MESSAGE_BOX); // Enable message box mode try { mnDNS("ERROR"); // Cause error } catch(clError & Error) { cout << "An error occurred whilst " << Error.sOperation << '\n'; } cout << "\n\n"; system("PAUSE"); return; }