Check if slideshow successfully loaded and is in full-screen mode?

  • Thread starter Oliver Rosenkranz
  • Start date
O

Oliver Rosenkranz

Hi experts,

I designed an HTML application (HTA) which can start Powerpoint files in
full-screen mode (via /s command line; not via powerpoint application
scripting).

While Powerpoint is still loading a presentation (which may take few seconds
or a minute depending on size and complexity of the individual presentation),
this HTA is showing a progress bar.

Now, I am looking for a way to determine if Powerpoint finished loading the
presentation and if the file is shown as a slide show (ie. full-screen).

Is Powerpoint setting a flag when it fully loaded a presentation and/or is
switching to "Slideshow" mode, that can be recognized by another application
(javascript, vbscript) or is there a way to have a PPT macro or add-in which
is communicating this "event" to Windows (ie. registry, file, etc).

Let me say that I don't want to modify those powerpoint presentations, but I
am in full control of the environment in which this must happen.

By now, I am closing this progress bar within the HTA after a few seconds,
no matter how long the loading process takes. This is neither elegant nor
efficient.

I would be glad for any assistance that you can offer to point me to
possible solutions for my problem.

Cheers,

Oliver
 
O

Oliver Rosenkranz

Well, according to my own research attempts, one possible way of doing this
may be:

(a) Create a non-UI PPT 2007 add-in, which automatically starts with
Powerpoint, no matter if Powerpoint starts with or without a presentation or
slide show.

(b) That add-in monitors for the following Application-wide events:
SlideShowBegin, SlideShowEnd (also for OnSlideShowTerminate?)

(c) In case of such an event gets fired, it creates/gets a registry key
under HKCU hive and writes a new value to it (is this possible for a PPT
add-in?).

(d) My own application checks the value of this registry key every few
seconds (easy to do for me).

Is this a realistic attempt? Any bear traps for realising this for PPT 2007
that you want to point me to?

And since I have no experience in Powerpoint add-in programming: Can anybody
give me a good code example how to achieve this?
 
C

Chirag

The slide show window's class name is 'screenClass'. You might want to check
when this window gets created. Use FindWindow() API as
FindWindow('screenClass', NULL) and when it returns a non-zero value, you
know that the slide show has started.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
O

Oliver Rosenkranz

I did a quick check and it is possible to get the Window handle via VBScript
without the use of any PPT add-in when registering - for example - AutoIT Dll
and use the WinGetHandle method.

I will script this tomorrow and run extended tests. If I do not encounter
any surprises (my HTA application is also running in full-screen, for
example), this would be an easy solution. Of course, if the full-screen mode
within PPT is canceled, before the routine checks this, then the routine will
wait forever...

Do you know the Window class names of the full screen modes of Adobe Reader,
Windows Media Player and Internet Explorer, too? Or do you know how to help
me find this?

Cheers...
 
O

Oliver Rosenkranz

:
....
Yes, quite possible. To write to *any* arbitrary registry key, you'd need to use
the Win API registry read/write calls. But if your own app can read/write from
any arbitrary location, it's simpler in the PPT add-in to use GetSetting and
SaveSetting. These read/write only from

HKEY_CURRENT_USER\Software\VB and VBA Program Settings\[appname you specify]
And since I have no experience in Powerpoint add-in programming: Can anybody
give me a good code example how to achieve this?

Creating a working PPT add-in that listens to a certain event seems to be
not so easy task.

a. I disabled macro security - just to make sure that everything run smoothly.
b. I created a PPT (well, I took an add-in example called
"AutoWideScreen.ppt" and manipulated it according to what I thought fits...

The resulting code by now is:

--- class module ---
Option Explicit

Public WithEvents PPTEvent As Application

Private Sub Class_Initialize()
End Sub

Private Sub Class_Terminate()
End Sub

Private Sub PPTEvent_SlideShowBegin(ByVal Wn As SlideShowWindow)
Call WentFullScreenNewHandler(Wn)
End Sub
--- end class module ---

--- module ---
Option Explicit

Const MyName As String = "WentFullScreen"

Dim cPPTObject As New cEventClass
Dim TrapFlag As Boolean

Sub Auto_Open()

If TrapFlag = True Then
MsgBox ("hello")

Exit Sub
End If
Set cPPTObject.PPTEvent = Application
TrapFlag = True
End Sub
Sub Auto_Close()
If TrapFlag = True Then
Set cPPTObject.PPTEvent = Nothing
Set cPPTObject = Nothing
TrapFlag = False
End If
End Sub
Sub WentFullScreenNewHandler(Wn As SlideShowWindow)
' Called by SlideShowBegin eventhandler
Call SaveSetting("WentFullScreen", "PPTWentFullScreen", "Active", "yes")
End Sub

Sub TestAll()
Call WentFullScreenNewHandler(Application.SlideShowWindows.Item(1))

End Sub
--- end module ---

The "WentFullScreenNewHandler" doesn't get fired when I switch this PPT file
to slide show view (by pressing F5) though I thought this is defined in the
class module.

When having the PPT in full screen and running the TestAll function via
developer tool control, then the function does exactly what it should do.

So, where's my error. Please assist...
 
O

Oliver Rosenkranz

Thank you, it was easier than expected.

It did not work as code inside a PPT file... but when I saved it as PPAM and
added the add-in, it worked like a charm. Stu*id me...

Nevertheless, your help is worth a big applause and you're my hero of the day.

I can see all those wishes for further PPT add-in actions rising up in my
head.

By the way: Are the any side effects if other add-ins also catch the same
event or have their own auto_open routines?

Thank you very much...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top