Raspoutim
Dec 7th, 2004, 02:18 PM
Hi all,
I'm currently working on an add-in for Powerpoint.
What I want to do is basically to send the title of the slides to a website during the slideshow.
For now, I have been able to do that but it appeared that it takes some time for the http calls, so I'd like to limit the sending to slides on which I stay for more than one second. (to allow to go quickly back and forth in the slideshow to find a slide for example)
So, I have this function:
Function Delay(nbSeconds As Double) As Boolean
Const OneSecond As Double = 1# / (1440# * 60#)
Dim endTime As Date
endTime = Now + OneSecond * nbSeconds
Do Until Now > endTime
Sleep 100
DoEvents
Loop
End Function
and in App_SlideShowNextSlide, I have:
index = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex
Delay 1
If (index = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex) Then
MsgBox "send the title"
Call SendTitleFunction
End If
I have added the value 'index' because I haven't been able to stop the other function if the slide changes before the one second delay. So it checks if the slide has changed or not during the second.
If I go to the next slide with a click or the enter key, it's okay: I only send the correct one and I can go fast to a specific slide.
But if I use the arrows or next page or the space bar, I have to wait for the whole second: it seems that DoEvents don't catch these events.
Then to go backward I have to use the arrow or Previous Page, and I have to wait again (and to send the title...).
So, my questions are:
-is my assumption about DoEvents correct? and if so, is there a way to catch all slide changes?
-how could I tell to the Delay calls to stop once I change the current slide again to start another call? it seems that I have as many threads as slides changes in one second. I'm not sure that's good.
Thanks for your help!
R.
I'm currently working on an add-in for Powerpoint.
What I want to do is basically to send the title of the slides to a website during the slideshow.
For now, I have been able to do that but it appeared that it takes some time for the http calls, so I'd like to limit the sending to slides on which I stay for more than one second. (to allow to go quickly back and forth in the slideshow to find a slide for example)
So, I have this function:
Function Delay(nbSeconds As Double) As Boolean
Const OneSecond As Double = 1# / (1440# * 60#)
Dim endTime As Date
endTime = Now + OneSecond * nbSeconds
Do Until Now > endTime
Sleep 100
DoEvents
Loop
End Function
and in App_SlideShowNextSlide, I have:
index = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex
Delay 1
If (index = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex) Then
MsgBox "send the title"
Call SendTitleFunction
End If
I have added the value 'index' because I haven't been able to stop the other function if the slide changes before the one second delay. So it checks if the slide has changed or not during the second.
If I go to the next slide with a click or the enter key, it's okay: I only send the correct one and I can go fast to a specific slide.
But if I use the arrows or next page or the space bar, I have to wait for the whole second: it seems that DoEvents don't catch these events.
Then to go backward I have to use the arrow or Previous Page, and I have to wait again (and to send the title...).
So, my questions are:
-is my assumption about DoEvents correct? and if so, is there a way to catch all slide changes?
-how could I tell to the Delay calls to stop once I change the current slide again to start another call? it seems that I have as many threads as slides changes in one second. I'm not sure that's good.
Thanks for your help!
R.