Solved

Wait function in VB5

Posted on 1999-01-06
4
395 Views
Last Modified: 2008-02-26
Is there a wait or sleep function in VB5 that I can use to release the cpu and suspend execution for a period of time?
0
Comment
Question by:gemme
4 Comments
 
LVL 3

Expert Comment

by:jjbyers
ID: 1454389
I use the DoEvents and a do loop like this.

Dim EndTime As Date

  EndTime = Format(Now + #12:00:10 AM#, "long time")
  Do Until Format(Now, "long time") > EndTime
    DoEvents
  Loop

Hope this helps.
0
 

Accepted Solution

by:
jmnolan earned 100 total points
ID: 1454390
You can use this API call. It waits a specified number of milliseconds and then continues executing your program.

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

For a one second delay do this:

Sleep 1000

Hope that helps!
0
 

Author Comment

by:gemme
ID: 1454391
Thanks I will try this.
0
 
LVL 1

Expert Comment

by:bear454
ID: 1454392
DoEvents()
Check it out in vbhelp
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now