dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Dec 23, 1997

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Wait for 1 second

Question:
I have a place in my Active Server Page script (VBScript) where I'd like to wait for 1 second before performing an action. What can one do to cause a script to pause for 1 second (without wasting CPU in some huge "For..." loop)?

Answer:
If all you want to do is wait, I've got a really simple answer. Call the Sleep API.

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

   Call Sleep(1000)
This will put your application into a hibernation-like mode, as it will not do anything (respond to the user, paint itself, fire events, etc.) until the call returns. This call is designed to conserve CPU cycles during periods when an application doesn't need to be active.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date