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);
}

你可能感兴趣的:(C语言,Win32,Windows)