c# - 向 Windows 服务发送 Windows 消息

标签 c# .net winapi windows-services shutdown

是否有任何工具可以将“WM_ENDSESSION”之类的 Windows 消息发送(模仿)到 Windows 服务?

如何使用 C# 向进程发送 Windows 消息?

(我只会C#)

编辑:目的:基本上我必须调试一个 Windows 服务来修复仅在系统关闭时发生的错误。

最佳答案

应使用 ServiceController class 控制服务

Represents a Windows service and allows you to connect to a running or stopped service, manipulate it, or get information about it.

您可以使用它来启动、停止使用此类的服务并与之通信。

关于c# - 向 Windows 服务发送 Windows 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1233195/

相关文章:

c++ - 改变击键速度 C++

c# - 可变 F# 记录的二进制序列化

c# - SQL 从两个表中选择数据(一行 -> 多行)

c# - Petapoco:操作可能会破坏运行时的稳定性

c# - 在 View 模型中检索 IDataErrorInfo 字符串结果

.net - CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern 在 .Net 3.5 中被破坏了吗?

c# - string.format() 不显示值

.net - 单声道多声道播放器

c# - 在 Windows Vista, 7, 2008 中正常关闭控制台应用程序

c - 如何正确释放GDI资源?