I've an application which embed a powerpoint app in a panel and automatically runs the slideshow. This works well, even the animations on the powerpoint. However, when the form lost focus the slideshow stops and doesn't continue until the form has back focus.
This is a problem because the presentation has to run in the back while I'm doing other stuff on my PC. I was thinking it could be solved by a function in the user32.dll, to trigger the form it has focus or something like that. But until now I've not succeed to make this work well. Any idea on how to solve this problem?
The code I'm using to embed the powerpoint:
Dim ofd As New OpenFileDialog
If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim pres As PowerPoint.Presentation
Dim objslides As PowerPoint.Slides
app = New PowerPoint.Application
pres = app.Presentations.Open(ofd.FileName, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoTrue)
' app.WindowState = PowerPoint.PpWindowState.ppWindowMinimized
objslides = pres.Slides
With pres.SlideShowSettings
.LoopUntilStopped = MsoTriState.msoTrue
.StartingSlide = 1
.EndingSlide = objslides.Count
.ShowType = PowerPoint.PpSlideShowType.ppShowTypeKiosk
.AdvanceMode = PowerPoint.PpSlideShowAdvanceMode.ppSlideShowUseSlideTimings
.ShowPresenterView = MsoTriState.msoFalse
.ShowWithAnimation = MsoTriState.msoTrue
.ShowWithNarration = MsoTriState.msoFalse
End With
sw = pres.SlideShowSettings.Run()
Dim screenClasshWnd = FindWindow("screenClass", 0)
SetParent(screenClasshWnd, Panel1.Handle)
SetWindowPos(sw.HWND, 1, 0, 0, Panel1.Width, Panel1.Height, 0)
swview = sw.View