📄 eccerror.cpp
字号:
/* ==========================================================================
Ecc - Erik's Code Collection
Copyright (C) 2003 - Erik Dienske
This file is part of Ecc.
Ecc is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Ecc is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Ecc; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
===========================================================================*/
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "EccError.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
//===========================================================================
namespace ecc {
//===========================================================================
void ShowErrorMessage(const String msg)
{
MessageDlg(msg, mtError, TMsgDlgButtons() << mbOK, 0);
}
//---------------------------------------------------------------------------
String LastErrorCodeToStr(DWORD last_error_code)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, // DWORD dwFlags : source and processing options
NULL, // LPCVOID lpSource : pointer to message source
last_error_code, // DWORD dwMessageId : requested message identifier
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language. // DWORD dwLanguageId : language identifier for requested message
(LPTSTR) &lpMsgBuf, // LPTSTR lpBuffer : pointer to message buffer
0, // DWORD nSize : maximum size of message buffer
NULL // va_list *Arguments : address of array of message inserts
);
String err_str = String((char*)lpMsgBuf);
LocalFree(lpMsgBuf);
return err_str;
}
//---------------------------------------------------------------------------
//===========================================================================
} // namespace ecc;
//===========================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -