将Windows事件日志改装到Delphi 5应用程序 [英] Retrofitting Windows Event Log to a Delphi 5 app

查看:126
本文介绍了将Windows事件日志改装到Delphi 5应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找(相当无痛苦)的方法,将一些Windows应用程序事件日志支持添加到一个小型的旧版Delphi 5应用程序中。我们只是想让它在启动时关闭,关闭,无法连接到数据库等。

I'm looking for a (fairly pain-free) means of adding some Windows Application Event-Log support to a small legacy Delphi 5 application. We just want it to log when it starts-up, shuts-down, fails to connect to a database etc.

我看到的几个解决方案/组件似乎建议在尝试阅读我们的条目时,我们需要制作一个资源DLL,Windows事件日志查看器将链接到该资源DLL。虽然这似乎并不太繁重,但我想如果/当我们将来进一步开发应用程序时,请记住,我们需要保持此DLL的最新状态。

Several of the solutions/components I've seen seem to suggest that we'll need to make a resource DLL which the Windows Event Log Viewer will link to when trying to read our 'entries'. While this doesn't seem too onerous, I guess it's something else to keep in mind if/when we further develop the application in future - we'll need to keep this DLL up to date.

在将来的某个时候,我们将要将应用程序转换为可能在D2007中编写的服务。

At some point in the future we will want to turn the application into a service, probably written in D2007.

所以有人可以推荐一个合适的路线来添加事件到D5的事件日志?我正在寻找具体的我使用这个,这是可以的,而不是一个谷歌的拖网(我可以做我自己!)免费或付费,真的不介意 - 但有些东西我可以在将来迁移到D2007很重要。

So can anyone recommend a suitable route for adding events to the event log in D5? I'm looking for specific 'we used this and it was okay' comments rather than a Google trawl (which I can do myself!) Free or paid-for, really don't mind - but something that I could migrate to D2007 in the future is important.

推荐答案

感谢 J 和Peter的回应我立即将代码写入事件日志。还有一点要做,特别是如果您希望事件在事件日志中显示不错,而没有标准的Windows消息无法找到描述(根据 J的底部的帖子)。

Thanks to J and Peter's responses, I got my code writing into the event log straight away. There is a little bit more to do, particularly if you want your events to appear 'nicely' in the event log without a standard windows message about not being able to find the description (as per the bottom of J's post).

我遵循提示这里来制作一个合适的DLL并将其输入到注册表中,并且非常快速地将其全部整理出来。

I followed the tips here to making a suitable DLL and entering it into the registry, and very quickly had it all sorted out.

根据问题,这一切都在Delphi5中,但我没有看到任何让我觉得在D2007中不起作用的东西。

This was all in Delphi5, as per the question, but I've seen nothing that makes me think it wouldn't also work in D2007.

这篇关于将Windows事件日志改装到Delphi 5应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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