communication from library to application
-
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?.
-
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?.
-
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.)
-
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?.
-
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.
-
same message id is created in dll and in application?. in application there is a routine that polls the messages. correct?.:~
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.
-
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.
-
in case DLL need to inform application of something changed. callback is better for this case?.:~
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
-
in case DLL need to inform application of something changed. callback is better for this case?.:~
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.