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. show dialog in dll

show dialog in dll

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
6 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.
  • G Offline
    G Offline
    gucy
    wrote on last edited by
    #1

    i want to show a dialog in regular dll which is dynamicaly linked to mfc. the exported func is : //dynamicly extern "C" __declspec( dllexport ) void Trade1() { AFX_MANAGE_STATE(AfxGetStaticModuleState()) CDlgLogon dlg; dlg.DoModal (); } which does not work. if i set the dll staticly linked to mfc .it works well //staticly extern "C" __declspec( dllexport ) void Trade1() { CDlgLogon dlg; dlg.DoModal (); } is that means i can't use mfc in static library? gucy

    R 1 Reply Last reply
    0
    • G gucy

      i want to show a dialog in regular dll which is dynamicaly linked to mfc. the exported func is : //dynamicly extern "C" __declspec( dllexport ) void Trade1() { AFX_MANAGE_STATE(AfxGetStaticModuleState()) CDlgLogon dlg; dlg.DoModal (); } which does not work. if i set the dll staticly linked to mfc .it works well //staticly extern "C" __declspec( dllexport ) void Trade1() { CDlgLogon dlg; dlg.DoModal (); } is that means i can't use mfc in static library? gucy

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      Where is your dialog template? In the DLL or in the application. The second one (which you said works) would load it from the application, but the first one (which you said doesn't work) would try to load it from the DLL, and should work if the dialog template was in the DLL. If you want the first one to work, the dialog template must be in the DLL, not in the application. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
      Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

      G 1 Reply Last reply
      0
      • R Ryan Binns

        Where is your dialog template? In the DLL or in the application. The second one (which you said works) would load it from the application, but the first one (which you said doesn't work) would try to load it from the DLL, and should work if the dialog template was in the DLL. If you want the first one to work, the dialog template must be in the DLL, not in the application. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
        Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

        G Offline
        G Offline
        gucy
        wrote on last edited by
        #3

        hi, The dialog template is in dll in both of the two funcion. gucy

        R 1 Reply Last reply
        0
        • G gucy

          hi, The dialog template is in dll in both of the two funcion. gucy

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          If you use AFX_MANAGE_STATE() in the bottom one, does it still work? Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
          Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

          G 1 Reply Last reply
          0
          • R Ryan Binns

            If you use AFX_MANAGE_STATE() in the bottom one, does it still work? Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
            Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

            G Offline
            G Offline
            gucy
            wrote on last edited by
            #5

            yes,if i add the macro to the second one,it still work.it does not depent on the macro. gucy

            R 1 Reply Last reply
            0
            • G gucy

              yes,if i add the macro to the second one,it still work.it does not depent on the macro. gucy

              R Offline
              R Offline
              Ryan Binns
              wrote on last edited by
              #6

              Hmmm. I can't help much more - I'm not an expert on DLLs. Have a look at MFC technical note TN058 which explains module state switching in detail. As far as I can see, the first one should work :~ . Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
              Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

              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