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

9 09 2008


Designing dialogs – that could grab a good amount of time! But often we can find dialogs that can be reused from our previous projects. But the copy paste trick – the Ctrl+C & Ctrl+V won’t work on dialog resources. So how to copy/paste dialogs or any other resources from one project to another?

importdialog


Assume you have two projectsProject1 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. 😉


Targeted Audience – Beginners.

Advertisements