📄 console_error.cpp
字号:
/******************************************************************************
*******************************************************************************
** **
** Copyright (c) 2006 Videon Central, Inc. **
** All rights reserved. **
** **
** The computer program contained herein contains proprietary information **
** which is the property of Videon Central, Inc. The program may be used **
** and/or copied only with the written permission of Videon Central, Inc. **
** or in accordance with the terms and conditions stipulated in the **
** agreement/contract under which the programs have been supplied. **
** **
*******************************************************************************
******************************************************************************/
/**
* @file console_error.cpp
*
* $Revision: 1.4 $
*
* default error handling
*
*/
#if _MSC_VER
#include <windows.h>
#endif
#include <stdio.h>
#include "error.h"
#include "vcitypes.h"
#include "dbgprint.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
*******************************************************************************
* DisplayError displays a message containing the function name,
* source code line number, error name, and error code. If the error code
* is VDVD_ERROR_PLATFORM_FAILED and the symbol is defined
* the Windows' GetLastError code is displayed
* instead of the VDVD error code.
*
* @param functionName string containing function name
* @param sourceLineNumber line number of source code that generated error
* @param vdvdErrorCode VDVD error code
*
*******************************************************************************/
void DisplayError ( const char* filename, const char* function, uint32 sourceLineNumber, VDVD_ERROR vdvdErrorCode )
{
switch ( vdvdErrorCode )
{
case VDVD_SUCCESS:
return;
break;
case VDVD_ERROR_TIMEOUT:
return;
break;
case VDVD_ERROR_PLATFORM_FAILED:
#if _MSC_VER
TCHAR errorName[1024];
DWORD lastErrorCode;
lastErrorCode = GetLastError();
FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
lastErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
errorName,
sizeof(errorName)/sizeof(TCHAR),
NULL );
DbgPrint( ("\n%s:%s(%d) failed: %s(%d)\n", filename, function, sourceLineNumber, errorName, lastErrorCode ) );
#endif
break;
default:
DbgPrint( ("\n%s:%s(%d) failed: %s(%d)\n", filename, function, sourceLineNumber, ConvertErrorToString( vdvdErrorCode ), vdvdErrorCode ) );
break;
}
DbgPrint( ("press any key to continue\n") );
getchar();
}
#ifdef __cplusplus
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -