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. communication from library to application

communication from library to application

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionlearning
9 Posts 4 Posters 27 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.
  • U Offline
    U Offline
    utcode
    wrote on last edited by
    #1

    Hi, as learning process, i need some code (or simple sample project) that shows how to post?send message from a library (dll) to application (dialog or console). If a thread in dll sends message to app, how is the best to approach that?. Using GetMessage?.

    J L 2 Replies Last reply
    0
    • U utcode

      Hi, as learning process, i need some code (or simple sample project) that shows how to post?send message from a library (dll) to application (dialog or console). If a thread in dll sends message to app, how is the best to approach that?. Using GetMessage?.

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      Keep in mind of course that a library doesn't do anything. Applications do stuff and use libraries. So you want two applications. You can start with researching (google) examples of Rest (http.)

      U 1 Reply Last reply
      0
      • J jschell

        Keep in mind of course that a library doesn't do anything. Applications do stuff and use libraries. So you want two applications. You can start with researching (google) examples of Rest (http.)

        U Offline
        U Offline
        utcode
        wrote on last edited by
        #3

        Yes. I am trying to experiment another feature that may become handy.

        1 Reply Last reply
        0
        • U utcode

          Hi, as learning process, i need some code (or simple sample project) that shows how to post?send message from a library (dll) to application (dialog or console). If a thread in dll sends message to app, how is the best to approach that?. Using GetMessage?.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You can use SendMessage function (winuser.h) - Win32 apps | Microsoft Learn[^], but you need some driver that calls the library method with the HWND of the receiving aplication.

          U 1 Reply Last reply
          0
          • L Lost User

            You can use SendMessage function (winuser.h) - Win32 apps | Microsoft Learn[^], but you need some driver that calls the library method with the HWND of the receiving aplication.

            U Offline
            U Offline
            utcode
            wrote on last edited by
            #5

            same message id is created in dll and in application?. in application there is a routine that polls the messages. correct?.:~

            L 1 Reply Last reply
            0
            • U utcode

              same message id is created in dll and in application?. in application there is a routine that polls the messages. correct?.:~

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Yes, you can create a message inside a DLL and send it to an application. But that still needs a controlling application to drive the DLL; so why would you do it that way? .A Windows (as opposed to a Console) application, must contain a message pump which pulls messages from its queue and processes them.

              U 1 Reply Last reply
              0
              • L Lost User

                Yes, you can create a message inside a DLL and send it to an application. But that still needs a controlling application to drive the DLL; so why would you do it that way? .A Windows (as opposed to a Console) application, must contain a message pump which pulls messages from its queue and processes them.

                U Offline
                U Offline
                utcode
                wrote on last edited by
                #7

                in case DLL need to inform application of something changed. callback is better for this case?.:~

                D L 2 Replies Last reply
                0
                • U utcode

                  in case DLL need to inform application of something changed. callback is better for this case?.:~

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  An unequivocal YES! Sending window messages is about the least flexible thing you can use because it's limited to being used only with Windows applications that have a message pump. That keeps you from using it in Console apps, Service apps, and all web applications.

                  Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

                  1 Reply Last reply
                  0
                  • U utcode

                    in case DLL need to inform application of something changed. callback is better for this case?.:~

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    wizQ wrote:

                    in case DLL need to inform application of something changed.

                    I think you misunderstand the role of a support library. A library (whether .lib or .dll) is a set of passive functions that are only activated when called from an application (Console or Windows). So it is unlikely that they would be able to "know" when anything happened that needed to be communicated to other applications.

                    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