如何在Delphi应用程序中从另一个Delphi应用程序启动事件? [英] How to fire events in a Delphi application from another Delphi application?

查看:228
本文介绍了如何在Delphi应用程序中从另一个Delphi应用程序启动事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请在标签之前阅读

我正在创建一组依赖智能卡进行身份验证的应用程序。到目前为止,每个应用程序都分别控制了智能卡读卡器。在几个星期内,我的一些客户将同时使用多个应用程序。所以,我想也许创建一个控制身份验证过程的服务应用程序会更加实用。我希望我的桌面应用程序告诉他们对认证过程感兴趣的服务应用程序,然后服务应用程序将向他们提供有关当前用户的信息。这个部分很简单,使用命名管道。很难的是,服务如何告诉桌面应用程序发生了一个事件( UserLogIn UserLogOut PermissionsChanged ,...等等)。到目前为止,我有两种方法。 CallBack 函数和消息。有没有人有更好的主意?我确定有人有。

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.

推荐答案

你想用Delphi做IPC(Inter Process Communication)。

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

有很多链接可以帮助您, Cromis IPC 只是一个给你一个想法你以后。

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

与你的一个类似的SO问题是其中

A similar SO question to yours is here.

如果您想要使用纯Windows API,请查看如何使用OutputDebugString通讯实施

几个工具可以听到这个机制,许多应用程序可以发送信息。

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.

搜索 DBWIN_DATA_READY DbWin32 。 microsoft.com/en-us/library/windows/desktop/aa363362rel =nofollow noreferrer> OutputDebugString 可以使用。

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

这个这个很好阅读。

这篇关于如何在Delphi应用程序中从另一个Delphi应用程序启动事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆