I wrote this program that has several Edit controls in the main window and numbers printed in them when you start the application. In most Edit controls I print doubles, but in one Edit control I print an integer. I used this piece of code that I found in the 'Programming Windows' book of Charles Petzold to convert one or more numbers in a wide-character string:
Code:
TCHAR* NumberToString(TCHAR* szFormat, ...)
{
TCHAR szBuffer[1024];
va_list pArgList;
va_start(pArgList, szFormat);
_vsnwprintf_s(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), sizeof(szBuffer)/sizeof(TCHAR), szFormat, pArgList);
va_end(pArgList);
szFormat = szBuffer;
return szFormat;
}
and then I use these two lines in the WinProc to print the variable set.timesteps, which is actually 1, in an edit control with handle hwndEdit[9]:
Code:
SetWindowText(hwndEdit[9], tempbuf);
tempbuf = NumberToString(TEXT("%d"), set.timesteps);
This works perfectly fine on several pcs except on one pc of a colleague of mine. There a 'V' is printed in the edit control. This seems like a Unicode problem but I have no clue as to what can be the cause.