tags:

views:

687

answers:

2

Hi all,

Im creating a C# application that plays a powerpoint slideshow. After the slideshow has finished I want to stop powerpoint and return to my program again. The problem i'm having is that I have to click at the ending of the slideshow to return to my program...

Is there a way that I can disable to wait for a click?

private void ShowPresentation()
{
    String strPresentation, strPic;
    strPresentation = Application.StartupPath + "\\testje.ppt";

    bool bAssistantOn;

    //PowerPoint.Application objApp;
    PowerPoint.Presentations objPresSet;
    PowerPoint._Presentation objPres;
    PowerPoint.Slides objSlides;
    PowerPoint._Slide objSlide;
    PowerPoint.TextRange objTextRng;
    PowerPoint.Shapes objShapes;
    PowerPoint.Shape objShape;
    PowerPoint.SlideShowWindows objSSWs;
    PowerPoint.SlideShowTransition objSST;
    PowerPoint.SlideShowSettings objSSS;
    PowerPoint.SlideRange objSldRng;
    Graph.Chart objChart;

    //Create a new presentation based on a template.
    objApp = new PowerPoint.Application();
    objApp.SlideShowBegin += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowBeginEventHandler(powerpnt_SlideShowBegin);
    objApp.SlideShowEnd += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowEndEventHandler(powerpnt_SlideShowEnd);
    objApp.SlideShowNextSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowNextSlideEventHandler(powerpnt_SlideShowNextSlide);
    objApp.Visible = MsoTriState.msoTrue;
    objPresSet = objApp.Presentations;
    objPres = objPresSet.Open(strPresentation, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
    objSlides = objPres.Slides;

    //Prevent Office Assistant from displaying alert messages:
    bAssistantOn = objApp.Assistant.On;
    objApp.Assistant.On = false;

    //Run the Slide show from slides 1 thru 3.
    objSSS = objPres.SlideShowSettings;
    objSSS.StartingSlide = 1;
    objSSS.EndingSlide = objSlides.Count;
    objSSS.Run();
}

private void powerpnt_SlideShowEnd(Microsoft.Office.Interop.PowerPoint.Presentation Pres)
{
    objApp.Quit();
}

In a nutshell, SlideShowEnd only fires when the last slide has played and I have clicked on the presentation. I want SlideShowEnd to fire when the last slide has played...

A: 

In PowerPoint settings there is an option: End with black side. You can try to see if this exists in the COM and use it.

Timotei Dolean
Just found out, was about to answer my own question :) Thanks anyway
PoweRoy
A: 

This only works for me when the presentation is in "full screen" mode. The black slide is still shown in "windowed" mode.

Tony