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. CWinApp <-> DLL communication

CWinApp <-> DLL communication

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++tutorial
5 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.
  • H Offline
    H Offline
    hxhl95
    wrote on last edited by
    #1

    Hi there everyone, So I have my DLL that needs to communicate with my app. What I want to do is have the dll send my CWinApp derived class a message, and then the CWinApp should call DoModal with the dialog. Problem is, I've never messed with the app part of mfc, only the dialog class, so I have no clue how to set up the handler for the message. As well, since there is no hWnd yet, I need to use PostThreadMessage instead of the normal SendMessage, but in my DLL I need to get the return value and then continue processing (like there would be with SendMessage/DefWindowProc). Any help on how to do so would be nice. ^^ :)

    T 1 Reply Last reply
    0
    • H hxhl95

      Hi there everyone, So I have my DLL that needs to communicate with my app. What I want to do is have the dll send my CWinApp derived class a message, and then the CWinApp should call DoModal with the dialog. Problem is, I've never messed with the app part of mfc, only the dialog class, so I have no clue how to set up the handler for the message. As well, since there is no hWnd yet, I need to use PostThreadMessage instead of the normal SendMessage, but in my DLL I need to get the return value and then continue processing (like there would be with SendMessage/DefWindowProc). Any help on how to do so would be nice. ^^ :)

      T Offline
      T Offline
      Tim Craig
      wrote on last edited by
      #2

      Sounds like you might have the tail wagging the dog. How is your DLL getting control and "running" to be able to control the application?

      You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.

      H 1 Reply Last reply
      0
      • T Tim Craig

        Sounds like you might have the tail wagging the dog. How is your DLL getting control and "running" to be able to control the application?

        You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.

        H Offline
        H Offline
        hxhl95
        wrote on last edited by
        #3

        I'm using LoadLibrary/GetProcAddress in the InitInstance of my class.

        T 1 Reply Last reply
        0
        • H hxhl95

          I'm using LoadLibrary/GetProcAddress in the InitInstance of my class.

          T Offline
          T Offline
          Tim Craig
          wrote on last edited by
          #4

          And when you get the address of the proc in the DLL, I assume you call it? Are you trying to do some kind of plug and play system where you can have a different window depending on which DLL you load? Why not just have a call into the DLL to create the dialog and then return?

          You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.

          H 1 Reply Last reply
          0
          • T Tim Craig

            And when you get the address of the proc in the DLL, I assume you call it? Are you trying to do some kind of plug and play system where you can have a different window depending on which DLL you load? Why not just have a call into the DLL to create the dialog and then return?

            You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.

            H Offline
            H Offline
            hxhl95
            wrote on last edited by
            #5

            Oh, I should've said this in my first post - I'm injecting this dll into selected processes, so the event that has to trigger a dialog box in my app could or could not happen and I don't know when it will happen. Hope that helps? :)

            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