Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC Extension DLL Problems

MFC Extension DLL Problems

Scheduled Pinned Locked Moved C / C++ / MFC
c++comhelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tony Fontenot
    wrote on last edited by
    #1

    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 ***********************

    N 1 Reply Last reply
    0
    • T Tony Fontenot

      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 ***********************

      N Offline
      N Offline
      Niklas L
      wrote on last edited by
      #2

      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 #ifndefs to protect the header?

      T 1 Reply Last reply
      0
      • N Niklas L

        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 #ifndefs to protect the header?

        T Offline
        T Offline
        Tony Fontenot
        wrote on last edited by
        #3

        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 ***********************

        N 1 Reply Last reply
        0
        • T Tony Fontenot

          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 ***********************

          N Offline
          N Offline
          Niklas L
          wrote on last edited by
          #4

          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, change

          CCalendarDlg::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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups