Hi there,
Does anybody know how code the pause button
I have no of gifs, which play one by one, i want to pause any of it between
I am using gif89.dll for that, but pause method is not available with this,
Any idea,
Please...
Gary
Printable View
Hi there,
Does anybody know how code the pause button
I have no of gifs, which play one by one, i want to pause any of it between
I am using gif89.dll for that, but pause method is not available with this,
Any idea,
Please...
Gary
Try the Sleep APIVB Code:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub cmdPause_Click() Sleep 5000 'In this case, the 5000 milliseconds puts the application to bed for 5 seconds. End Sub
Does this API affect all processes or only the app that uses it?
Does this API affect all processes or only the app that uses it?
But this will pause my other processes also,Quote:
Originally posted by Hack
Try the Sleep APIVB Code:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub cmdPause_Click() Sleep 5000 'In this case, the 5000 milliseconds puts the application to bed for 5 seconds. End Sub
the other processes should keep going,
and another problem is that ..after sleep complete, the gif will automatically play.....
but doesn't go like this....I want it this way
When user click on pause, the image will pause till user click on play button, like mp3 player
Any other idea
Gary
Add this to a Module
VB Code:
Public Declare Function GetTickCount Lib "kernel32" () As Long Sub Pause(Length As Long) Dim OldTime As Long OldTime = GetTickCount Do DoEvents If GetTickCount >= OldTime + Length Then Exit Do Loop End Sub
1second = Pause(1000)
I wrote that pause sub because it can pause from 1,000th of a second to several days. Most pause subs use the built in "Timer" function.. these are ok but don't allow as wide a variaty of pause times. And the Sleep API sucks becasue it puts your whole program to sleep.
So gettickcount is the only way to go.
Try something like this:
Code:Private Sub Form_Load()
Command1.Caption = "Pause"
End Sub
Private Sub Command1_Click()
'toggle command caption
If Command1.Caption = "Pause" Then 'user wants to pause
Command1.Caption = "Resume"
'even though the button shows resume the app is paused
Else 'user wants to resume
Command1.Caption = "Pause"
End If
End Sub
'then place this in the loop that shows your pictures
Do While Command1.Caption <> "Pause"
'for faster code use:
'Do While Len(Command1)=5
DoEvents
Loop
Aha..Quote:
Originally posted by JohnVB6
Try something like this:
Code:Private Sub Form_Load()
Command1.Caption = "Pause"
End Sub
Private Sub Command1_Click()
'toggle command caption
If Command1.Caption = "Pause" Then 'user wants to pause
Command1.Caption = "Resume"
'even though the button shows resume the app is paused
Else 'user wants to resume
Command1.Caption = "Pause"
End If
End Sub
'then place this in the loop that shows your pictures
Do While Command1.Caption <> "Pause"
'for faster code use:
'Do While Len(Command1)=5
DoEvents
Loop
thanx.