#1
  1. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,154
    Rep Power
    2222

    VC++ IDE Q: How to Reuse a Dialog in Different Projects?


    This seems like it should be a basic question, but I've never found the answer to it.

    I'm using VC++6 (my own), and sometimes VC++5 (the standard at work). In one project, I create a dialog box and the associated CDialog class. Now I want to use that exact same dialog box resource and code in another project. How do I do that?

    What I've always had to do was to hand-craft the transfer. I would copy the resource over from the one project to the second, then hand-edit the resource IDs and update all the necessary definitions. Then (the easy part), I would copy and .cpp source and header files over and add them to the project.

    Don't get me wrong. I am very thankful that I have access to the code for tweaking (unlike in VB), but still it seems that the IDE should have a built-in solution for what must be a very common need.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2002
    Location
    Seattle WA
    Posts
    863
    Rep Power
    14
    I've never found an easy way of doing it. The resource IDs are pretty straight forward, along with the source code. But for the actual dialog template, I've always had to resort to shutting down vc and coyping and pasting from the project rc script files.
  4. #3
  5. No Profile Picture
    Offensive Member
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2002
    Location
    in the perfect world
    Posts
    622
    Rep Power
    27
    Open the old projects script.rc in the new project (with the open file menu item) so you have two scripts.

    Now you should be able to browse thru the old script in the right hand pane of the complier. Click on the resource you want and [CRTL]+C (copy).

    Paste into the new projects script.rc [CTRL]+V.

    Sometimes it will loose a resource ID or two. Just give them a quick check and hit 'rebuild all'.
    The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

    Frank Zappa

IMN logo majestic logo threadwatch logo seochat tools logo