VC entry
He Zhidan
"Targeting object"
I want to learn VC, not a friend of VC. If you have just learned VC, you can take a look at other articles of this series.
"Summary"
1. Establish the simplest VC program
2, DEBUG and RELEASE differences and switching methods
3, how to back up VC code
"text"
Everything starts, first we write a simplest VC program.
1, enter the VC.
2, main menu file-> new.
3. Select MFC AppWizard (Exe) in the project to enter engineering names (such as Single) and path.
4, MFC Appwizard -Step 1, select a single document, other steps by default, I will finish directly.
5, CTRL F5 runs.
We can see a simplest program, not adding a line of code.
I use this as a prototype, simply explain the common problems of VC.
1. Select the CSINGLEVIEW class, right-click, right-click, right-click, and Str, respectively, and double-click SINGLEVIEW () in the workspace (left). Double-click SINGLEVIEW (), add Str = "I will vc!", Pay attention to the quotation of English. Double-click onDraw (), and add PDC-> Textout (100, 110, STR), 100 is the horizontal seat, 110 is a longitudinal.
Ctrl F5 View results.
Exercise: Print the Jiujiu Multiplication Decision. Tip:
INT x1 = 1, x2 = 1;
CString Str;
Str.Format ("% D *% D =% D", X1, x2, x1 * x2);
2, the menu is selected in the workspace (left), then expand the menu, double-click IDR_MAINFRAME, double-click the following empty menu item, enter ID iD_USER, title user. CSINGLEW, select CSINGLEVIEW in the class name, select ID_USER in the id Double-click the Command in the message, determine. Double-click the function we just added, add the following code:
Str = "i can use vc!";
Invalidate ();
Ctrl F5 looks at the results.
Exercise: The first time click in the menu to display English, then display Chinese when clicking on the menu.
Tip: String (CSTRING class) can be compared with "==".
MFC AppWizard's two most important steps:
Step1: What type of applications Would you like to create? (Generate the type of application)
1, Single Document single document, such as Notepad, you can't open two files at the same time.
2, Multiple Document multi-document, such as Word.
3, Dialog Based based on dialog, such as mine, calculator.
Step 6: (The program based on the dialog box is not allowed) Base Class Base Category:
1, CView: The most basic view class.
2, CEDITVIEW: Automatically generates a simple notebook.
3, CFRomView: Similar to the dialog, the Self-with menu toolbar status bar.
4, chtmlview: add a small amount of code to browse the web.
5, cricheditView: Easy to handle the image.
6, CScrollView: Self-band scroll bar.
Debug and Release difference and switching method
Debug is often referred to as a debug version, which contains debugging information, and does not make an optimization, facilitating programmer debugging. Release is called a release version, which has been optimized, making the program in size and running speed so that users can be used well. In fact, Debug and Release have no essential difference. They are just a set of compile options, and the compiler is just a scheduled option action. We can modify these options through the main menu -> Project-> Setting (Alt F7). Debug and Release Switch: Main Menu -> Build -> Set Active Configuration
How to back up VC code
Delete Debug and Release folders, in order to easily retain the Release version of the executable.
Delete file: *. OPT, *. NCB, *. PLG. You can delete files (not recommended): * .dsw, *. CLW.
Regeneration * .dsw: Double click on * .dsp.
Regeneration * .clw: Ctrl W Opens the class wizard, select the file.
If you have any questions, please contact me by contact with http://www.vcshare.net/.