2011年6月9日 星期四

Copy dialog in Visual Studio 2010 (C++)

If you want to copy a dialog from one project to another. You cannot just copy/paste in resource view of VS. The following steps will teach you how to copy dialog from project P1 to another project P2 by manual.

1. Use a text editor (e.g., Ultra Editor) to open P1.rc and P2.rc.

2. Find and copy the dialog code that you want to copy in P1.rc.

3. Paste the code to P2.rc.

4. Copy the dialog class files (e.g., xxx.h and xxx.cpp) from P1 to P2.

5. Modify the dialog class files (xxx.cpp, xxx.h), especially #include directive (P1 ->P2)

6. Open resource.h of P1 and resource.h of P2.

7. Copy the corresponding ID from the resource.h of P1 to resource.h of P2. Remember to modify the ID number using the sequence number of P2. In this step, you can try to build the P2 in VS. VS will output error messages to indicate which IDs are undeclared. Also remember to modify the next default values (_APS_NEXT_XXX_VALUE).

8. In step 7, if the ID symbol is duplicate, you should modify the ID symbol in the resource.h and rc file.

沒有留言:

張貼留言