void RetailOutput(TCHAR *szFormat, ...)
{
TCHAR szBuffer[1024]; // Large buffer for long filenames or URLs
const size_t NUMCHARS = sizeof(szBuffer) / sizeof(szBuffer[0]);
const int LASTCHAR = NUMCHARS - 1;
// Format the input string
va_list pArgs;
va_start(pArgs, szFormat);
// Use a bounded buffer size to prevent buffer overruns. Limit count to
// character size minus one to allow for a NULL terminating character.
_vsntprintf(szBuffer, NUMCHARS - 1, szFormat, pArgs);
va_end(pArgs);
// Ensure that the formatted string is NULL-terminated
szBuffer[LASTCHAR] = TEXT('\0');
...
void CUrlFileDlg::OnMaxtextProgress()
{
// TODO: Add your control notification handler code here
m_editProgress.SetWindowText(NULL);
}
// place a caret at the end of the text and append the text to the edit box
const int nLen = m_editProgress.GetWindowTextLength();
m_editProgress.SetSel(nLen, nLen);
m_editProgress.ReplaceSel(strStatus);