如何启动PowerShell winform应用中的closing()
事件,因为 Windows关闭已启动?
我尝试订阅系统sessionEnding
和sessionEnded
,但结束事件发生在 之前。
我在某处读到,当启动关闭/重启时,Windows会向所有应用程序发送WM_ENDSESSION
消息。如何查询on_closing
函数内部(使用PowerShell)?
答案 0 :(得分:0)
得到它:eventargs
- 事件的closing
实际上包含closeReason
,可以在事件被触发后查询。该值通常为UserClosing
,在问题WindowsShutDown
中也是如此。
链接: