First I am using Visual Basic 2010 Express and I am new to Visual Basic. I don't even know if visual basic is my best choice of language for my task; I would like to create a desktop application to run multiple slideshow on one screen display. As a starter to learn the language and to make gradual steps, I am trying to show an automated slideshow within a VB panel(pptBox1). So far, I am able to open the slideshow but it is not automated and it is not showing within panel. I hope someone can help or point me in a direction. Here is the code i am using:
---------------------------------------------------------------------------------------------------------------------
Public Class frmTest
Public oPPTApp As Object
Public oPPTPres As Object
Dim tst As String
Const ppShowTypeSpeaker = 1
Const ppSlideShowUseSlideTimings = 3
' Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim screenClasshWnd As IntPtr
oPPTApp = CreateObject("Powerpoint.Application")
oPPTPres = oPPTApp.Presentations.Open("C:\Users\Owner\Documents\test.pptx", , , False)
screenClasshWnd = FindWindow("screenClass", "PowerPoint Slide Show - [test]")
SetParent(screenClasshWnd, Me.pptBox1.Handle)
With oPPTPres
With .Slides
With .Range
With .SlideShowTransition
.AdvanceOnTime = True
End With
End With
End With
With .SlideShowSettings
.ShowType = ppShowTypeSpeaker
.AdvanceMode = ppSlideShowUseSlideTimings
With .Run
.width = Me.pptBox1.Width
.height = Me.pptBox1.Height
End With
End With
End With
' oPPTPres.Saved = True
' oPPTPres.close()
' oPPTApp.quit()
End Sub
---------------------------------------------------------------------------------------------------------------------
Public Class frmTest
Public oPPTApp As Object
Public oPPTPres As Object
Dim tst As String
Const ppShowTypeSpeaker = 1
Const ppSlideShowUseSlideTimings = 3
' Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim screenClasshWnd As IntPtr
oPPTApp = CreateObject("Powerpoint.Application")
oPPTPres = oPPTApp.Presentations.Open("C:\Users\Owner\Documents\test.pptx", , , False)
screenClasshWnd = FindWindow("screenClass", "PowerPoint Slide Show - [test]")
SetParent(screenClasshWnd, Me.pptBox1.Handle)
With oPPTPres
With .Slides
With .Range
With .SlideShowTransition
.AdvanceOnTime = True
End With
End With
End With
With .SlideShowSettings
.ShowType = ppShowTypeSpeaker
.AdvanceMode = ppSlideShowUseSlideTimings
With .Run
.width = Me.pptBox1.Width
.height = Me.pptBox1.Height
End With
End With
End With
' oPPTPres.Saved = True
' oPPTPres.close()
' oPPTApp.quit()
End Sub