Tips for using VC ++. net integrated development environment
Below I will describe VC in the form of entries. with net2003's various usage skills, you can select the memory you are interested in. It doesn't matter if you don't even look at it. Just ask for your support. Just up, it's an encouragement to my work!
First of all, I used these skills in the VC. net2003 environment. Of course, I hope you can also have a set of skills. Of course, it doesn't mean VC6 is completely unavailable, but some features are not available. You need to try it on your own!
I. Environment Settings
1. Every sub-window in the main window can be docked. The sub-windows on the edge of the dock have two buttons in the upper right corner. One is closed, and the other is a graph nail. When the pushpin is pressed, the Child Window will not be automatically scaled back to the edge, and it can be pulled out by dragging the title bar of the Child Window. We recommend that you turn off all unnecessary subwindows, shut down the sub-forms from the dock to the bottom and left, put all the sub-forms on the right, and pull the map nails, you can see it by moving the mouse over it. The code is not blocked when it slides out, leaving the maximum space for code editing.
2. the toolbar also has the dock attribute similar to that of the subwindow. to disable the toolbar, drag it out and close it. You can set the toolbar and menu items by right-clicking the toolbar or menu bar and clicking custom in the pop-up menu, in this case, you can drag the toolbar and menu bar to easily customize the department. You can also right-click an item to set its detailed attributes. I recommend that you turn off all tool bars, because common commands have shortcut keys. If not, Use menus to save some time for code editing.
3. You can set the keyboard shortcut in the tool menu> Options> environment> keyboard. There are some preset keyboard ing schemes on it. You can select one of them and modify the schemes below and save them as your own. I strongly recommend using the keyboard ing SOLUTION OF Visual C ++ 6.0!
4. Choose tools> Options> environment> font and color to set the font and color of various identifiers in code editing. Here, you can increase the font size because the default 9 character is too small to clearly understand. My settings are on November 11. For detailed settings of the font color, you can use the custom color after the color to select the color you like. I still like the colorful appearance of the integrated code!
I. code editing
1. If the indentation of a piece of code is messy, spaces, and tabs are messy, select the code and format the selected content in the edit menu> advanced. The code is automatically sorted out. If a piece of code is left blank and tabs are staggered, but the format seems neat, you can go to the edit menu-> advanced-> View the blank to view the spaces and tabs in the code.
2. choose tools> Options> text editor> C/C ++> General to clear the startup click URL, this item is useless in C/C ++ code editing, but may cause some misunderstandings. Check the row number again. I think it is very convenient although it occupies some space. In the text editor-> C/C ++-> tab, adjust the tab size and indentation size to 4, which helps to compile the code neatly. If you open the row number, we recommend that you turn off the margin of the selected content in the text editor> General, because this is a bit more.
3. Choose tools> Options> projects> VC ++ to set the path of the project file. Generally, you can set to include files and library files.
4. there are two drop-down lists on the code compilation window, the visible fields on the left and the functions on the right. You can use these two drop-down lists to locate them accurately in a large source file. Using this function can greatly improve programming efficiency.
5. Outline display is a very good function, but many people may not get used to it. You can choose Edit> outline display> stop outline display to disable it. If you want to enable outline display when the file is not started, you can remove the outline mode when opening the file from the tool menu> Options> C/C ++> format settings.
6. after a piece of code is selected, you can press tab to increase its indentation. You can press Alt to select a piece of code in the vertical direction; place the cursor on the row number bar or the left margin of the Code (If you enable it) it will become a pointer to the opposite direction. You can select the corresponding line. After you select the code, you can drag the selected code to the appropriate position; press Ctrl and press the left and right arrow keys to move the cursor and skip the keyword. Ctrl + Home and Ctrl + End reach the top and bottom of the file respectively. Hold Shift and press the arrow key to select the characters whose cursor has been skipped, can be used with Ctrl; Ctrl + A can select all the code; Ctrl + = and Ctrl +-can return to the position of the code you just viewed; you can use the brackets matching function to help write the complete code. When matching the brackets, the code is displayed in bold. You can choose tools> Options> environment> font and color.
7. The search and replacement functions are very powerful. You can use wildcards and regular expressions. Due to the length relationship, for more information about wildcards and regular expressions, see MSDN. You can search for or replace files to easily edit the search range. You can use several predefined search scopes, including the entire solution, and the VC ++ directory. You can also click the button next to edit the detailed search range. For text file search, the search tool of VC ++ is much more efficient than that of Windows file search.
8. The following sequence contains the header file:
# Define CRTDBG_MAP_ALLOC
# Include <stdlib. h>
# Include <crtdbg. h>
Then, at the beginning of the program, write:
_ CrtSetDbgFlag (_ CRTDBG_ALLOC_MEM_DF | _ CRTDBG_LEAK_CHECK_DF );
In this way, the memory leakage will be dumped to the debugging mode of the output subwindow after the completion of the program.
Iii. Compilation:
1. if a large project requires a large number of system header files, you can write all these included header files to a StdAfx. h file, and then create another StdAfx. cpp, which contains a code, # include "StdAfx. h ", right-click solution Manager> your project, and then choose Properties> Configure Properties> C/C ++> pre-compile header, set the CREATE/use pre-compilation header to: create a pre-compilation header. The following two directions are automatically filled in. If not, fill in StdAfx. h. Then, re-compile your project into a new one, and then enter the options just now, and set the CREATE/use pre-compilation header to: Set the pre-compilation header. Now, your project Compilation speed should be extremely fast.
2. if your program needs to introduce a specific library, you can write: # pragma comment (lib, "xxx. in this way, you do not need to configure properties-> linker-> input to set, this can also improve your code compatibility.
3. if you are writing a DLL and the DLL is used by the EXE compiled by another project, but the two projects are not in the same folder, therefore, you have to copy the newly compiled DLL to the directory of the EXE and debug it. If you forget to update the DLL, this may waste a lot of time and effort. In fact, you can write a BAT file and run the DOS command copy to complete the copy task you need, and then place the BAT file in the DLL Directory, go to configuration Properties> Generate event> Generate post-event> enter the BAT file name you want to execute in the command line. After compilation, the copy task is automatically executed.
4. In the tool menu-> options-> environment-> projects and solutions, you can check the task list window if an error occurs when the generation is complete. After compilation is complete and an error is found, the task list is automatically displayed. Double-click a task to locate the line of code with the error.
Iv. Resources
1. When editing the dialog box, select a control and list all its properties in the properties subwindow. Click the lightning button above to list all the available events. Double-click an event to jump to the corresponding source file, then you can add a handler for an event of the control.
2. When you use MFC for programming, the attribute subwindow will display the available rewrite functions and Event Handlers for this class. You can double-click the subwindow to write the code. If you find that the property subwindow does not match the code, you can select the class you want to edit in the Class View, or right-click the Class View in the code editing area and select synchronization Class View.
3. An icon file is actually an icon package, which can contain many icons of different sizes and colors. You can also create, delete, and modify icons in the icon compiler of VC.net. In the image menu, you can easily create an image type, the current icon image type, and delete an image type.
4. When editing a menu, enter-in the Caption attribute of the menu item, and the menu item will automatically become a separator.
V. debugging
1. In the debugging menu-> window sub-menu, you can open these useful debugging auxiliary windows. All the windows described below can be opened here.
2. Click the left button on the far left of code editing to add a breakpoint for this line. Right-click the breakpoint to modify its attributes. For example, you can set the number of times the breakpoint is stopped, or stop the breakpoint when the condition is true. The breakpoint window allows you to configure and manage breakpoints in the source file in more detail.
3. In the automatic window and local variables, you can view almost all the values of the variables you need to view, and you can modify the values of the variables here.
4. You can view the status of all registers in the register window. In this window, right-click to open the register you want to view.
5. Call the stack, which is useful when an error occurs. For example, if a memory access error occurs, and a row in the delete source file is stopped, you can use the stack to look up to see which real error source statement is used.
6. In the command window, you can write VC ++ pre-defined commands or even some C ++ code. For example, p = 5; this is all possible. For specific available commands, see MSDN.
7. In the monitoring window, enter the name of the variable you want to view, and its value will be immediately displayed. If it is an object with a plus sign before the vertex, its members will be listed below. If there is an array int a [6], you can enter a, 6, so that you can view the values of all elements in this array. You can also convert the format, such as token and x. For more detailed and complex functions, see MSDN.
V. Common shortcut keys in keyboard ing mode in Visual C ++ 6.0 Mode
Regular text editing
Format the selected content: Ctrl + K, Ctrl + F
Forward positioning: Ctrl + =
Backward positioning: Ctrl +-
Search: Ctrl + F
Search for the file: Ctrl + Shift + F
Replace Ctrl + H:
Replace in the file: Ctrl + Shift + H
Convert to uppercase: Ctrl + Shift + U
Convert to lower case: Ctrl + U
Comment selected content: Ctrl + K, Ctrl + C
Uncomment: Ctrl + K, Ctrl + U
Enable/disable breakpoint: F9
Clear all breakpoints: Ctr + Shift + F9
Compile all: F7
Unit Compilation: Ctrl + F7
Single-step tracking: F10
Function: F11
Run to the cursor: Ctrl + F10
Jump out function: Shift + F11
Run debugging: F5
Stop debugging: Shift + F5
Restart debugging: Ctrl + Shift + F5
Run Without debugging: Ctrl + F5
Open/close bookmarks: Ctrl + K, Ctrl + K
Last bookmarks: Ctrl + K, Ctrl + P
Next bookmarks: Ctrl + K, Ctrl + N
Clear all bookmarks: Ctrl + K, Ctrl + L
Open the Properties window: Alt + Enter
Previous document: Ctrl + Tab
Next document: Ctrl + Shift + Tab
Open project: Ctrl + Shift + O
Open the file: Ctrl + O
Save: Ctrl + S
Save all: Ctrl + Shift + S
Create a file: Ctrl + N
Full Screen Display: Shift + Alt + Enter