none
how to convert int to LPCTSTR RRS feed

  • Question

  • Recently,i developed a small windows application using MFC with vc++ 2005

    i needed the MessageBox function to display an int, but the parameter to the MessageBox must be LPCTSTR,

    so what should i do?

     

    for instance,

     

    Code Snippet
    int number=1;

     

     

    how to display number with the MessageBox function?

     

    thanx, 

    Sunday, February 24, 2008 1:45 PM

Answers

  • Use _T() decorator for Unicode-aware code:

     

    Code Snippet

    int number = 1;

    CString t;

    t.Format(_T("%d"), number);

    AfxMessageBox(t);

     

     

     

    Giovanni

     

    Monday, February 25, 2008 9:31 AM

All replies