|
-
Jun 24th, 2002, 06:55 AM
#1
Pause
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
-
Jun 24th, 2002, 07:05 AM
#2
Try the Sleep API
VB 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
-
Jun 24th, 2002, 10:08 AM
#3
Banned
Does this API affect all processes or only the app that uses it?
-
Jun 24th, 2002, 10:08 AM
#4
Banned
Does this API affect all processes or only the app that uses it?
-
Jun 25th, 2002, 01:17 AM
#5
Originally posted by Hack
Try the Sleep API
VB 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
But this will pause my other processes also,
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
-
Jun 25th, 2002, 01:38 AM
#6
PowerPoster
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.
Last edited by Arc; Jun 25th, 2002 at 01:41 AM.
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Jun 25th, 2002, 01:51 AM
#7
Hyperactive Member
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
Sometimes what you're looking for is exactly where you left it.
-
Jun 25th, 2002, 01:55 AM
#8
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
Aha..
thanx.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|