Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fire events in a Delphi application from another Delphi application?

Please read before tagging as duplicate.

I'm creating a set of applications which rely on smart cards for authentication. Up to now, each application has controlled the smart card reader individually. In a few weeks, some of my customers will be using more than one application at the same time. So, I thought maybe it would be more practical to create a service application which controls the authentication process. I'd like my desktop applications to tell the service application they are interested in the authentication process, and the service application would then provide them with information about current user. This part is easy, using named pipes. The hard part is, how can the service tell the desktop applications that an event has occurred (UserLogIn, UserLogOut, PermissionsChanged, ... to name a few). So far I have two methods in mind. CallBack functions, and Messages. Does anyone have a better idea? I'm sure someone has.

like image 201
iMan Biglari Avatar asked Dec 08 '22 21:12

iMan Biglari


1 Answers

You want do to IPC (Inter Process Communication) with Delphi.

There are many links that can help you, Cromis IPC is just one to give you an idea what you are after.

A similar SO question to yours is here.

If you want to go pure Windows API, then take a look at how OutputDebugString communications is implemented.
Several tools can listen to the mechanism and many apps can send information to it.

Search for DBWIN_DATA_READY and DbWin32 for more information on how the protocol for OutputDebugString works.

This and this are good reading.

like image 105
Jeroen Wiert Pluimers Avatar answered Dec 12 '22 04:12

Jeroen Wiert Pluimers