问题描述
当我使用microsoft.office.interop.excel
创建Excel文件时,我总是在最后调用quit
命令.但是,比以往任何时候,如果我查看Windows任务管理器的进程列表,我都可以清楚地看到该进程仍然存在,一段时间后我最终得到了很多.
When I use the microsoft.office.interop.excel
to create Excel file, I always call the quit
command at the end. However, more than ever, if I look into the process list of Windows Task manager, I can clearly see that the process is still there and I end up with a bunch of those after a while.
我想在正常情况下这不是什么大问题,但我仍然想防止每次都发生这种情况.
I guess this isn't that much of a problem on normal case, but I would still like to prevent that from happening every time.
有什么办法吗?
我无法继续杀死所有Excel进程,因为其中某些进程实际上可能是应用程序正在运行,并且我无法真正分辨两者之间的区别.
I can't go on and kill all Excel process because some of them might really be application running and I can't really tell the difference between the two.
谢谢.
推荐答案
臭名昭著的犯罪者(自动化)!要完全关闭该过程,请调用 Marshal.FinalReleaseComObject( {com object})(适用于所有Word和Excel对象).
Notorious offender(automation)! To completely close the process you call Marshal.FinalReleaseComObject({com object}) for all Word and Excel objects.
这篇关于microsoft.office.interop.excel保留在“进程"列表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!