Powerpoint 2010 Multiple Instances

I saw numerous posts on this question here, but no one seems to have answered this question directly. I want to control two instances of Powerpoint running on a second monitor.

An ideal solution would look like this:

PowerPoint.Application PPTViewer1 = new PowerPoint.Application(); PowerPoint.Application PPTViewer2 = new PowerPoint.Application(); 

I can do this manually by simply launching two instances of PowerPoint, downloading the presentation, and running the slide show from each instance. I can switch between the two slide shows manually, with each one highlighted as expected.

So ... how to do this programmatically using VSTO and C #? Like the others in front of me, I see that the Interop.PowerPoint interface will only create one instance. If this were not so, I could achieve the results that I am looking for quite easily.

Also, I'm not looking for a third-party component for this task.

Any help is appreciated.

Thanks in advance.

+2
c # powerpoint vsto office-interop
source share
3 answers

You may be using multiple instances of Powerpoint, but this is not the case. This allows only one instance. If you see two instances of Powerpnt.exe in the task list, as it sometimes happens, this means that something went wrong and left the zombies in memory.

+1
source share

It may not be completely perfect, but here is the link that suggested launching the instance as another user (note that this site is for PowerPoint 2007).

 runas /user:username "C:\Program Files\Microsoft Office\Office12\POWER PNT.EXE" 
0
source share

Each instance of a Powerpoint COM object has the same full-screen window. I don’t know which method to switch, which presentation has this window

The solution is to place the Powerpoint display in your own window

Does this allow you to scale the window and show multiple presentations on one monitor or move it from one monitor to another?

eg.

 var display1 = new FullScreenDisplay(); // A form with BorderStyle = None display1.Show(); application1 = new PowerPoint.Application(); presentation1 = application1.Presentations.Open2007(....); var slideShowSettings1 = presentation1.SlideShowSettings; slideShowSettings1.ShowType = PowerPoint.PpSlideShowType.ppShowTypeSpeaker; var slideShowWindow1 = slideShowSettings1.Run(); IntPtr hwnd1 = (IntPtr)slideShowWindow1.HWND; SetParent(hwnd1, display1.Handle); var display2 = new FullScreenDisplay(); display2.Show(); application2 = new PowerPoint.Application(); presentation2 = application2.Presentations.Open2007(....); var slideShowSettings2 = presentation2.SlideShowSettings; slideShowSettings2.ShowType = PowerPoint.PpSlideShowType.ppShowTypeSpeaker; var slideShowWindow2 = slideShowSettings2.Run(); IntPtr hwnd2 = (IntPtr)slideShowWindow2.HWND; SetParent(hwnd2, display2.Handle); display1.BringToFront(); // to show slideshow 1 // or display2.BringToFront(); // to show slideshow 2 // To advance a slide presentation1.SlideShowWindow.View.Next(); // or presentation2.SlideShowWindow.View.Next(); // To exit, note order! presentation2.SlideShowWindow.View.Exit(); presentation1.SlideShowWindow.View.Exit(); Application.Exit(); 

Is this a hack and may not work in future versions of Powerpoint?

You also need this import.

 [DllImport("user32.dll", SetLastError = true)] static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); 
0
source share

All Articles