EDN Admin
Well-known member
VC++ 6.0 Gods and Goddesses:<br/><br/>The application I am supporting is C++ and is compiled by VC++ 6.0<br/><br/>I am adding logging to the funcionality. The purpose of the logging is to generate an audit trail for administrators and the software life cycle team(ONLY ME
).<br/><br/>Does the GetLastError Function operate as advertised in an exception handler?<br/><br/>Inpromptu Example:<br/><br/>
<pre lang=x-cpp>Try
{
//Do something naughty with WriteFile;
}
catch(...)
{
logger myE;
myE.LogME();
}
void logger::LogMe()
{
logger::writeMessage( logger::xmlLastError() );
}[/code]
<br/>If the logger class object calls GetLastError will the error code it retrieves be accurate, or will the logger code lose the original error? <br/><br/>If so do I need to call GetLastError in the catch block and pass it in as an argument to a logger function? <br/> <br/>I have looked at the MSDN documentation, and I did not see an indication about this. I am certain this is a rookie question, but I had to ask. I appreciate the forbearance!<br/><br/><br/>Very Respectfully, <br/><br/>Bill Mummert
View the full article

<pre lang=x-cpp>Try
{
//Do something naughty with WriteFile;
}
catch(...)
{
logger myE;
myE.LogME();
}
void logger::LogMe()
{
logger::writeMessage( logger::xmlLastError() );
}[/code]
<br/>If the logger class object calls GetLastError will the error code it retrieves be accurate, or will the logger code lose the original error? <br/><br/>If so do I need to call GetLastError in the catch block and pass it in as an argument to a logger function? <br/> <br/>I have looked at the MSDN documentation, and I did not see an indication about this. I am certain this is a rookie question, but I had to ask. I appreciate the forbearance!<br/><br/><br/>Very Respectfully, <br/><br/>Bill Mummert
View the full article