If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Display powerpoint in VB form as screensaver - Help
I am trying to use this VB program that I'm sure some of you have seen
before. It is from Shyam Pillai. It is located he http://skp.mvps.org/vb/pptvbwnd.htm This program allows a user to run a powerpoint presentation in either a frame or a small window. What I've done is use the code that displays the small window and have it display the presentation fullscreen. I put that code in the form load event so that when I double click the executable it will automatically run the presentation, no need to click buttons to run the presentation. Renaming this executable with .scr will run as a screensaver. I can right click, choose install and set the time to 1 minute for testing. It works, but I haven't dealt with any code yet to handle the /c, /s, / p properties yet. I've tried several snippets of code from the Internet for VB screensavers to handle keyboard and mouse movements but they don't work and that's where the key problem is. The problem is that only the escape key will end it because powerpoint has taken over, and that's the only way to end a fullscreen powerpoint slideshow. Now, the reason I'm doing this is for a company information kiosk for our breakroom, the presentation will run all day. Our HR department is going to get a 42'' LCD tv and will hook it up to a laptop computer with a network connection. I've got the path of the powerpoint presentation in the code and it works whether it's local or on a network drive. As it stands now, this will work for the kiosk, but the powers that be want this as a screensaver for the employee PCs, which is why I need mouse/keyboard movements to kill the thing. Some users are nontechnical and what they know is: "Moving the mouse always ends my screensaver at home!" Do I need some sort of VBA code within the powerpoint itself to end the presention on mouse movement? Here is the main part of code that I'm talking about, I've left out any mouse handling code as they haven't worked. Any help is appreciated: Option Explicit On Imports Microsoft.Win32 Imports Microsoft.VisualBasic Imports System.Math Public Class Form1 Inherits System.Windows.Forms.Form Const APP_NAME = "Employee Information Center" '***Change the SHOW_FILE path to the path of the presentation you want Const SHOW_FILE = "filepath" ' PowerPoint Constants Const ppShowTypeSpeaker = 1 ' Undocument constant used to display show in a window ' without PowerPoint command bars. Const ppShowTypeInWindow = 1000 Public oPPTApp As Object Public oPPTPres As Object ' API's used: ' To locate the handle of the PowerPoint slideshow window Private Declare Function FindWindow Lib "user32" _ Alias "FindWindowA" (ByVal lpClassName As String, _ ByVal lpWindowName As Long) As Long ' To set fram control as the parent of the slide show window Private Declare Function SetParent Lib "user32" _ (ByVal hWndChild As Long, _ ByVal hWndNewParent As Long) As Long ' To set the caption of the window Private Declare Function SetWindowText Lib "user32" _ Alias "SetWindowTextA" (ByVal hwnd As Long, _ ByVal lpString As String) As Long Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Windows.Forms.Cursor.Hide() Me.Close() Dim screenClasshWnd As Integer On Error Resume Next oPPTApp = CreateObject("PowerPoint.Application") If Not oPPTApp Is Nothing Then oPPTPres = oPPTApp.Presentations.Open(SHOW_FILE, , , False) If Not oPPTPres.Saved Then oPPTPres.Saved() End If If Not oPPTPres Is Nothing Then With oPPTPres With .SlideShowSettings .Run() End With Call SetWindowText(FindWindow("screenClass", 0), APP_NAME) End With Else MsgBox("Could not open the presentation.", MsgBoxStyle.Critical, APP_NAME) End If Else MsgBox("Could not instantiate PowerPoint.", MsgBoxStyle.Critical, APP_NAME) End If End Sub End Class |
Thread Tools | |
Display Modes | |
|
|