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. Call MFC regular dll from other app

Call MFC regular dll from other app

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasedesigntutorialquestion
3 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.
  • J Offline
    J Offline
    john5632
    wrote on last edited by
    #1

    Hi, I am trying to call a MFC dialog based regular dll from other application. The dll function "BOOL CApplicationApp::InitInstance()" does not call to any dialog. I want to trigger UI on the click on button so i created a exported function which call first dilaog of application. But when I create a object of class it does load resource I think so crashed. Suggest me how to do?

    _ L 2 Replies Last reply
    0
    • J john5632

      Hi, I am trying to call a MFC dialog based regular dll from other application. The dll function "BOOL CApplicationApp::InitInstance()" does not call to any dialog. I want to trigger UI on the click on button so i created a exported function which call first dilaog of application. But when I create a object of class it does load resource I think so crashed. Suggest me how to do?

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      You could step into the exported function using a debugger to find what is going on. MFC DLLs require the first line of a function to be - AFX_MANAGE_STATE(AfxGetStaticModuleState()); If you haven't done that, you could try by putting that as the first line of the exported function.

      «_Superman_»  _I love work. It gives me something to do between weekends.

      _Microsoft MVP (Visual C++) (October 2009 - September 2013)

      Polymorphism in C

      1 Reply Last reply
      0
      • J john5632

        Hi, I am trying to call a MFC dialog based regular dll from other application. The dll function "BOOL CApplicationApp::InitInstance()" does not call to any dialog. I want to trigger UI on the click on button so i created a exported function which call first dilaog of application. But when I create a object of class it does load resource I think so crashed. Suggest me how to do?

        L Offline
        L Offline
        leon de boer
        wrote on last edited by
        #3

        The short answer is between very difficult and you can't do this because not all of MFC is thread safe. There are specific parts of MFC designed for threading general background http://msdn.microsoft.com/en-us/library/975t8ks0%28v=vs.90%29.aspx[^] The tips page will give you the specific problem http://msdn.microsoft.com/en-us/library/h14y172e%28v=vs.90%29.aspx#_core_accessing_mfc_objects_from_non_2d_mfc_threads[^] QUOTE:

        If you have a multithreaded application that creates a thread in a way other than using a CWinThread object, you cannot access other MFC objects from that thread. In other words, if you want to access any MFC object from a secondary thread, you must create that thread with one of the methods described in Multithreading: Creating User-Interface Threads or Multithreading: Creating Worker Threads. These methods are the only ones that allow the class library to initialize the internal variables necessary to handle multithreaded applications.

        In vino veritas

        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