该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
#include
#include
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 reason
va_end(pArgList);
return MessageBox(NULL,szBuffer,szCaption,0);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
int cxScreen, cyScreen;
cxScreen = GetSystemMetrics(SM_CXSCREEN);
cyScreen = GetSystemMetrics(SM_CYSCREEN);
MessageBoxPrintf(TEXT("ScrnSize"),TEXT("The screen is %i pixels wide by %i pixels high."),cxScreen,cyScreen);
return 0;
}
在vs2013上运行一切良好,改个 _vsntprintf_s就行了,但是在vc++6.0上却报错,求解啊。。。在线等
报错信息
-------------------Configuration: 1 - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/1.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
1.exe - 1 error(s), 0 warning(s)