VC Getting Started Collection Eight (Basic Operation)

zhaozj2021-02-16  46

Basic operation

He Zhidan

main content:

Workspace (ClassView, ResolyView, Fileview)

menu

APP WIZARD (Application Wizard)

Class Wizard (class wizard)

Standard control

Commonly used debugging method

The window of the VC is divided into three parts, the body window (upper right angle), the working window (left), the output window (below).

Work window has three labels, classview, resoreceview, fileview; click " ", "-" open folder; for the folder or file that does not open, double-click to open; for the open folder double-click close. Double-click the class name in ClassView,

The text window displays the class definition, double-clicking on the member variable view definition, double-click function to enter function. Right-click on the function name,

There are two functions of more practical value: Calls, Called By. Right click on the class name, two features are very valuable:

Add a member variable to increase the member function.

Common menu:

Edit-> Advanced / Format Selection Alt F8 Conges the selected object

Edit-> Advanced / Make Selection Uppercase Ctrl Shift U changed the selection part to uppercase

Edit-> Advanced / Make Selection LowerCase Ctrl U Turn the selected part to lowercase

EDIT's last three menus do not have much practical value, because if you want to view a member of a class, you can use the classname ::, you will list the member, you only need to make ahead reply (or other non-identifier characters) It is possible to automatically match the first eligible member. When you finish the function name, when you correct parentheses, you will display the information, including comments on the function definition of the same line.

View-> ClassWizard Ctrl W Editing the class in the application

View-> DebugWindow Ctrl F10, runs to the cursor, and its child can be used.

The Debug menu is basically used, set Active Configuration, setting the Debug mode or Release mode.

#ifdef _Debug

#ENDIF

The statement between this macro definition is not executed in the Release mode.

Tool-> Customize-> Toolbars definition toolbar

Apwizard has a few steps, only the first, second, and final step more important.

First step selection: MFC a Ppwizard (Exe);

Step 2: SINGLE Document Single document

Multiple Document multi-document

Dialog Basede Based on dialog

The last step (based on the dialog):

Base Class:

Select the base class of the view class, each base class is more obvious, and everyone will try it. Application Guide automatically generates an application class, document module class, framework class, document class, and view class. Most of the simple program is in the view class. When the data is more complicated, the document class is used.

Ctrl W Open ClassWizard

This dialog contains the following tabs.

1, Message Maps tab: Connection between the management message and the member function. 2, MEMBER VARIABLES tab: Use the user to join or delete member variables (associated with the control).

3, Automation tab: Provide a variety of features to support Automation, allow users to easily delete Automation properties and methods.

4, Active Events tab: Provide a variety of features to support ActiveX, allowing users to easily delete properties and response functions.

5, Class Info tab: Display information, allows users to create new classes to support dialogs and formatted views.

Message Maps

1 Projcect Engineering, it is generally not necessary to modify because there is only one.

2, Class Name class name

3, Object IDs lists the ID number of the currently selected object, including menu items, dialog controls, etc. generated by messages.

4, Message lists the current items of the current item selected in the Object IDS box and the MFC function that can be rewritten. Double-click the message equivalent to addfunction.

5, the Member Functions list box lists all members functions included in the Class Name box current class. Labeling V is virtual function, and the WINDOWS message is marked.

MEMBER VARIABLES tab:

Double-click the ID, pop up the increasing member variable dialog box:

Category has two options, values, controls, each control and a value type data, and can also be associated with a control type data.

When you edit a dialog, there will be more toolbars, there are many standard controls. If you accidentally turn it off, right-click on the blank of the standard toolbar, such as the right side of the menu, hook the Controls. There are two ways to add a control to the dialog:

1, drag directly to the dialog.

2. Click on a control and draw it on the dialog box.

The most commonly used methods of debugging, if we suspect a plastic variable X has problems, you can:

1, cstring str;

Str.Format ("% D", x); // and printf very similar

MessageBox (STR);

Advantages: Point determination The procedure will continue to run.

Disadvantages: If there is too much time, it is too wasteful and keyboard.

2, CTRL F10 runs to the cursor, enter X in the Watch window, and the value will be displayed later.

Advantages: Simple, you can view all values.

Disadvantages: It is not possible to see the case where the second run is here.

3, #ifdef _debug

AFXDUMP << x;

#ENDIF

The result is displayed in Output and cannot be in the Release state. Ctrl f5 seems to be invalid, F5 can.

AFXDUMP.SETDEPTH (1); Set the depth, such as Maps, Arrays, which only plays a few element, we use this function, it will play all the content. # idf _debug char TEST [] = "0123456789 / N "; AFXDUMP.HEXDUMP (" - ", (byte *) TEST, 11, 6); # Endif results: - 30 31 32 33 34 35 - 36 37 38 39 0A first parameters, line First head character. Second parameter, content to be played. The third parameter, the number of elements to play. The fourth parameter, the number of each line.

4, trace2, trace0, trace1, trace2, tracks can only be used in terms of taking strings when debugging, including ending, no more than 512 characters. 5. In the debug state F9 After setting breakpoint, F5 to the next breakpoint, F10 next line, F11 enters function (including system functions), SHIFT F11, after the SHIFT F11, the debug menu has a corresponding menu item. F5, view-> debug Window's submenu items are more useful .Watch View your specified variables Variables display AUOT variables, local variables, this value Memory Display specified Value Call Stack Display Function Call Relationship Registers Register DISABBLEMBLE assembly code

In fact, RELEASE can also be debugged with F5alt F7 engineering set C / C Generate Browse Info option. Debug Info PROGAME DATABASE for Edit and Continuelink Generate Debug Info Select Link Incrementally selected

转载请注明原文地址:https://www.9cbs.com/read-25722.html

New Post(0)