发送窗口消息,Windows服务窗口、消息、Windows

由网友(粉色小姐姐)分享简介:有送(模仿),就像'WM_ENDSESSION一个窗口消息窗口服务的任何工具?Is there any tool to send (mimic) a windows message like 'WM_ENDSESSION' to a windows service?或我如何发送一个窗口消息处理使用C#?How...

有送(模仿),就像'WM_ENDSESSION一个窗口消息窗口服务的任何工具?

Is there any tool to send (mimic) a windows message like 'WM_ENDSESSION' to a windows service?

我如何发送一个窗口消息处理使用C#?

How can I send a windows message to a process using C#?

(我只知道C#)

编辑:目的:基本上我有固定的只发生在系统关机的错误调试Windows服务

Purpose: Basically I have to debug a windows service for fixing a bug that occurs only on system shut down.

推荐答案

一般情况下,服务没有窗户(更不用说消息泵)来接收Windows消息。

Generally, services don't have windows (let alone message pumps) to receive a windows message.

如果错误确实仅发生在关断(而不是仅仅停止服务),这可能是因为一些取决于这是不被适当地处理的资源,是要离开的情况下(在这种情况下,该bug修复的可能的是正确设置服务相关性)。您是否尝试过使用远程调试工具附加到过程之前关机?

If the bug really does only happen on shutdown (as opposed to just stopping the service), it may be the case that something depends on a resource that is going away, which is not being handled gracefully (in which case, the bug fix might be to set up the service dependencies correctly). Have you tried using the remote debugging tools to attach to the process prior to shutdown?

这是值得研究,如果你能得到出现问题,而无需关闭,也许在刚停止与服务控制管理器服务(不需要编程方式做到这一点,因为这是一个调试的情况),在这种情况下,你可以在您的服务断点的onStop()(我假设C#),并看看会发生什么。

It's worth investigating if you can get the problem to occur without shutting down, perhaps when just stopping the service with the Service Control Manager (no need to do this programmatically, as this is a debugging scenario), in which case, you can breakpoint OnStop() in your service (I'm assuming C#) and watch what happens.

阅读全文

相关推荐

最新文章