Thursday, April 23, 2009

How to import dialogs or resources from one project to another?

Assume you have two projects - Project1 and project2 and you want to copy one dialog from Project1 to Project2. Just follow the steps -

For Visual Studio 6.0
1) Load project2 workspace in visual studio.
2) Now Browse and load Project1’s rc file. While opening resource file, select “Open As” as “Resources”.

3) Now drag your required dialog from project1’s resource tree and drop it to your resource tree.

4) You’ve successfully copied dialog from one project to another!

For Visual Studio 2005 and siblings
1) Open your IDE without any solutions loaded.
2) open both RC files into the IDE.
3) Now take Project2 RC file, right click on the dialog you want to export and copy it.

importdialog1

4) Now take Project1 RC file, right click and paste.

importdialog2

5) You see, now the dialog is imported from project1 to Project2.

importdialog3

Well, special thanks to Mike and Alan for their contribution for the trick in Visual Studio 2005.


You could also edit the rc file in some text editor and can copy paste the dialog if you’re a geek.
Original link

No comments: