Some practical tips for VC

zhaozj2021-02-11  195

Visual C 6.0 (5.0) development tools are very powerful, but for beginners, there are many details questions. The author collects the following practical tips, I hope to help beginners.

1: When using the VC development project, this will often encounter this:

That is, it is clear that only one file is changed, but all the entire project is re-connected once. Just connected, once, and prompt to recompile the connection once, very annoying. This is because there is a future file.

Solution:

Find the debug directory under the corresponding folder, all DELETEs in the future, and then Rebuild All. (Future documents are after its creation and modification time is later than the system time)

2: Sometimes, ClassView in Workspace displays confusing. It is as follows:

(1): The added member variable or function cannot be displayed;

(2): Even if the variable or function is displayed, do not jump to the correct position after double-click.

Solution:

Delete .ncb file, then rebuild all.

3: How to clean a class?

1: First remove the corresponding .h and .cpp file from the FileView in Workspace.

2. Turn off the project and remove the corresponding .h and .cpp file from the actual folder.

3. The disaster deletion. Clw file.

Open the project, Rebuild All.

4: Beginners often have such doubts:

Directly expect the project file to join a CPP original file and compile the connection, always prompts that the pre-translated head is not found.

Solution:

#include "stdafx.h"

5: How to join your definition class to the project?

There are many ways to introduce a simple:

Select Insert / New Class menu

pop-up dialogue box;

Select Class Type for generic;

Enter the class name.

Of course, you can also determine the base class of this class.

6: How to import multiple projects in the workspace (Workspace)?

After opening a project (* .dsp file), select another project file (* .dsp file) in the INSERT Project Into Workspace submenu under the "Project" menu, you can insert another item.

In the ClassView view, the right click can activate one of the items, and the workspace is inserted into multiple projects. It can be easily copied between different items, resources, etc.

7: How much is the class to organize in the ClassView view?

We can first click New Folder in the ClassView view, and then drag the class with similar properties to the corresponding folder, so that the entire view looks clear.

8: How to quickly delete a temporary file under the Debug folder under the project?

Select the corresponding item in the FileView view, right click Clean.

9: Open a source of project editing operations very slow, what should I do?

Do not open the project file (* .dsp file), open the single source file (* .h or * .cpp) to edit (* .h or * .cpp) to edit, it is much better.

10: If you want to copy the entire project to a floppy disk, can those files can be deleted?

In addition to the project folder, the DEBUG folder can be deleted, .ncb, .clw, .OPT and other files can also be deleted, which can be regenerated after these files Rebuilt ALL.

11: How to quickly generate a new project that is exactly the existing project except for the project name?

Using the File menu to generate the Custom Appwizard in a new project, select An EXISTING Project, then select the project file name (* .dsp) finish of the existing project, then generate one can generate the same, which can be the same but you can re-name Project AppWizard. You can use it like MFC AppWizard. If you don't want to use it, you can delete this Wizard and .pdb file in the COMMON / MSDEV98 / TEMPLATE directory in the VC installation directory. 12: How to locate the cursor to the symmetrical {} and #IF, #ENDIF?

The former uses Ctrl and "}" keys, the latter uses Ctrl and "K" keys.

13: How do I set the header file and library file in the VC?

In addition to the VC default header files and library files, if you often use a third-party header file and library files can be set in the Directories for Tools Options. If you are just this project, you can set the library file in the Project Setting-> Link Object / Library Modules.

14: If the console application supports the MFC class library?

You can introduce the MFC library in the console application, but the console application is single-threaded, MFC is multi-threaded, in order to solve this contradiction, in the Project Setting-> C / C option, select Code Generation, Select Debug Multithread in the Use Run-Time Library drop-down box.

15: How to add an ODBC function for an MFC application?

(1) Add the following line at the end of the file stdafx.h file:

#include // MFC ODBC Database Classes

(2) Edit the RC file in text mode (using the file-> open as text)

Drawings in the following procedures (two places)

#include "l.chs / afxprint.rc" // Printing / Print Preview Resources

Add a next line:

#include "l.chs / afxdb.rc" // Database Resources

16: How do I quickly update a CRecordset recordset that binds to a table after the database table changes?

Use UpdateColoumns and Bind ALLs after selecting the record category under the MEMBER VARIABLES tab.

17: How to Chinese only if there is an executable code ?exe file?

Using VC Open file in NT to open the * .exe file in the resources method, the resource file is directly modified, and then saved.

The above is just some small problems that are often encountered by the first school VC, hoping to learn together with you.

If you have any questions, please come to email: hong_qiao@netese.com Hong_qiao.home.chinaren.com

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

New Post(0)