C + + Learning notes

Source: Internet
Author: User

Some questions about VS

1, VS2013 in the use of fopen, sprintf and other functions will appear security issues:

Error C4996: ' fopen ': This function or variable could be unsafe. Consider using fopen_s instead. To disable deprecation, use _crt_secure_no_warnings. See online Help for details. and error. Workaround: Right-click the project name--property-->c/c++--> preprocessor--preprocessor definition, edit right input box join: _crt_secure_no_warnings save.

2. Cannot convert from const char * to LPCWSTR

Successful projects compiled in VC 6.0 often have type errors in VS2005 vs2005, vs2008, vs2010. The common error is that you cannot convert from const char * to LPCWSTR, such as using the MessageBox (HWND, "test", null,0), if you use the cast (LPCWSTR) "Test", you can pass, but the encoding will go wrong.

The possible way is to use the _t ("test") conversion, or the TEXT ("test") can be MessageBox (hwnd,text ("test"), null,0); MessageBox (hwnd,_t ("TEST"), null,0);

or force the use of ANSI characters MessageBoxA (hwnd, "TEST", null,0); Another way is: the Project menu-project Properties (last)-Configuration properties-General-Project Default--character set, will use the Unicode character set instead of set. 3, set the current operation of the project as the default startup item right-click the solution-"Common Properties –" Startup Project-"Current selection.

4. An error occurred in vs2013: undefined identifier Ulong_ptr,bool,dword,lpctstr,hwnd, etc.

Increase in file header: Include header file Windef.heg: #include

5, vs2012 with MFC programming, with CString to define an object, M_strline, want to implement the ONCHAR message implementation keyboard input A string, add it to M_strline, write the following code m_strline + = NChar; Error: operator does not match operand type

Because NChar is a unit type, and M_strline is a CString type, different types of operations such as adding and subtraction, assignment, etc., need to be changed to m_strline + = (char) NChar;

6, vs2012 Delete a member function (not physical deletion is commented out only)

Right-click the member function belongs to the class, select the Class Wizard, in the Pop-up dialog box selected in the member function, click the Delete handler to achieve the effect of adding comments before the member function;

vs shortcut Keys

Ctrl+k,c: Comment Selection

Ctrl+k,u: Deselect Comment content

CTRL + LEFT and RIGHT arrow keys: One word can be moved at a time

C + + Learning notes

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.