Click here to Skip to main content
12,999,417 members (51,368 online)
Rate this:
Please Sign up or sign in to vote.
See more:
using System.Diagnostics;
using System.Runtime.InteropServices;
using ppt = Microsoft.Office.Interop.PowerPoint;
using Microsoft.Office.Core;

   [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
        static extern IntPtr FindWindow(IntPtr ZeroOnly, string lpWindowName);
        [DllImport("user32.dll", SetLastError = true)]
        static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
        [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
        public static extern bool SetWindowText(IntPtr hwnd, String lpString);
        ppt.Presentation presentation;
        Microsoft.Office.Interop.PowerPoint.SlideShowView oSlideShowView;
        bool flag = false;
        public void open(string FileName)
                ppt.Application application;
                // For Display in Panel
                IntPtr screenClasshWnd = (IntPtr)0;
                IntPtr x = (IntPtr)0;
                application = new ppt.Application();
                presentation = application.Presentations.Open(FileName, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
                ppt.SlideShowSettings sst1 = presentation.SlideShowSettings;
                sst1.LoopUntilStopped = Microsoft.Office.Core.MsoTriState.msoCTrue;
                ppt.Slides objSlides = presentation.Slides;
                sst1.LoopUntilStopped = MsoTriState.msoTrue;
                sst1.StartingSlide = 1;
                sst1.EndingSlide = objSlides.Count;
                panel1.Dock = DockStyle.Fill;
                sst1.ShowType = ppt.PpSlideShowType.ppShowTypeKiosk;
                ppt.SlideShowWindow sw = sst1.Run();
                oSlideShowView = presentation.SlideShowWindow.View;
                IntPtr pptptr = (IntPtr)sw.HWND;
                SetParent(pptptr, panel1.Handle);

            catch (Exception)

        private void Form3_Load(object sender, EventArgs e)
            string FileName = "D:\\test.pptx";
        private void timer1_Tick(object sender, EventArgs e)

Here I m Trying to Play Power Point in a Window Panel.
its playing power point file in Panel but problem is that first it play full screen within fraction of seconds it continue playing in Panel.
but i need to play directly on panel.
Please Help if any one knows.
Posted 24-Feb-13 20:21pm
Updated 24-Feb-13 23:39pm
romanpetrov 26-Mar-13 6:14am
I have exactly the same problem...
romanpetrov 27-Mar-13 4:25am
Doing some research, I found that this problem not appears in PowerPoint 2013, only in previous versions of PowerPoint.
rakesh bairi 28-Mar-13 1:39am
In my case I am developing Windows application installed on Client Side,Code should be Independent of Microsoft office,
romanpetrov 28-Mar-13 8:51am
Actually, your code DEPENDS on PowerPoint version. In PowerPoint 2010, after your call ppt.SlideShowWindow sw = sst1.Run(); PowerPoint always shows slide at fullscreen. You can check this with presentation having a transition on its first slide. In PowerPoint 2013 this problem not occurs.
rakesh bairi 30-Mar-13 9:32am
Thanks for answer I have one doubt should i have to use power point 2013 assembly in my code ?because in my Development machine i have office 2010
romanpetrov 16-Apr-13 7:42am
If you install Office 2013, the issue should be gone. But I still not have any solution for PowerPoint 2010..
rakesh bairi 17-Apr-13 3:18am
thanks i will try with office 2013.
rakesh bairi 9-Apr-13 3:05am
Please help me not got solution until now :(
rakesh bairi 3-May-13 10:25am
thanks @romanpetrov finally got solution
GeorgeHLord 26-May-14 17:40pm
Hi , I´m facing the same problem. But I have to make it run not just for PowerPoint 2013.
@rakeshbairi did you find another way to embed ppt in WPF?

best regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100