Solved

Delaying Code Execution for x milliseconds

Posted on 1998-10-27
2
257 Views
Last Modified: 2010-04-30
This should be simple for most of you.

I need to draw a graph in slow-motion so that people can see the drawing process step-by-step.

All I need to know is how to delay code execution at run-time in VB5. I know that in C++, all you need is the "delay" keyword followed by the no. of milliseconds.
But how do I do it in VB5 ? Can I do it without the timer control ?

Thanks
0
Comment
Question by:xoooox
[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
2 Comments
 
LVL 1

Accepted Solution

by:
zivf earned 50 total points
ID: 1442004
you need to run a loop, and using the timer() function will be the most accurate. it returns the number of seconds since last midnight, and at least 2 more digits accurate to the right of the decimal point.
tmr = timer()
do while timer() < (tmr + wait_time)
    ' here you can put DoEvents if you want other tasks
    ' to get CPU time
loop
0
 

Expert Comment

by:BHimmerick
ID: 1442005
I believe this is the code you are looking for.

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

Just call Sleep for it to pause the number of Milliseconds you want it to.

0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

738 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