📄 shpp.cpp
字号:
#include "SHPP.h"
#ifdef _DEBUG
char* CErrorMessage::ErrorString[] =
{
{"请求处理成功"}, //0 KN_OK
{"没有注册非法的IP地址"}, //-1 KN_RequestFailed
{"你没有这个权限"}, //-2 KN_Unimplemented
{"密码错误"}, //-3 KN_WrongVersion
{"非法请求"}, //-4 KN_ReqBufOverflow
{"参数出错"}, //-5 KN_SocketError
{"不能打印这月份的清单"}, //-6 KN_FileNotFound
{"本月没有清单"}, //-7 KN_ValueNotFound
{"你有欠费"}, //-8 KN_BadIndex
{"版本出错"}, //-9
{"未定义"}, //-10 KN_SessionIDRepeat
{"网络出错"}, //-11
};
CErrorMessage::CErrorMessage(char* inMes /* = NULL*/,KN_Error snError /* = 0*/)
{
m_sfssError = snError * -1;
m_nSysError = WSAGetLastError();
if(inMes)
{
m_pchMes = new char[strlen(inMes)+1];
strcpy((char*)m_pchMes,inMes);
}
else m_pchMes = NULL;
}
CErrorMessage::~CErrorMessage()
{
if(m_pchMes)
delete []m_pchMes;
}
Bool16 CErrorMessage::GetErrorMessage(char* pchErrorMessage)
{
char text[200];
if(m_nSysError == 0) {
if(m_pchMes)
wsprintf(text, "%s : %s error", (const char*) ErrorString[m_sfssError],m_pchMes);
else
wsprintf(text, "%s error", (const char*) ErrorString[m_sfssError]);
}
else {
if(m_pchMes)
wsprintf(text, "%s : %s error #%d", (const char*) ErrorString[m_sfssError],m_pchMes, m_nSysError);
else
wsprintf(text, "%s error #%d", (const char*) ErrorString[m_sfssError], m_nSysError);
}
strncpy(pchErrorMessage, text,strlen(text));
*(pchErrorMessage+strlen(text)) = '\0';
return TRUE;
}
#endif //_DEBUG
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -