VC + + How to copy a project's resources (such as dialog boxes) to another project in MFC project

Source: Internet
Author: User

The problem: the resources used in Project 1 have already been made available in Project 2. That is, the dialog box used in Project 1 is exactly the same as in Project 2, and the layout of the dialog box in Project 2 is well-designed and the control variables are bound. However, because of this dialog box control is particularly large, if in the project 1 redesign again, is repeating the project 2 of the dialog box work, and the workload is very big, how to project 2 designed resources such as dialog boxes, menus copied to the project 1?
Steps:
1: Find the RC file of Project 2, which is the resource file, open the file in Notepad, locate the dialog section, and copy the code snippet for the dialog box you want.
2: Locate the RC file for Project 1, which is the resource file, open the file in Notepad, locate the dialog section, and paste the copied code here.
3: Save the Project 1 rc file, if the prompt ID is conflicting, the control ID value copied in Project 2 is occupied in Project 1 or does not exist, open the Resource.h file, find the conflicting ID, change an integer value, or add an ID to save the file.

4: Switch to the solution Manager, open the Resource.h file, you will find the newly added dialog resource ID and the control ID has been added automatically, but the ID number may be duplicated, you need to manually reset the newly added control ID number, set the completion note modify the bottom of the Resource.h file # Ifdef apstudio_invoked The following numbers so that when the new control is added, VS can automatically generate the new ID number correctly. Or simply copy the Resource.h file from Project 2 to replace the project 1 file with the same name.

5: Copy the Dialog class file "dialog class name. h" and "dialog class name. cpp" in Project 2 to Project 1 and add to Solution Manager

Note: Before you proceed to step 2, make a backup of the RC file in Project 1 to prevent errors and not change it back.

At this point, the dialog box in Project 2 is copied to project 1, eliminating the heavy lifting of the Design dialog box in Project 1, which binds the control. The menu and string resources can also be copied.

Reference documents:

How to copy the resources of one project to another project in VC? How to copy and Reuse dialog resources between different engineering (solutions) of MFC

Replication of dialog resources in MFC

VC + + How to copy a project's resources (such as dialog boxes) to another project in MFC project

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.