⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 win32exception.cpp

📁 基于字符任务的串口通讯开发包CTaskedPort
💻 CPP
📖 第 1 页 / 共 5 页
字号:
// Win32Exception.cpp: implementation of the CWin32Exception class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Logger.h"
#include "Win32Exception.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CWin32Exception::CWin32Exception(DWORD nErrorCode)
{
	ASSERT(nErrorCode);
	m_nErrorCode = nErrorCode;
	ParseError();

	::Logger.Log("发生系统错误:%s", m_sErrorLabel);
}

CWin32Exception::~CWin32Exception()
{
	
}

void CWin32Exception::ParseError()
{
	switch(m_nErrorCode)
	{
	case 0:
		{
			m_sErrorName = "ERROR_SUCCESS";
			m_sErrorDescription = "The operation completed successfully. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 1:
		{
			m_sErrorName = "ERROR_INVALID_FUNCTION";
			m_sErrorDescription = "Incorrect function. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 2:
		{
			m_sErrorName = "ERROR_FILE_NOT_FOUND";
			m_sErrorDescription = "The system cannot find the file specified. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 3:
		{
			m_sErrorName = "ERROR_PATH_NOT_FOUND";
			m_sErrorDescription = "The system cannot find the path specified. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 4:
		{
			m_sErrorName = "ERROR_TOO_MANY_OPEN_FILES";
			m_sErrorDescription = "The system cannot open the file. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 5:
		{
			m_sErrorName = "ERROR_ACCESS_DENIED";
			m_sErrorDescription = "Access is denied. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 6:
		{
			m_sErrorName = "ERROR_INVALID_HANDLE";
			m_sErrorDescription = "The handle is invalid. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 7:
		{
			m_sErrorName = "ERROR_ARENA_TRASHED";
			m_sErrorDescription = "The storage control blocks were destroyed. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 8:
		{
			m_sErrorName = "ERROR_NOT_ENOUGH_MEMORY";
			m_sErrorDescription = "Not enough storage is available to process this command. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 9:
		{
			m_sErrorName = "ERROR_INVALID_BLOCK";
			m_sErrorDescription = "The storage control block address is invalid. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 10:
		{
			m_sErrorName = "ERROR_BAD_ENVIRONMENT";
			m_sErrorDescription = "The environment is incorrect. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 11:
		{
			m_sErrorName = "ERROR_BAD_FORMAT";
			m_sErrorDescription = "An attempt was made to load a program with an incorrect format. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 12:
		{
			m_sErrorName = "ERROR_INVALID_ACCESS";
			m_sErrorDescription = "The access code is invalid. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 13:
		{
			m_sErrorName = "ERROR_INVALID_DATA";
			m_sErrorDescription = "The data is invalid. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 14:
		{
			m_sErrorName = "ERROR_OUTOFMEMORY";
			m_sErrorDescription = "Not enough storage is available to complete this operation. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 15:
		{
			m_sErrorName = "ERROR_INVALID_DRIVE";
			m_sErrorDescription = "The system cannot find the drive specified. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 16:
		{
			m_sErrorName = "ERROR_CURRENT_DIRECTORY";
			m_sErrorDescription = "The directory cannot be removed. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 17:
		{
			m_sErrorName = "ERROR_NOT_SAME_DEVICE";
			m_sErrorDescription = "The system cannot move the file to a different disk drive. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 18:
		{
			m_sErrorName = "ERROR_NO_MORE_FILES";
			m_sErrorDescription = "There are no more files. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 19:
		{
			m_sErrorName = "ERROR_WRITE_PROTECT";
			m_sErrorDescription = "The media is write protected. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 20:
		{
			m_sErrorName = "ERROR_BAD_UNIT";
			m_sErrorDescription = "The system cannot find the device specified. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 21:
		{
			m_sErrorName = "ERROR_NOT_READY";
			m_sErrorDescription = "The device is not ready. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 22:
		{
			m_sErrorName = "ERROR_BAD_COMMAND";
			m_sErrorDescription = "The device does not recognize the command. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 23:
		{
			m_sErrorName = "ERROR_CRC";
			m_sErrorDescription = "Data error (cyclic redundancy check). ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 24:
		{
			m_sErrorName = "ERROR_BAD_LENGTH";
			m_sErrorDescription = "The program issued a command but the command length is incorrect. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 25:
		{
			m_sErrorName = "ERROR_SEEK";
			m_sErrorDescription = "The drive cannot locate a specific area or track on the disk. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 26:
		{
			m_sErrorName = "ERROR_NOT_DOS_DISK";
			m_sErrorDescription = "The specified disk or diskette cannot be accessed. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 27:
		{
			m_sErrorName = "ERROR_SECTOR_NOT_FOUND";
			m_sErrorDescription = "The drive cannot find the sector requested. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 28:
		{
			m_sErrorName = "ERROR_OUT_OF_PAPER";
			m_sErrorDescription = "The printer is out of paper. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 29:
		{
			m_sErrorName = "ERROR_WRITE_FAULT";
			m_sErrorDescription = "The system cannot write to the specified device. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 30:
		{
			m_sErrorName = "ERROR_READ_FAULT";
			m_sErrorDescription = "The system cannot read from the specified device. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 31:
		{
			m_sErrorName = "ERROR_GEN_FAILURE";
			m_sErrorDescription = "A device attached to the system is not functioning. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 32:
		{
			m_sErrorName = "ERROR_SHARING_VIOLATION";
			m_sErrorDescription = "The process cannot access the file because it is being used by another process. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 33:
		{
			m_sErrorName = "ERROR_LOCK_VIOLATION";
			m_sErrorDescription = "The process cannot access the file because another process has locked a portion of the file. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 34:
		{
			m_sErrorName = "ERROR_WRONG_DISK";
			m_sErrorDescription = "The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 36:
		{
			m_sErrorName = "ERROR_SHARING_BUFFER_EXCEEDED";
			m_sErrorDescription = "Too many files opened for sharing. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 38:
		{
			m_sErrorName = "ERROR_HANDLE_EOF";
			m_sErrorDescription = "Reached the end of the file. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 39:
		{
			m_sErrorName = "ERROR_HANDLE_DISK_FULL";
			m_sErrorDescription = "The disk is full. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 50:
		{
			m_sErrorName = "ERROR_NOT_SUPPORTED";
			m_sErrorDescription = "The network request is not supported. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 51:
		{
			m_sErrorName = "ERROR_REM_NOT_LIST";
			m_sErrorDescription = "The remote computer is not available. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 52:
		{
			m_sErrorName = "ERROR_DUP_NAME";
			m_sErrorDescription = "A duplicate name exists on the network. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 53:
		{
			m_sErrorName = "ERROR_BAD_NETPATH";
			m_sErrorDescription = "The network path was not found. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 54:
		{
			m_sErrorName = "ERROR_NETWORK_BUSY";
			m_sErrorDescription = "The network is busy. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 55:
		{
			m_sErrorName = "ERROR_DEV_NOT_EXIST";
			m_sErrorDescription = "The specified network resource or device is no longer available. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 56:
		{
			m_sErrorName = "ERROR_TOO_MANY_CMDS";
			m_sErrorDescription = "The network BIOS command limit has been reached. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 57:
		{
			m_sErrorName = "ERROR_ADAP_HDW_ERR";
			m_sErrorDescription = "A network adapter hardware error occurred. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 58:
		{
			m_sErrorName = "ERROR_BAD_NET_RESP";
			m_sErrorDescription = "The specified server cannot perform the requested operation. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 59:
		{
			m_sErrorName = "ERROR_UNEXP_NET_ERR";
			m_sErrorDescription = "An unexpected network error occurred. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 60:
		{
			m_sErrorName = "ERROR_BAD_REM_ADAP";
			m_sErrorDescription = "The remote adapter is not compatible. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 61:
		{
			m_sErrorName = "ERROR_PRINTQ_FULL";
			m_sErrorDescription = "The printer queue is full. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 62:
		{
			m_sErrorName = "ERROR_NO_SPOOL_SPACE";
			m_sErrorDescription = "Space to store the file waiting to be printed is not available on the server. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 63:
		{
			m_sErrorName = "ERROR_PRINT_CANCELLED";
			m_sErrorDescription = "Your file waiting to be printed was deleted. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 64:
		{
			m_sErrorName = "ERROR_NETNAME_DELETED";
			m_sErrorDescription = "The specified network name is no longer available. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 65:
		{
			m_sErrorName = "ERROR_NETWORK_ACCESS_DENIED";
			m_sErrorDescription = "Network access is denied. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 66:
		{
			m_sErrorName = "ERROR_BAD_DEV_TYPE";
			m_sErrorDescription = "The network resource type is not correct. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 67:
		{
			m_sErrorName = "ERROR_BAD_NET_NAME";
			m_sErrorDescription = "The network name cannot be found. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 68:
		{
			m_sErrorName = "ERROR_TOO_MANY_NAMES";
			m_sErrorDescription = "The name limit for the local computer network adapter card was exceeded. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 69:
		{
			m_sErrorName = "ERROR_TOO_MANY_SESS";
			m_sErrorDescription = "The network BIOS session limit was exceeded. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 70:
		{
			m_sErrorName = "ERROR_SHARING_PAUSED";
			m_sErrorDescription = "The remote server has been paused or is in the process of being started. ";
			m_sErrorLabel = m_sErrorDescription;
			break;
		}
	case 71:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -