2
votes

I have two project, Project1 and Project2, both project have rc file(resource.h), I want combime two resource into one project, for example, in Project1, I can use two resource: Project1's rc and Project2'2 rc; how can I do? thanks

1
does plain drag and drop work? I remember pulling two .rc files in one project. or, see if you can right click and import existing rc files.RC Brand
Have you tried editing the two .rc files separately in Visual Studio? You can then cut/copy/paste dialogs, menus, etc.rrirower
You may do a plain text merge - just copy-paste whatever parts are relevant. Note that merging depends on resource type, e.g. for dialogs you need to copy the dialog definitions, for text strings you need to merge all entries into one table, for version you need to pick whatever version section is relevant (I don't think you can have two version sections in one .rc file).void_ptr
In addition, make sure your resource.h file is merged, or one included into the other, so that all the resource identifiers are defined. Note that you will probably need to resolve numbering conflicts.void_ptr

1 Answers

2
votes

It can be achieved by making use of TEXTINCLUDE resource directive mentioned here

Basic idea is to include required rc files in each others rc file, just like we include header files.

For example, in Project1.rc, you can include Project2.rc as shown below.

#ifdef APSTUDIO_INVOKED

// ... other directives if any

3 TEXTINCLUDE 
BEGIN
    // ... other definitions
    "#include ""Project2\\Project2.rc""\0"
END

#endif    // APSTUDIO_INVOKED


//... other resource entries


#ifndef APSTUDIO_INVOKED

#include "Project2\\Project2.rc"

#endif    // not APSTUDIO_INVOKED

Now modify Project2.rc to include Project1.rc, as shown above.