Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 551
  • Last Modified:

How to copy dialogs from one project to another in Visual Studio

Hi,

I am relatively new to VC++. I am not even sure if the question is right under this channel. Pl help me out.

I have a project where there are some dialogs with some BMPs and Icons. I need to move those dialogs to another project , so that i need not redo the entire GUI again. How to go about that? I also have corresponding C++ files for those dialogs. So i need to import the entire thing to different project.

pl help me out.

Thanks
Ram
0
rampriya_sb
Asked:
rampriya_sb
  • 3
  • 3
1 Solution
 
AlexFMCommented:
There is no problem to move dialog .cpp and .h files to another project. To move dialog resource, you need to see both source and destination resources in the same instance of Visual Studio.

1) Open destination project in Visual Studio
2) Open source .rc file using command "File - Open" (open automatically as resource)
3) Having destination resoures opened in Workspace pane and source resources opened as file, you can use copy-paste or drag-and-drop to move dialog template from one resource file to another.
0
 
Jaime OlivaresCommented:
You can move safely your dialog resource opening your .rc file as a text (even with a text editor), locate dialogs section, all is in text mode, like this:

IDD_MYDIALOG DIALOG DISCARDABLE  0, 0, 162, 140
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE |
    WS_CAPTION | WS_SYSMENU
CAPTION "My Dialog sample"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "OK",1,11,116,40,14
    PUSHBUTTON      "Cancel",2,61,116,40,14
    PUSHBUTTON      "Help",204,110,116,40,14
    LTEXT           "The List:",IDC_STATIC,11,8,34,8
    LISTBOX         110,11,23,138,83,LBS_SORT | LBS_NOINTEGRALHEIGHT |
                    WS_VSCROLL | WS_TABSTOP
END

copy the entire dialog's corresponding text and pasto into the new project .rc dialog. Does not matters if new project is in Visual C++ 4,5,6,.NET,or Embedded!
After that open you project in Visual Studio
0
 
AlexFMCommented:
1) The last post is wrong because it doesn't solve the problem of resource IDs in resource.h file
2) The goal of answering the abandonded question (more than month from answer date) is to get splitted points at cleanup.
0
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 
Jaime OlivaresCommented:
1) I am sure you have the answer for your first comment: You have to create an ID for IDD_MYDIALOG in your project.
I use this technique frequently because I have developed several multi-platform systems with Visual C++/embedded Visual C++.
2) If a question remains opened for a month, maybe your answer is not satisfactory.

 
0
 
AlexFMCommented:
There are some "fair play" agreements between experts. New experts sometimes break them, but in most cases they learn them after some time.
0
 
Jaime OlivaresCommented:
My answer is totally different from yours, so I think I am fair playing, but if that will make you happy, I don't want the points. I can gift all my points too if you want, only you have to talk with the editors and I will accept.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now