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. mfc dll <-> app communication

mfc dll <-> app communication

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
7 Posts 4 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.
  • E Offline
    E Offline
    eXplodus
    wrote on last edited by
    #1

    little question. is there a chance to get a pointer back to the application. and to use the functions of the application? or to get data from the application. or is the only way to send messages? how could i communication between the dll and the application. i could call a dll function. but how is it if a export a view and wanna call a function from the mainframe or from the document class? any ideas?

    V N B 3 Replies Last reply
    0
    • E eXplodus

      little question. is there a chance to get a pointer back to the application. and to use the functions of the application? or to get data from the application. or is the only way to send messages? how could i communication between the dll and the application. i could call a dll function. but how is it if a export a view and wanna call a function from the mainframe or from the document class? any ideas?

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

      The DLL has a message queue. Handle the incoming message. Kuphryn

      1 Reply Last reply
      0
      • E eXplodus

        little question. is there a chance to get a pointer back to the application. and to use the functions of the application? or to get data from the application. or is the only way to send messages? how could i communication between the dll and the application. i could call a dll function. but how is it if a export a view and wanna call a function from the mainframe or from the document class? any ideas?

        N Offline
        N Offline
        Neville Franks
        wrote on last edited by
        #3

        Well you can pass a pointer from the app to the DLL and then it can use that. If the functions are in your CMainFrame class et.all. then you can use MFC functions in your DLL to get a ptr to these. Another alternative is "Calling an Exported Function in an EXE from Within a DLL" http://codeguru.earthweb.com/dll/ExportingFromExe.html[^] Neville Franks, Author of ED for Windows. www.getsoft.com Make money with our new Affilate program

        1 Reply Last reply
        0
        • E eXplodus

          little question. is there a chance to get a pointer back to the application. and to use the functions of the application? or to get data from the application. or is the only way to send messages? how could i communication between the dll and the application. i could call a dll function. but how is it if a export a view and wanna call a function from the mainframe or from the document class? any ideas?

          B Offline
          B Offline
          Bartosz Bien
          wrote on last edited by
          #4

          As you import functions from DLL to your application, and not the other direction, application-defined classes should not be called by the DLL. Use MFC extension DLL to export a view class for your app's framework. Regards, BB

          E 1 Reply Last reply
          0
          • B Bartosz Bien

            As you import functions from DLL to your application, and not the other direction, application-defined classes should not be called by the DLL. Use MFC extension DLL to export a view class for your app's framework. Regards, BB

            E Offline
            E Offline
            eXplodus
            wrote on last edited by
            #5

            thats ok, and how did i got a pointer back to my app? and (myApp*) AfxGetApp() ??

            B 1 Reply Last reply
            0
            • E eXplodus

              thats ok, and how did i got a pointer back to my app? and (myApp*) AfxGetApp() ??

              B Offline
              B Offline
              Bartosz Bien
              wrote on last edited by
              #6

              1. Thou shalt not include CMyApp definition in a DLL. 2. You may use AfxGetApp() to send messages to your app, but I personally don't like such solutions - this is not what DLLs are for. X| Regards, BB

              E 1 Reply Last reply
              0
              • B Bartosz Bien

                1. Thou shalt not include CMyApp definition in a DLL. 2. You may use AfxGetApp() to send messages to your app, but I personally don't like such solutions - this is not what DLLs are for. X| Regards, BB

                E Offline
                E Offline
                eXplodus
                wrote on last edited by
                #7

                i know it. but i need to get pointers back to my app. and messages are a bad way. but the only way that i know

                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