Click here to Skip to main content
15,905,322 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A complex macro definition Pin
Jochen Arndt21-Mar-17 2:32
professionalJochen Arndt21-Mar-17 2:32 
GeneralRe: A complex macro definition Pin
samzcs21-Mar-17 2:36
samzcs21-Mar-17 2:36 
Questiondev c Pin
Alvi ZaDa20-Mar-17 7:18
Alvi ZaDa20-Mar-17 7:18 
RantRe: dev c Pin
Richard Deeming20-Mar-17 8:47
mveRichard Deeming20-Mar-17 8:47 
AnswerRe: dev c Pin
Victor Nijegorodov20-Mar-17 9:58
Victor Nijegorodov20-Mar-17 9:58 
AnswerRe: dev c Pin
Patrice T20-Mar-17 11:45
mvePatrice T20-Mar-17 11:45 
QuestionChange from Cstring to double in listview vc++ Pin
lolici20-Mar-17 1:31
lolici20-Mar-17 1:31 
AnswerRe: Change from Cstring to double in listview vc++ Pin
Jochen Arndt20-Mar-17 2:02
professionalJochen Arndt20-Mar-17 2:02 
A list control can not store double values without additional handling. To set the text of an item to a floating point value it must be converted. Read the documentation of the used sprintf, _sprintf_l, swprintf, _swprintf_l, __swprintf_l[^] function.
So you have to use something like
WCHAR szString[256];
swprintf(szString, sizeof(szString) / sizeof(WCHAR), L"%G", value);

But it would be better to use _snprintf_s, _snprintf_s_l, _snwprintf_s, _snwprintf_s_l[^] here:
TCHAR szString[256];
_sntprintf_t(szString, sizeof(szString) / sizeof(TCHAR), _T("%G"), value);

To get a double value back when reading the cell text use _tstof (atof, _atof_l, _wtof, _wtof_l[^]):
// double CDataDialog::GetItemText(HWND hWnd, int nItem, int nSubItem) const
double CDataDialog::GetItemDouble(HWND hWnd, int nItem, int nSubItem) const
{
    CString str = GetItemText(hWnd, nItem, nSubItem);
    return _tstof(str);
}


modified 20-Mar-17 9:01am.

GeneralRe: Change from Cstring to double in listview vc++ Pin
lolici20-Mar-17 2:56
lolici20-Mar-17 2:56 
GeneralRe: Change from Cstring to double in listview vc++ Pin
Jochen Arndt20-Mar-17 3:00
professionalJochen Arndt20-Mar-17 3:00 
GeneralRe: Change from Cstring to double in listview vc++ Pin
lolici20-Mar-17 3:32
lolici20-Mar-17 3:32 
GeneralRe: Change from Cstring to double in listview vc++ Pin
Jochen Arndt20-Mar-17 3:39
professionalJochen Arndt20-Mar-17 3:39 
GeneralRe: Change from Cstring to double in listview vc++ Pin
lolici20-Mar-17 8:02
lolici20-Mar-17 8:02 
AnswerRe: Change from Cstring to double in listview vc++ Pin
Victor Nijegorodov20-Mar-17 6:56
Victor Nijegorodov20-Mar-17 6:56 
GeneralRe: Change from Cstring to double in listview vc++ Pin
lolici20-Mar-17 7:58
lolici20-Mar-17 7:58 
QuestionRe: Change from Cstring to double in listview vc++ Pin
David Crow20-Mar-17 9:52
David Crow20-Mar-17 9:52 
QuestionCrc 32 bit Pin
yagokhan19-Mar-17 21:58
yagokhan19-Mar-17 21:58 
AnswerRe: Crc 32 bit Pin
Jochen Arndt19-Mar-17 22:15
professionalJochen Arndt19-Mar-17 22:15 
AnswerRe: Crc 32 bit Pin
yagokhan19-Mar-17 22:20
yagokhan19-Mar-17 22:20 
GeneralRe: Crc 32 bit Pin
Richard MacCutchan19-Mar-17 22:57
mveRichard MacCutchan19-Mar-17 22:57 
GeneralRe: Crc 32 bit Pin
yagokhan19-Mar-17 22:59
yagokhan19-Mar-17 22:59 
GeneralRe: Crc 32 bit Pin
Richard MacCutchan19-Mar-17 23:19
mveRichard MacCutchan19-Mar-17 23:19 
GeneralRe: Crc 32 bit Pin
yagokhan19-Mar-17 23:22
yagokhan19-Mar-17 23:22 
GeneralRe: Crc 32 bit Pin
Jochen Arndt20-Mar-17 2:36
professionalJochen Arndt20-Mar-17 2:36 
QuestionCatch double click on MDI client CMDIFrameWndEx Pin
_Flaviu16-Mar-17 22:19
_Flaviu16-Mar-17 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.