Win32格式化字符串到消息框

int MessageBoxPrintf(HWND hwnd, 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 (szFormat) ;

	va_start(pArgList, szFormat);

	// The last argument to wvsprintf points to the arguments

	_vsntprintf_s(szBuffer, sizeof(szBuffer), sizeof (szBuffer) / sizeof (TCHAR), szFormat, pArgList);
		szFormat, pArgList);

	// The va_end macro just zeroes out pArgList for no good reason

	va_end(pArgList);

	return MessageBox(hwnd, szBuffer, szCaption, 0);
}

猜你喜欢

转载自blog.csdn.net/csdn_gddf102384398/article/details/85044896