如何阻止Delphi DataSnap错误消息对话框? [英] How can I supress Delphi DataSnap error message dialogs?

查看:322
本文介绍了如何阻止Delphi DataSnap错误消息对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Windows 2003 Server上运行DataSnap Delphi 2009应用程序。 DataSnap客户端和服务器位于同一台计算机上,通过Borland Socketserver使用DCOM。客户端运行后台批处理作业。



有时,我们发现客户端无法连接到服务器应用程序,并在服务器桌面上显示一条消息对话框,无法连接到服务器,无法找到网络路径。或Objectexporter not found。



我们的Delphi客户端代码从不使用消息对话框来显示错误或异常,而是使用try ... except .. finally ..结束和记录来处理连接错误,所以我猜对话是由DataSnap方法创建的。有没有办法抑制这个模式对话框?



更新:所有异常都在较低级别的例程中处理,主循环负责断开连接并重新连接异常提高(处理或未处理):

  while True do 
begin
Connect;
while True do
begin
try
DoMyWork;

休息;
结束
结束
断开;
结束


解决方案

解决方案1)
可能是一个全局钩子通过application.onexception可以处理问题



http://www.chami.com/tips/delphi/011497D.html



解决方案2)



使用EurekaLog或MadExcept来查找应用程序从哪里引发错误,并处理错误。



解决方案3)



应用程序消息对话框中的全局钩子,钩子示例在下面



http://delphi.about.com/gi/o.htm?zi=1/XJ&zTi=1&sdn=delphi&cdn=compute&tm=43& ; f = 22& su = p284.9.336.ip_p504.1.336.ip_& tt = 2& bt = 1& bts = 1& zu = http%3A // www.delphicorner.f9.co.uk / articles / apps7。 htm



您查询所有应用程序的消息,当您捕获该窗口时,您处理消息而不是应用程序。因为我现在没有时间不知道messagedlg提出的wmessage是什么。



希望有所帮助。



最好的问候,


We run a DataSnap Delphi 2009 application on Windows 2003 Server. DataSnap Client and Server are on the same computer, using DCOM over Borland Socketserver. The client runs a background batch job.

Sometimes, we discover that the client can not connect to the server application and displays a message dialog on the server desktop indicating for example "Could not connect to server. Network path could not be found." or "Objectexporter not found."

Our Delphi client code never uses a message dialog to show errors or exceptions, instead we use try ... except .. finally ... end and logging to handle connect errors, so I guess the dialog is created by a DataSnap method. Is there a way to suppress this modal dialog box?

Update: all exceptions are handled in lower level routines, the main loop takes care of disconnecting and reconnecting when an exception is raised (handled or unhandled):

  while True do
  begin
    Connect;
    while True do
    begin
      try
        DoMyWork;
      except
        Break;
      end;
    end;
    Disconnect;
  end;

解决方案

solution 1) maybe an global hook over the application.onexception can handle the problem

http://www.chami.com/tips/delphi/011497D.html

solution 2)

use EurekaLog or MadExcept in order to find out from where the application raise that error, and handle the error.

solution 3)

a global hook over the application message dialogs, a hook example is bellow

http://delphi.about.com/gi/o.htm?zi=1/XJ&zTi=1&sdn=delphi&cdn=compute&tm=43&f=22&su=p284.9.336.ip_p504.1.336.ip_&tt=2&bt=1&bts=1&zu=http%3A//www.delphicorner.f9.co.uk/articles/apps7.htm

you query all the application's messages, and when you catch that window then you process the message not the application. because i don't have now the time I don't know exactly which is the wmessage raised by messagedlg.

hope that helped.

best regards,

这篇关于如何阻止Delphi DataSnap错误消息对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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