01.
<DllImport(
"user32.dll"
, EntryPoint :=
"FindWindow"
, SetLastError :=
True
)> _
02.
Private
Shared
Function
FindWindow(ZeroOnly
As
IntPtr, lpWindowName
As
String
)
As
IntPtr
03.
End
Function
04.
05.
<DllImport(
"user32.dll"
, SetLastError :=
True
)> _
06.
Private
Shared
Function
SetParent(hWndChild
As
IntPtr, hWndNewParent
As
IntPtr)
As
IntPtr
07.
End
Function
08.
09.
<DllImport(
"user32.dll"
, SetLastError :=
True
, CharSet := CharSet.
Auto
)> _
10.
Public
Shared
Function
SetWindowText(hwnd
As
IntPtr, lpString
As
[
String
])
As
Boolean
11.
End
Function
12.
13.
14.
Private
FileName
As
String
=
""
15.
Private
application
As
PowerPoint.Application
16.
Private
presentation
As
PowerPoint.Presentation
17.
Private
flag
As
Boolean
=
False
18.
19.
Public
Sub
New
()
20.
InitializeComponent()
21.
End
Sub
22.
23.
24.
Public
Sub
open()
25.
sair()
26.
27.
openFileDialog1.Filter =
"Powerpoint file (*.ppt)|*.ppt|All files (*.*)|*.*"
28.
29.
If
openFileDialog1.ShowDialog() = DialogResult.OK
Then
30.
FileName = openFileDialog1.FileName
31.
32.
Dim
screenClasshWnd
As
IntPtr =
DirectCast
(0, IntPtr)
33.
Dim
x
As
IntPtr =
DirectCast
(0, IntPtr)
34.
35.
flag =
True
36.
37.
application =
New
PowerPoint.Application()
38.
presentation = application.Presentations.Open2007(FileName, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue)
39.
Dim
sst1
As
PowerPoint.SlideShowSettings = presentation.SlideShowSettings
40.
41.
42.
sst1.ShowType =
DirectCast
(1, PowerPoint.PpSlideShowType)
43.
Dim
sw
As
PowerPoint.SlideShowWindow = sst1.Run()
44.
45.
46.
sw.Height = (panel1.Height) - 64
47.
sw.Width = (panel1.Width) - 130
48.
49.
Dim
formhWnd
As
IntPtr = FindWindow(x,
"Form1"
)
50.
Dim
pptptr
As
IntPtr =
DirectCast
(sw.HWND, IntPtr)
51.
screenClasshWnd = FindWindow(x,
"screenClass"
)
52.
SetParent(pptptr, panel1.Handle)
53.
54.
Me
.Focus()
55.
56.
Me
.application.SlideShowEnd +=
New
Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowEndEventHandler(SlideShowEnds)
57.
End
If
58.
End
Sub