Windows关闭期间运行进程

编程入门 行业动态 更新时间:2024-10-10 18:23:55
本文介绍了Windows关闭期间运行进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个Win32服务,该服务需要在服务停止时运行.NET可执行文件(出于清理的原因).我最近发现,清理永远不会在关闭时发生,因为进程创建会被OS阻止.有谁知道一种替代此方法的方法?过程中,我正在产卵不是侵入性的,应该只运行一秒钟的时间.

I have a Win32 service, that needs to run a .NET executable on service stop (for cleanup reasons). I recently discovered that the cleanup never happens on shutdown, because the process creation gets blocked by OS. Does anyone know a way to override this? Process, I am spawning is not invasive and should only run a fraction of a second.

推荐答案

我能找到的唯一方法是:预先创建一个挂起的子进程,然后在关闭时将其取消挂起.

The only way I could find to do it was: pre-create a child process suspended, and them un-suspend it on shutdown.

更多推荐

Windows关闭期间运行进程

本文发布于:2023-11-16 02:16:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1600091.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:进程   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!