Recent research VC + +. Download VS2013, according to "Visual C + + Development Combat series" First Hello I wrote a regular sample, the results show garbled edit box. The night has been a toss-up change. It then summarizes the apparent ANSI and Unicode differences.
When the old tutorial just came out, these control interfaces are in ANSI format, and now they are all unified into Unicode.
Reprint Please specify:http://blog.csdn.net/sadshen/article/details/46405637
void Chellodlg::onbnclickedok ()
{
CString Csplus; Defining string variables
CString Cssummand;
M_plusnumber.getwindowtext (Csplus); Gets the text in the edit box control
M_summand.getwindowtext (Cssummand);
int nplus = _wtoi(csplus);//atoi (Csplus.getbuffer (0)); Convert the text of an edit box to an integer
Csplus.releasebuffer ();
int nsummand = _wtoi(Cssummand);//atoi (Cssummand.getbuffer (0));
Cssummand.releasebuffer ();
int nret = Nplus + Nsummand; Perform addition operations
wchar_t chret[10] = {0};//char chret[128] = {0};
_itow_s (Nret, Chret, ten);//itoa (Nret, Chret, 10); Convert the result to a string
M_result.setwindowtext (Chret);
Todo:add your control notification handler code here
Cdialogex::onok ();
}
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
Visual C + + Learning Note 1: Be sure to note the ANSI and Unicode differences