Hi,
I am trying to view a powerpoint show in a form...
I could make this work fine in VB6 but after bringing the code over to VS 2003 I have an issue with hWnd control.
I know that hwnd has changed to .handle now, but it is still not working correctly!
I think the issue is to do with the hwnd parameters in the private declare functions, but I dont know what to change them to??Code:Const APP_NAME = "Powerpoint" Const ppShowTypeSpeaker = 1 Const ppShowTypeInWindow = 1000 Const ppAdvanceOnTime = 2 Public oPPTApp As Object Public oPPTPres As Object Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Private Function start_show() Dim screenClasshWnd As Long On Error Resume Next oPPTApp = CreateObject("Powerpoint.Application") oPPTPres = oPPTApp.Presentations.Open("c:\demo.ppt", , , False) With oPPTPres With .Slides With .Range With .SlideShowTransition .AdvanceOnTime = True End With End With End With With .SlideShowSettings .ShowType = ppShowTypeSpeaker .AdvanceMode = ppAdvanceOnTime With .Run .width = pptbox1.Width .height = pptbox1.Height End With End With screenClasshWnd = FindWindow("screenClass", 0&) SetParent(screenClasshWnd, pptbox1.Handle.ToInt32) End With End Function
Any ideas?
Thanks
ps.. pptbox1 is a groupbox (which i think is the same ad the frame in vb6)
Jono




Reply With Quote