![](https://user-images.githubusercontent.com/114529951/235689689-83df5fca-c18a-4ba3-8ca7-f27338996611.png)
![](https://user-images.githubusercontent.com/114529951/228858954-a7e18880-3021-4b75-9b14-b294a9cd2f3b.png)
![](https://user-images.githubusercontent.com/114529951/236123359-a31d107c-d621-422a-88ed-8ce94518ff8c.png)
还有大佬会 C++不。编写一个 Node addon ,用于在 Windows 平台上设置关机阻塞。
ShutdownBlockReasonCreate ,用于创建关机阻塞原因。
ShutdownBlockReasonDestroy ,用于销毁关机阻塞原因。
SetWindowLongPtr ,用于设置窗口的扩展风格,从而使其无法被关闭。
SetProcessShutdownParameters ,用于设置进程的关机参数,从而使其无法被关闭。
insertWndProcHook ,用于关机前 WindowProcCb 触发 JS 事件
我创建了这些钩子。重启或者关机的时候执行销毁任务。可是时成时不能。特别是 win11 。有没有什么库可以参考。