The problem comes from these lines:
char strNumber[20];
...
sprintf(strNumber, "%d-%d", number1, number2);
...
dlg.m_ItemNumber = strNumber;
}
You didn't show us the type of
m_ItemNumber
but I guess it is a
CString
.
You have two options:
1- Change your project settings so that
CString
class will use ANSI strings.
To do that, display the project properties, then select
General, then change the
Character Set field to
Not Set. Do that for all configurations (Release and Debug).
2- If you don't want to change your project settings, then you need to use the appropriate types and functions. Change the lines I mentionned into:
TCHAR strNumber[20];
...
_stprintf(strNumber, _T("%d-%d"), number1, number2);
...
dlg.m_ItemNumber = strNumber;
}
And make sure the type of
m_ItemNumber
is
CString
.
This will work wether your project uses wide char strings or not.