CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 1999
    Posts
    33

    How do I copy a dialog to a new workspace/project

    How do I copy a dialog box with numerous controls from one project to another. This seems to be a serious flaw in VC. I want to treat that dialog as a class, but the .rc, resource.h, etc. seems cumbersome.


  2. #2
    Join Date
    Apr 2001
    Posts
    63

    Re: How do I copy a dialog to a new workspace/project

    This is how I usually do it:
    1. Copy YourDlg.cpp & YourDlg.h to your new project directory.
    2. Open your new project workspace then add YourDlg.cpp & YourDlg.h to your project.
    3. Click on the Resource View tab, then expand Dialog
    4. Choose File->Open and open your old .rc file as resource
    5. With right button, drag your old dialog to the left pan and drop it on dialog, you would see a pop up window, choose copy
    6. Still on the left pan, choose File->Save so that your old dialog's controls' ID will be saved in your new resource.h
    7. Finally, manually open your new resource.h and re-organize your controls ID. Make sure there is no dupplicate values, and make sure to update the section below // Next default values for new objects

    good luck.

    I'm still looking for a better way to do this.


  3. #3
    Join Date
    Aug 2001
    Posts
    19

    Re: How do I copy a dialog to a new workspace/project

    Another way to do this is:

    Start Visual Studio (C/C++)
    Open up Project #1 (Workspace#1)
    Go to the resources tab and open the Dialog folder

    Start a second Visual Studio Process
    Open up Project #2.
    Go to the resources tab and open the Dialog folder.

    Make sure you can see both resource windows for each VS Process

    Drag 'n' Drop your Dialog(s) from Project #1 to Project #2

    Scott.

  4. #4
    Join Date
    Jul 2001
    Location
    Delhi-India
    Posts
    112

    Developer studio gives you all

    Hi buddy,
    even i encounterd the same problem, here is the solution for this.
    Assuming you Project name is Project1 and Project2

    Open Project1
    #1 In the Workspace window select the Class view tab.
    #2 Select your Dialog class(which you want to transfer)Lets sat CMyDialog
    #3 Right click and choose Add to Gallery option.

    Now open Project2.
    #1 Choose Menu :- 'Project-Add to project - Components and Controls'
    a dialog would open up
    #2 Search for the Project1 folder (in your case it would be your project name)
    #3 open this folder you will find a file named MyDialog.ogx
    #4 Just select it and press insert button.

    Thats IT ...

    See basically you have a created an ogx file. Internally this file contains
    the class code as well as the dialog resource information.
    Now you can insert this ogx file in any project.
    This is not just applicable to Dialog based class, you can use it for any class.

    Any further clarifications are most welcome. Wish you all the best.

    Regards,
    Abhishek


    Abhishek Narula
    (Member Technical Staff)
    Syndew.Com Pvt. Ltd.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured