C# 如何监控是否有PPT文档正在演示?

如题,我有一个窗体,里面一个listbox,设置了一个timer,每1秒钟就会更新listbox的内容。

我现在想实现的功能是:

在listbox中列出所有正在演示中的powerpoint文档窗口标题。

Process.GetProcessByName只能获取名为"POWERPNT.EXE"的进程,进程里面窗体标题也只能展示出当前激活中的窗体,如何枚举出其它未激活的窗体?

另外PowerPoint在编辑状态下标题是类似于“演示文稿1 - PowerPoint”,而演示状态下标题会变为类似于“PowerPoint 幻灯片放映 - [演示文稿1]”。我怎么才能只获取所有后者这种标题?

阅读 5.1k
1 个回答

转载

How to get the title of a presentation of a powerpoint app in C#

Hi,

In powerpoint, to get the caption of the powerpoint, you should use string oldCaption = wdApp.Caption;  wdApp.Caption = guid; To set the powerpoint app visible, it should be  wdApp.Visible = MsoTriState.msoTrue;

 

Does "the title of the presentation" refer to the file name of this presentation?

You could use PresentationpptPresentation.Name or PresentationpptPresentation.FullName

Please visit _Presentation.Name Property & Presentation.FullName Property.

 

What is your button and deleteButton?

In Dictionary<int, Button>, you are using System.Windows.Forms.Button.

As far as I am concerned, we couldn’t use System.Windows.Forms.Button in Powerpoint instance.

 

To create a dynamical button, I suggest you customize the fluent UI. For more information, please visit Adding Custom Dynamic Menus to the Office Fluent User Interface
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进