禁止程序出错后,弹出错误窗口

//*******************************************************
void myInvalidParameterHandler(const wchar_t* expression,
const wchar_t* function, 
const wchar_t* file, 
unsigned int line, 
uintptr_t pReserved)
{
wchar_t buff1[512] = {0};
wchar_t buff2[512] = {0};
swprintf_s( buff1,_countof(buff1),L"Invalid parameter detected in function %s."
L" File: %s Line: %d\n", function, file, line );
swprintf_s( buff2,_countof(buff2),L"Expression: %s\n", expression );
WriteToLog( buff1 );
WriteToLog( buff2 );
wprintf(buff1);
wprintf(buff2);
}

//********************************************************

main() 中

{

_invalid_parameter_handler oldHandler, newHandler;
  newHandler = myInvalidParameterHandler;
  oldHandler = _set_invalid_parameter_handler(newHandler);

// Disable the message box for assertions.

     _CrtSetReportMode(_CRT_ASSERT, 0);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值