59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
#include "StdAfx.h"
|
|
#include "_error.h"
|
|
//***********************************************************
|
|
|
|
C_error::C_error(void)
|
|
{
|
|
limpia();
|
|
}
|
|
//***********************************************************
|
|
C_error::~C_error(void)
|
|
{
|
|
}
|
|
//***********************************************************
|
|
void C_error::pon_win( char *modulo )
|
|
{
|
|
DWORD dw;
|
|
|
|
strcpy(this->modulo,modulo);
|
|
dw = GetLastError();
|
|
|
|
if(dw==NO_ERROR)
|
|
{
|
|
tipo=NO_ERROR;
|
|
return;
|
|
}
|
|
FormatMessage(
|
|
FORMAT_MESSAGE_FROM_SYSTEM |
|
|
FORMAT_MESSAGE_IGNORE_INSERTS,
|
|
NULL,
|
|
dw,
|
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
(LPTSTR) &msg,
|
|
256,
|
|
NULL );
|
|
tipo=(int)dw;
|
|
}
|
|
//***********************************************************
|
|
void C_error::pon( char *mod, char *mens, int tip/*=-1*/ )
|
|
{
|
|
strcpy(this->modulo,mod);
|
|
tipo=tipo;
|
|
strcpy(msg,mens);
|
|
}
|
|
//***********************************************************
|
|
void C_error::aclara( char *mens )
|
|
{
|
|
char str[256];
|
|
sprintf(str,"%s: %s",mens,msg);
|
|
strcpy(msg,str);
|
|
}
|
|
//***********************************************************
|
|
void C_error::limpia()
|
|
{
|
|
tipo=NO_ERROR;
|
|
msg[0]=0;
|
|
modulo[0]=0;
|
|
}
|
|
//***********************************************************
|