Activating PPT button via click in window

R

Robert Crago

Hi there [repost from ms.public.powerpoint]

Would anyone care to share the secrets of sending mouse
clicks to the PowerPoint slideshow window via automation
to cause slide changes, button clicks etc?

I've tried SendMessaging a WM_LBUTTONDOWN message to the
slideshow window and SPY++ tells me the messages are
being received by that window, but nothing is happening.

My questions are:

1) Which of PowerPoints windows do I have click in
2) Do I need both WM_LBUTTONDOWN and WM_LBUTTONUP (or
some other combination possibly with a delay)

I already use oPres.SlideShowWindows(1).View.Next and
friends to advance slides etc, but this will only
activate objects in the pre-planned side show animation
sequence.

What if your slide contained a movie that was setup to
only be played when explicitly clicked with the mouse.
(and there are other examples as well). This is why I
want to send a sumulated click to the slideshow window.

Thank you for your help...

Robert
 
E

Eric Lawrence [MSFT]

I don't know if this is helpful, but I wrote a quick little tool to change
slides in powerpoint as follows:

Go Forward a slide:
h:=FindWindow('screenClass', nil);
if h>0 then h:=FindwindowEX(h, 0, 'paneClassDC', nil);
if h>0 then
Begin
postmessage( h,wm_keydown, vk_space,0);
postmessage( h,wm_keyup, vk_space,0);
End;

Go Back a slide:
h:=FindWindow('screenClass', nil);
if h>0 then h:=FindwindowEX(h, 0, 'paneClassDC', nil);
if h>0 then
Begin
postmessage( h,wm_keydown, vk_back,0);
postmessage( h,wm_keyup, vk_back,0);
End;


--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.
 
R

Robert Crago

Eric,

Thanks for responding to my post re clicking on
PowerPoint buttons.

I greatly appreciate your help and its (almost) solved
the problem.

Following the example in your code, I have now managed to
advance the slideshow from another app and have even
progressed from your WM_KEYDOWN/UP to using
WM_LBUTTONDOWN/UP at appropriate locations.

However I still can't achieve clicking on movies or
buttons on the slide. Everywhere my app 'clicks' it just
advances the slide even if in the centre of a button or
movie. However if the (real) mouse is just placed over a
movie, a remote click WILL start/stop the movie playing,
but not if the mouse is elsewhere on the screen. Action
buttons just steadfastly refuse to respond to remote
clicks.

Judging by the movie experience, I obviously have to do
something BEFORE the WM_LBUTTONDOWN to get it to work (eg
a WM_MOUSEMOVE or WM_ACTIVATE etc) but I don't seem to
have any success with any of these that I have tried.

The movie and buttons don't SEEM to be separate windows
(as far as i can tell) so clicking on the correct place
in the SlideShowWindow (paneClassDC) should product the
correct effect.

Can you shed any more light on this from your greater
experience? I would appreciate it.

Thank you again...

Robert
 

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