Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to copy DESIGNINFO, Dialog Info and AFX_DIALOG_LAYOUT related code from rc file if I try to move a dialog from one project to another?

Tags:

c++

mfc

I am working on a MFC VS2013 project, try to move some dialog from one project to another. My following steps is :

find this dialog resource ID(eg.IDD_DIALOG1)

search this ID in project name.rc file

copy related code to target project.rc file

copy related *.h and *.cpp files to target project

Now my question is, when I search the projectname.rc file. Actually I find several places in this file related to this ID. Do I need to move all these locations to new resource file? or I only need to move location1's code? What is the meaning for location2,3 and 4?

//Location1:
//
// Dialog
//

IDD_DIALOG1 DIALOGEX 0, 0, 239, 190
STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Settings"
FONT 9, "Tahoma", 0, 0, 0x0
BEGIN
    CONTROL         " Default to Use",IDC_CHECK_USE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,6,222,8
    GROUPBOX        "Test2",IDC_STATIC,6,18,228,48,NOT WS_VISIBLE
    LTEXT           "Test1:",IDC_STATIC,12,32,132,8
    EDITTEXT        IDC_GES_EDIT_PROC_INTERVAL,150,30,78,12,ES_AUTOHSCROLL | WS_GROUP
......
END

//Location2:
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
    IDD_DIALOG1, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 231
        TOPMARGIN, 7
        BOTTOMMARGIN, 186
    END
END
#endif    // APSTUDIO_INVOKED

//Location3:
//
// Dialog Info
//

IDD_DIALOG1 DLGINIT
BEGIN
    IDC_GDD_COMBO_ANGLE, 0x403, 5, 0
0x6f4e, 0x656e, "\000" 
...
    0
END

//Location4:
//
// AFX_DIALOG_LAYOUT
//

IDD_DIALOG1 AFX_DIALOG_LAYOUT 
BEGIN
    0x0000
END
like image 893
Penny Avatar asked Sep 19 '25 11:09

Penny


1 Answers

You need to copy all except the DESIGNINFO (in the meaning of: that all others are required, DESIGNINFO may be useful). This information are just the helping lines and margins defined for the resource. They are not compiled and not needed at run time. They are helpful in the design time.

The easiest approach to copy resources from one resource into another is to open both rc files in the same Visual Studio session. Than select the one dialog copy & paste into the second RC file. This will copy all you need including the needed IDs.

like image 60
xMRi Avatar answered Sep 22 '25 11:09

xMRi