#include using namespace std; #include using namespace KException; namespace KException { KDxException:: KDxException() { err_code = -1; err_string = ""; err_description = ""; err_filename = ""; err_line = 0; err_funcname = ""; err_msg = ""; } KDxException:: KDxException(const KDxException& e) { err_code = e.err_code; err_string = e.err_string; err_description = e.err_description; err_filename = e.err_filename; err_line = e.err_line; err_funcname = e.err_funcname; err_msg = e.err_msg; } KDxException:: ~KDxException() { } void KDxException:: ConstructErrorMsg(void) { //create a string containing the complete error //information stringstream sstream_error_info; sstream_error_info << " " << err_code << ":" << err_string << endl\ << " Description: " << err_description << endl\ << " File: " << err_filename << endl\ << " Function: " << err_funcname << endl\ << " Line: " << err_line << endl; err_msg = sstream_error_info.str(); } void KDxException:: DisplayErrorMsg(void) { //copy the c++ string into a TCHAR array //before passing it to the WinAPI function //to display the msg int msg_len = err_msg.length(); int i; TCHAR * temp = new TCHAR[msg_len]; for(i=0; i