1.格式化的消息框以及出现的C49966的解决办法

来源:互联网 发布:无畏舰 知乎 编辑:程序博客网 时间:2024/06/14 05:15
#include <windows.h>//格式化的消息框#include <tchar.h>#include <stdio.h>#include "stdafx.h"int CDECL MessageBoxPrintf(TCHAR * szCaption,TCHAR * szFormat,...) {TCHAR szBuffer[1024];va_list pArgList;//The va_start macro(defined in STDARG.H )is usually equivalent to;  //pArgList = (char *) &szFormat + sizeof(szFromat);va_start(pArgList,szFormat);//The last argument to wvsprintf points to the arguments_vsntprintf(szBuffer,sizeof(szBuffer) / sizeof(TCHAR),szFormat,pArgList);//The va_end macro just zeroes out pArgList for no good reasonva_end(pArgList);return MessageBox(NULL,szBuffer,szCaption,0);}int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,PSTR szCmdLine,int iCmdShow) {int cxScreen, cyScreen;cxScreen = GetSystemMetrics(SM_CXFULLSCREEN);cyScreen = GetSystemMetrics(SM_CYSCREEN);MessageBoxPrintf(TEXT("ScrnSize"),TEXT("The screen is % i pixels wide by % i pixels high."),cxScreen,cyScreen);return 0;}


严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C4996 ‘fopen’: This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. fileDemo.c d:\vs2015workspace\filedemo.c\filedemo.c\main.c 14

解决办法::

项目–>项目属性–>c/c++ –>预处理器定义

添加:_CRT_SECURE_NO_WARNINGS

确定


原创粉丝点击