我怎样才能prevent从显示MessageBox的第三方库? [英] How can I prevent a third party library from displaying a MessageBox?

查看:156
本文介绍了我怎样才能prevent从显示MessageBox的第三方库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我结合了第三方基于C语言的SDK到我的.NET应用程序。应用程序将作为服务器上的Windows服务运行,因此它不应该以任何方式的用户进行交互。

I am integrating a third party C-based SDK into my .NET application. The application will run as a Windows service on a server, so it should not interact with the user in any way.

不幸的是,在一定的误差条件下,它坚持称MessageBoxA,presumably报告,一些不好的事情发生了。当这种情况发生时,服务停止响应。我猜测,它在等待有人来preSS好吗?

Unfortunately, in certain error conditions it insists on calling MessageBoxA, presumably to report that something bad has happened. When this happens, the service stops responding. I am guessing that it is waiting for someone to press Ok?

这是不可能有厂商改变他们的code我。

It is not possible to have the vendor change their code for me.

有没有一种方法,我可以做这样的判断成为一个无操作,所以我的code能的情况自动处理?

Is there a way I can make this call into a no-op so my code can deal with the situation automatically?

编辑:这可能是重要的一提的是在我的特殊情况下,如果坠毁的服务会自动重新启动。从容(地)和突然的退出是可能是一种情况,一个消息将显示在我的情况下,最好的解决方案。

It may be important to mention that in my particular case the service would automatically restart if it crashed. A graceful (as possible) and sudden exit is probably the best resolution for a situation where a MessageBox is displayed in my case.

推荐答案

查看走弯路从微软研究院。它可以让你绕路任意Windows API函数。 C / C ++编程技能,使其工作虽然。你不会需要太多。

Check out Detours from Microsoft Research. It allows you to detour arbitrary Windows API functions. C/C++ programming is required to make it work though. You won't need much.

这篇关于我怎样才能prevent从显示MessageBox的第三方库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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