Solved

Wait function in VB5

Posted on 1999-01-06
4
428 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

733 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