What does "DoEvents" do in vb6?

faressoft picture faressoft · Dec 24, 2010 · Viewed 46.2k times · Source

What does "DoEvents" do in vb6 ? Why do I get the error message "Out of stack space" ? What does it mean ?

Answer

Jonathan Wood picture Jonathan Wood · Dec 24, 2010

DoEvents() allows other Windows messages to be processed.

The reason you get an out of stack space error is probably because DoEvents() is allowing events to occur that call your code again, which again calls DoEvents(), and so on until the stack space, which tracks the return addresses for all these calls, has run out.

In general, I do not recommend using DoEvents() due to problems like these and the fact that it violates the overall event-driven design of Windows.