Wait/sleep/pause function 
Author Message
 Wait/sleep/pause function

Hi,

Is there a function or sub available in VB 6.0 that waits a specific
amount of time? Can't seem to find it.

Thanks,
Marco



Fri, 07 Sep 2001 03:00:00 GMT  
 Wait/sleep/pause function
Hi Marco.  You may want to take a look at the Sleep API Function.

Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds
As Long)

You can find out more information about Sleep at the following links:

http://msdn.microsoft.com/library/sdkdoc/winbase/prothred_7jxs.htm

http://support.microsoft.com/support/kb/articles/q158/1/75.asp

'--------
galen


Quote:
> Hi,

> Is there a function or sub available in VB 6.0 that waits a specific
> amount of time? Can't seem to find it.

> Thanks,
> Marco



Fri, 07 Sep 2001 03:00:00 GMT  
 Wait/sleep/pause function
Hi Marco
 there is no Wait,sleep or Pause function directly available in VB
but hey
you can always use an API  Sleep function. Look up the declaration in the
API Text Viewer.

i hope that helps

RB

Quote:

>Hi,

>Is there a function or sub available in VB 6.0 that waits a specific
>amount of time? Can't seem to find it.

>Thanks,
>Marco



Fri, 07 Sep 2001 03:00:00 GMT  
 Wait/sleep/pause function

Quote:

>Is there a function or sub available in VB 6.0 that waits a specific
>amount of time? Can't seem to find it.

In addition to the Sleep API call that Galen Nickerson mentioned, you can
use the Timer function for this purpose as well. Here's an example
function....

Sub Pause(fSeconds As Single, Optional AllowEvents As Boolean = True)
'
' Pause execution for specified # of seconds [fSeconds]
'
  Dim fTimer As Single  ' intial timer value
  fTimer = Timer
  Do While Timer - fTimer < fSeconds
    If AllowEvents Then
      DoEvents
    End If
    '
    ' if we cross midnight, back up one day
    '
    If Timer < fTimer Then
      fTimer = fTimer - 86400 'one day in seconds 24*60*60
    End If
  Loop
End Sub

Note that there are differences in how a routine like the one above work and
how the Sleep API call works. You'll probably want to try them out and see
which fits best with your application's design.

Frank Carr



Fri, 07 Sep 2001 03:00:00 GMT  
 Wait/sleep/pause function

Quote:

> Hi Marco
>  there is no Wait,sleep or Pause function directly available in VB
> but hey
> you can always use an API  Sleep function. Look up the declaration in the
> API Text Viewer.

> i hope that helps

> RB


> >Hi,

> >Is there a function or sub available in VB 6.0 that waits a specific
> >amount of time? Can't seem to find it.

> >Thanks,
> >Marco

  ..or   you can test the value you get from timer


Sat, 08 Sep 2001 03:00:00 GMT  
 Wait/sleep/pause function
What about using the SLEEP API function?  It's still around, and it can be
programmed in milliseconds.


Quote:
> Hi,

> Is there a function or sub available in VB 6.0 that waits a specific
> amount of time? Can't seem to find it.

> Thanks,
> Marco



Sat, 15 Sep 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Wait/sleep/pause function

2. Pause, Delay, Wait, or Sleep Function

3. pause/sleep/wait?

4. Sleep, Wait, Pause

5. Sleep, Pause, Wait

6. Sleep, Wait, Pause

7. Sleep / Wait function ??

8. Sleep / Wait Function

9. Sleep() or Wait() function in VBScript?

10. Wait or Pause function

11. Pausing a loop to wait on function??????

12. DynuWait wait/pause function in VB Script

 

 
Powered by phpBB® Forum Software