MFC Extension DLL Problems
-
I am creating my first MFC Extension DLL. Everything I have read so far said that it would be pretty easy but I have am having some problems. I want to put a dialog in a DLL so multiple apps can use it. I created the DLL using AppWizard and used ClassWizard to create the CDialog class. I added AFX_EXT_CLASS to export the class. The DLL compiles fine. Now I go over to the app and try to show the dialog. I enter the lib into the linker's input library list. I add the class' header file to the project, and I include the header in the file. I compile the app and I keep getting this error: error C2065: 'IDD_FACILITY_CALENDAR_DIALOG' : undeclared identifier IDD_FACILITY_CALENDAR_DIALOG being the dialog in the DLL I am also using an OCX in the dialog that exist in the app already, and I am getting a Class redefinition on the wrapper files for the OCX. Any ideas. Thanks in advance. *********************** Tony Fontenot Recreational Solutions tony@recsolutions.com ***********************
-
I am creating my first MFC Extension DLL. Everything I have read so far said that it would be pretty easy but I have am having some problems. I want to put a dialog in a DLL so multiple apps can use it. I created the DLL using AppWizard and used ClassWizard to create the CDialog class. I added AFX_EXT_CLASS to export the class. The DLL compiles fine. Now I go over to the app and try to show the dialog. I enter the lib into the linker's input library list. I add the class' header file to the project, and I include the header in the file. I compile the app and I keep getting this error: error C2065: 'IDD_FACILITY_CALENDAR_DIALOG' : undeclared identifier IDD_FACILITY_CALENDAR_DIALOG being the dialog in the DLL I am also using an OCX in the dialog that exist in the app already, and I am getting a Class redefinition on the wrapper files for the OCX. Any ideas. Thanks in advance. *********************** Tony Fontenot Recreational Solutions tony@recsolutions.com ***********************
Your IDD_FACILITY_CALENDAR_DIALOG is defined in your DLL projects Resource.h file. This file is by default not included in your dialogs header, hence the undeclared identifier error. Either include your Resource.h in the dialog header, or remove the enum containing IDD_FACILITY_CALENDAR_DIALOG (IDD) from the header file. It's only used in the constructor. Use IDD_FACILITY_CALENDAR_DIALOG directly in the dialog cpp instead. As for the OCX I don't know. Does your wrapper contain
#ifndef
s to protect the header? -
Your IDD_FACILITY_CALENDAR_DIALOG is defined in your DLL projects Resource.h file. This file is by default not included in your dialogs header, hence the undeclared identifier error. Either include your Resource.h in the dialog header, or remove the enum containing IDD_FACILITY_CALENDAR_DIALOG (IDD) from the header file. It's only used in the constructor. Use IDD_FACILITY_CALENDAR_DIALOG directly in the dialog cpp instead. As for the OCX I don't know. Does your wrapper contain
#ifndef
s to protect the header?I have included the resource.h into the dialog header. The DLL compiles fine. It is when I compile the app that i get the error. As for using the Dlg directly in the cpp, how do go about doing that? Also I figured out the OCX problem, I just had to add the include statment before another one in the file. :-D Thanks for yoyr help. *********************** Tony Fontenot Recreational Solutions tony@recsolutions.com ***********************
-
I have included the resource.h into the dialog header. The DLL compiles fine. It is when I compile the app that i get the error. As for using the Dlg directly in the cpp, how do go about doing that? Also I figured out the OCX problem, I just had to add the include statment before another one in the file. :-D Thanks for yoyr help. *********************** Tony Fontenot Recreational Solutions tony@recsolutions.com ***********************
In your header, you have something like:
enum { IDD = IDD_CALENDAR_DIALOG };
. This is where your problem is. Remove this line. In your cpp-file, changeCCalendarDlg::CCalendarDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCalendarDlg::IDD, pParent)to
CCalendarDlg::CCalendarDlg(CWnd* pParent /*=NULL*/)
: CDialog(IDD_CALENDAR_DIALOG, pParent)and your problems will be gone. Just note that you wont have the class wizards support if you decide to change the ID of your dialog from the resource editor. In this case you will have to change the identifier in the cpp yourself.