Why we use DoEvents in VB6.0?

Showing Answers 1 - 3 of 3 Answers

Ganapathy.C.M

  • Dec 19th, 2006
 

In the bad old days (before Win95), Windows could only do one thing at a time. This meant that events like mouse clicks and other user input could only be serviced in order, like everything else, even if they were in another program. A macro also has to be serviced in order, and while it was running, the code that processed events could not run. To solve this, the DoEvents command allowed Windows to take a break from the macro, process any pending events (even in other programs), and then return control to the macro. It is still somewhat useful today because while Windows can handle the events without worrying about a macro bogging it down, an individual program like Access is still limited.

In the modern era, DoEvents is a relic of the old Windows that will slowly disappear as things like .NET supplant VBA and the old event processing infrastructure.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions