Search Tools Links Login

WaitableTimer API


Visual Basic 6, or VB Classic



WaitableTimer API

This demo demonstrates how to use the WaitableTimer API in Windows. A WaitableTimer is very similar to the Sleep API. You can use this API to pause your application for a set amount of time, without taking up any CPU cycles. The benefit of a WaitableTimer over the Sleep API is that WaitableTimers allow your application to still receive events during the wait, while the Sleep command will freeze your app, queuing all events until the sleep interval has expired.


Demo

This demo shows you the difference between a 5 second wait using the Sleep API compared with a WaitableTimer. You will notice that while sleeping your form will not respond to any events, such as minimizing the form or re-painting if the form gets covered by another window. While using a WaitableTimer, the app remains completely responsive to all these Windows events!


Finally, this demo provides an easy to use class called clsWaitableTimer, which completely encapsulates the WaitableTimer API. All you will need to do to take advantage of this API is to call the method Wait, passing in the number of milliseconds you want to wait.


Enjoy and don't forget to vote!

Original Author: David Drake

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 93 times

Categories

Visual Basic 6

Attachments

CODE_UPLOAD15647312001.zip
Posted: 9/3/2020 3:45:00 PM
Size: 4,303 bytes


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.