Determine whether Powerpoint is in Presentation mode or not

Marv

I have written a program that pops up and plays a Sound when a interval has elapsed that the user can set by himself.

Now I want it to stay silent when Powerpoint is running in presentation mode and the interval elapses, so the program won't appear at the top of the screen and playing the sound when doing presentations with an external audience.

The used PowerPoint versions are 07/10/13 (12.0/14.0/15.0) I couldnt find any way to determine if the presentation mode is running or not.

This program is no PowerPoint addin or something like that just a normal WPF desktop application.

Marv

Sorry if that looks a bit greedy to answer my own question, but i think this answer will help someone with the same problem:

Simply add the COM reference called "Microsoft PowerPoint 15.0 Object Libary" - it appears in the reference list as "Microsoft.Office.Interop.PowerPoint"

The following code tests for running Presentations and was tested working for versions 2007/10/13 (12.0/14.0/15.0):

var PPT = new Microsoft.Office.Interop.PowerPoint.Application();

if (PPT.SlideShowWindows.Count > 0)
{ //a PowerPoint Presentation mode is currently running}
else 
{//there is no PowerPoint Presentation mode running}

EDIT:

Some error reports have shown that just doing it the above way can cause an exception if PowerPoint is not running at all or when the presentation mode is not active, so I modified the code a little bit:

private bool IsPPTPresentationRunning()
{
    Process[] prozesse = Process.GetProcesses();
    foreach (Process p in prozesse)
    {//searches for a running PowerPoint process
        if (p.ProcessName == "POWERPNT")
        {
            try
            {
                Microsoft.Office.Interop.PowerPoint.Application PPT = 
                new Microsoft.Office.Interop.PowerPoint.Application();
                if (PPT.SlideShowWindows.Count > 0)
                 return true; 
                else
                 return false; 
            }
            //Catches any exception that seems to get thrown when
            // powerpoint is not in Presentation mode
            catch (Exception) 
            {
                return false;
            }
        }
    }
    return false;
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

select slide in powerpoint by hotkey when not in presentation mode

From Dev

Putting all slides of powerpoint presentation into Widescreen mode using C#

From Dev

How to programmatically trigger presentation mode in JavaScript add-in for PowerPoint?

From Dev

Putting all slides of powerpoint presentation into Widescreen mode using C#

From Dev

Setting the language of a Powerpoint presentation

From Dev

Powerpoint and VBA - "Modular" presentation

From Dev

How can I used VBA to determine whether the code is in break mode

From Dev

Is there a way to programatically determine whether JMeter is being run in 'functional test mode'?

From Dev

Open a powerpoint presentation and hide the window

From Dev

Getting the current zoom of a powerpoint presentation

From Dev

Programmatically editing text in a powerpoint presentation

From Dev

Make a PowerPoint presentation using Python?

From Dev

Exception trying to load powerpoint presentation

From Dev

Deleting named objects in a Powerpoint presentation

From Dev

Loop a selected part of a Powerpoint presentation

From Dev

Generating a powerpoint presentation with VBA and Excel

From Dev

Set presentation mode in KUbuntu

From Dev

Open a PowerPoint presentation from Excel with VBA and then set that presentation to a variable

From Dev

Using OpenXML to save a PowerPoint presentation as a PDF

From Dev

How to add pictures to Powerpoint Presentation Picture PlaceHolder?

From Dev

Paperclip: How to upload Powerpoint presentation files

From Dev

PowerPoint: reuse a slide multiple times in a presentation

From Dev

How to have sub-points in a powerpoint presentation

From Dev

Add text to PowerPoint slide during a presentation

From Dev

How to extract all images from a PowerPoint presentation?

From Dev

Change the spell-checking language on a PowerPoint presentation

From Dev

Embed slides from another PowerPoint presentation

From Dev

Remove all unused master slides in a PowerPoint presentation

From Dev

How to convert Powerpoint ppsx (presentation) to pdf?

Related Related

  1. 1

    select slide in powerpoint by hotkey when not in presentation mode

  2. 2

    Putting all slides of powerpoint presentation into Widescreen mode using C#

  3. 3

    How to programmatically trigger presentation mode in JavaScript add-in for PowerPoint?

  4. 4

    Putting all slides of powerpoint presentation into Widescreen mode using C#

  5. 5

    Setting the language of a Powerpoint presentation

  6. 6

    Powerpoint and VBA - "Modular" presentation

  7. 7

    How can I used VBA to determine whether the code is in break mode

  8. 8

    Is there a way to programatically determine whether JMeter is being run in 'functional test mode'?

  9. 9

    Open a powerpoint presentation and hide the window

  10. 10

    Getting the current zoom of a powerpoint presentation

  11. 11

    Programmatically editing text in a powerpoint presentation

  12. 12

    Make a PowerPoint presentation using Python?

  13. 13

    Exception trying to load powerpoint presentation

  14. 14

    Deleting named objects in a Powerpoint presentation

  15. 15

    Loop a selected part of a Powerpoint presentation

  16. 16

    Generating a powerpoint presentation with VBA and Excel

  17. 17

    Set presentation mode in KUbuntu

  18. 18

    Open a PowerPoint presentation from Excel with VBA and then set that presentation to a variable

  19. 19

    Using OpenXML to save a PowerPoint presentation as a PDF

  20. 20

    How to add pictures to Powerpoint Presentation Picture PlaceHolder?

  21. 21

    Paperclip: How to upload Powerpoint presentation files

  22. 22

    PowerPoint: reuse a slide multiple times in a presentation

  23. 23

    How to have sub-points in a powerpoint presentation

  24. 24

    Add text to PowerPoint slide during a presentation

  25. 25

    How to extract all images from a PowerPoint presentation?

  26. 26

    Change the spell-checking language on a PowerPoint presentation

  27. 27

    Embed slides from another PowerPoint presentation

  28. 28

    Remove all unused master slides in a PowerPoint presentation

  29. 29

    How to convert Powerpoint ppsx (presentation) to pdf?

HotTag

Archive