MFC BASIC Programming VS2015 Latest 03

Source: Internet
Author: User
Tags sprintf

Video tutorial Address watch :Http://pan.baidu.com/s/1mhKQ6kK

One, number (floating point or integer) to text:
A) If you convert to a narrow character string, the sprintf function is very useful, and the floating-point number is fine.
b) If you convert to a wide character string, Cstring::format can be implemented in MFC;
c) wsprintf is the Windows API and does not support floating-point format output;
D) If you convert to a wide character string, you can use sprintf to convert to a narrow character string in WIN32;
Then call MultiByteToWideChar's API function to convert to a wide character string.
e) _stprintf is Microsoft's new API in recent years to directly convert floating-point or integer-to-wide character strings.

Second, Unicode and multi-character strings are converted to each other:
A) MultiByteToWideChar: is the conversion of Unicode to a multi-character string;
b) WideCharToMultiByte: is to convert a multi-character set to a Unicode string;
c) _bstr_t (Comutil.h) class can deposit and withdraw two kinds of strings at any time;

Third, the composition of MFC:
A) must have a derived class of CWinApp;
b) An object Theapp must be defined globally with a derived class;
c) The InitInstance virtual function must be overridden in a derived class;
d) The MFC program uses the InitInstance virtual function in the CWinApp derived class as the main function;

Four, MFC dialog box Program message processing (message mapping mechanism)
A) Create a CDialog or CDialogEx derived class associated with it for a dialog box template;
b) When you need to start a dialog box, define an object with a derived class, and invoke the DoModal member function with the object;
C) MFC If you want to process a message, just open the Class Wizard and select the dialog box class in the dropdown;
d) In the message list you can select the message you need, double-click to establish a message map function;
e) The message map function is: A message (and a window) corresponding to the address of a function

V. MFC base Variable Type:
A) CPoint (Point derived class): Record and replace x, y coordinates; for example: CPoint pt (32,52);
b) CSize (Size derived class): Record and replace cx,cy aspect; for example: CSize pt (32,52);
c) CRect (Rect derived class): Record and replace left,right,top,bottom aspect; for example: CSize pt (32,52);
D) CString: Class for recording and changing strings
e) Some data collection classes: For example: CList CArray cmap and so on;

MFC BASIC Programming VS2015 Latest 03

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.