如何用C写一个停止关机进程的程序?

How to write a program that stops the shutdown process by C?

记事本等程序可以在文件未保存时停止计算机关机过程。如何编写停止关机过程的程序(在 C 中)?

对于 Windows Vista 及更高版本,在 User32.dll (User32.lib) 中定义了一个名为 "ShutdownBlockReasonCreate" 的函数。
它有两个参数:
- window
的句柄 - 表示要显示的消息的字符串
如果调用成功,您的应用程序将阻止 windows 关闭。

这是一个强大的功能,不应该被滥用!