When an event fires, the event handler executes synchronously. It grabs control of the CPU and doesn't let go until it is finished executing. That means other events are blocked until it's done. In particular that means other events cannot interfere with the executing code and that the user cannot interact with the application or any other application until the event handler terminates.
You can allow the user to interact with other applications by using DoEvents in the event handler's code. This will also allow the user to interact with the running application, however, so you need to be careful. For example, suppose a button started the event handler running. If the user clicks the button again, it will start a new instance of the event handler executing. Debugging this sort of thing can be tricky. Usually it is better to disable the button and any other controls you don't want the user to mess with while the event handler is executing.
|