Gavrilo Adamovic
Gavrilo Adamovic

Reputation: 2795

Displaying text in static text field in mfc dialog

I built a game in MFC, and I want to display the score user got in static text field of dialog, so I want to do something something like this:

staticScore.SetWindowText(_T("you got %d points", score));

But this doens't work, this displays "you got %d points" without replacing %d with score.

How can I display number that is stored in some variable in static text field?

Upvotes: 0

Views: 2799

Answers (1)

Gavrilo Adamovic
Gavrilo Adamovic

Reputation: 2795

CString score;
score.Format(_T("You got %d points"),m_score);
staticScore.SetWindowText(score);

Upvotes: 1

Related Questions