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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Message Handling for a dialog in a dll

Message Handling for a dialog in a dll

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestionlearning
4 Posts 3 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.
  • L Offline
    L Offline
    leonwoo
    wrote on last edited by
    #1

    Hi, I have a really tough problem relating to MFC and DLL. I have developed a MFC Dll that displays a dialog when it is called by a MFC MDI application. What I did was that first I dynamically created a button on the SDI toolbar by passing the toolbar pointer to the Dll. Then I clicked on the button and a modeless dialog poped up. The modeless dialog contains a 'CMonthCalCtrl' calendar control, an 'insert' button, and a 'cancel' button. When I clicked on the 'insert' button, the Dll should insert the selected date into an already opened MDI edit view. However, I have no idea how to bridge the gap between the MDI view and the Dll (i.e. I do not know how to pass back the date to the view). I have tried to search for related resource on the net but gained no clue and I need the solution desperately. You have any neat solution?? Thanks in advance.:-O leonwoo

    V 1 Reply Last reply
    0
    • L leonwoo

      Hi, I have a really tough problem relating to MFC and DLL. I have developed a MFC Dll that displays a dialog when it is called by a MFC MDI application. What I did was that first I dynamically created a button on the SDI toolbar by passing the toolbar pointer to the Dll. Then I clicked on the button and a modeless dialog poped up. The modeless dialog contains a 'CMonthCalCtrl' calendar control, an 'insert' button, and a 'cancel' button. When I clicked on the 'insert' button, the Dll should insert the selected date into an already opened MDI edit view. However, I have no idea how to bridge the gap between the MDI view and the Dll (i.e. I do not know how to pass back the date to the view). I have tried to search for related resource on the net but gained no clue and I need the solution desperately. You have any neat solution?? Thanks in advance.:-O leonwoo

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      Pass in whatever function you call from the DLL a reference to a variable. In the DLL, assign whatever you want to that variable, which in this case is a date. Kuphryn

      L 1 Reply Last reply
      0
      • V valikac

        Pass in whatever function you call from the DLL a reference to a variable. In the DLL, assign whatever you want to that variable, which in this case is a date. Kuphryn

        L Offline
        L Offline
        leonwoo
        wrote on last edited by
        #3

        Thanks for the prompt reply. Another question is how do I detect button click from the dialog? I need to insert the date into the view whenever i click on the 'insert' button. The MDI application somehow has to detect the button click and then return the reference variable. thanks. leonwoo

        S 1 Reply Last reply
        0
        • L leonwoo

          Thanks for the prompt reply. Another question is how do I detect button click from the dialog? I need to insert the date into the view whenever i click on the 'insert' button. The MDI application somehow has to detect the button click and then return the reference variable. thanks. leonwoo

          S Offline
          S Offline
          Steen Krogsgaard
          wrote on last edited by
          #4

          I would pass the handle of the view to the dialog and then send a private message to the view from the dialog. In the LPARAM I would pass the relevant information. If your data does not fit into the four bytes I would use an automatic structure to hold the data and call SendMessage. Do not allocate the struct with new in the dll and delete it with delete in the main app, that will corrupt the heaps. Cheers Steen. "To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"

          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