怎样关闭PowerPoint进程。急~,帮帮忙啊,要交差了。

humourHM 2006-06-09 10:24:15
通过下面代码打开PPT后。
ppt = (PowerPoint.Presentation) System.Runtime.InteropServices.Marshal.BindToMoniker(PPTfilename);
string sFile = PPTfilename.Substring(PPTfilename.LastIndexOf("\\")+1);
ppt.Application.Visible = Office.MsoTriState.msoCTrue;

UCOMIConnectionPointContainer oConnPointContainer = (UCOMIConnectionPointContainer) ppt.Application;
// Get the GUID of the EApplication interface.
Guid guid=typeof(PowerPoint.EApplication).GUID;
// Find the connection point.
oConnPointContainer.FindConnectionPoint(ref guid,out m_oConnectionPoint);
// Call Advise to sink up the connection.
m_oConnectionPoint.Advise(this,out m_Cookie);
为什么叉掉POWERPOINT窗口后,总是无法关闭(窗口没有了,但进程依然存在)。
[DispId(2004)]//处理关闭事件
public void PresentationClose(PowerPoint.Presentation Pres)
{
object missing = System.Reflection.Missing.Value;
ppt.SaveAs(PPTfilename,PowerPoint.PpSaveAsFileType.ppSaveAsPresentation,Office.MsoTriState.msoCTrue);
ppt.Close();
m_oConnectionPoint.Unadvise(m_Cookie);
System.Runtime.InteropServices.Marshal.ReleaseComObject(ppt);
GC.Collect();
ppt = null;
}
还有就是在关闭EXCEL,和WORD里面有个属性设置可以改是否弹出保存提示,但PowerPoint怎么没看到这个属性啊。
...全文
411 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
humourHM 2006-06-09
  • 打赏
  • 举报
回复
回楼上的,没作用。
Knight94 2006-06-09
  • 打赏
  • 举报
回复
参看
http://community.csdn.net/Expert/TopicView.asp?id=4795624
所提到的关闭方法。
Knight94 2006-06-09
  • 打赏
  • 举报
回复
你可以使用"Process.Kill"方法去关闭powerpoint进程。
binny0532 2006-06-09
  • 打赏
  • 举报
回复
ppt.close()不行吗?
amandag 2006-06-09
  • 打赏
  • 举报
回复
up一下
humourHM 2006-06-09
  • 打赏
  • 举报
回复
谢谢Knight94(愚翁)问题解决。
还有就是在关闭EXCEL,和WORD里面有个属性设置可以改是否弹出保存提示(xlwkbook.Application.DisplayAlerts = false;)但PowerPoint怎么没看到这个属性啊。。
能不能帮忙看看这个问题啊,谢谢!

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧