Application.Quit()方法,未明确的流程 [英] Application.Quit() method failing to clear process

查看:1862
本文介绍了Application.Quit()方法,未明确的流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了很多从谷歌搜索这个返回的帖子,但没有一个解决方案在其中明确提到这件事对我来说。所以,我想我会尝试自己

I've seen a lot of posts returned from a Google search about this, but none of the solutions referenced in them clear this up for me. So, I thought I'd try myself.

这段代码后:

PowerPoint.Application powerPoint = new Microsoft.Office.Interop.PowerPoint.Application();
powerPoint.Visible = Office.MsoTriState.msoTrue;
Microsoft.Office.Interop.PowerPoint.Presentation ppt = null;enter code here



我可以发出ppt.Quit(); 。命令和Powerpoint将关闭,没有进程保持运行状态

I can issue the ppt.Quit(); command and Powerpoint will close and no Process is left running.

但是,如果此代码后,我这样做:

However, if after this code I do this:

ppt = powerPoint.Presentations.Open(localCopyOfPPT,  
                                    Microsoft.Office.Core.MsoTriState.msoCTrue,
                                    Microsoft.Office.Core.MsoTriState.msoTriStateMixed,
                                    Microsoft.Office.Core.MsoTriState.msoTrue);
ppt.Close();
powerPoint.Quit();



然后,退出()将无法工作。关于打开演示文稿的东西,即使我然后将其关闭,防止退出()无法正常工作,它出现。

Then, the Quit() won't work. Something about opening the presentation, even if I then close it, prevents the Quit() from working, it appears.

任何人有关于我如何能得到应用程序的任何想法正确地退出呢?

Anybody have any thoughts about how I can get the application to quit correctlY?

推荐答案

以下KB Aritcle可能会帮助你找到问题的底部。
http://support.microsoft.com/kb/317109

The following KB Aritcle might help you get to the bottom of the problem. http://support.microsoft.com/kb/317109

您可能需要显式调用的 System.Runtime.InteropServices.Marshal.ReleaseComObject 在你的PPT实例。

You might need to explicity call System.Runtime.InteropServices.Marshal.ReleaseComObject on your ppt instance.

这篇关于Application.Quit()方法,未明确的流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆