Visual Basic Concepts
It usually takes only a fraction of a second to set a property or call a method of an object. At times, however, your request may not be finished immediately.
Component busy is like getting a busy signal when you make a telephone call. You know you're not going to get through, so you may as well hang up and try again later.
Request pending is like having your call go through, and then having the person you're calling keep you talking much longer than you intended. If your request is serialized, then request pending is like having the other party pick up the telephone and say immediately, "Can you hold, please?"
A component may reject your request because it has a modal dialog box open, or because a user edit operation is in progress. For example, Microsoft Excel rejects requests from a client application while a spreadsheet cell is being edited.
Visual Basic assumes that the busy condition is temporary and keeps trying the request for a specified timeout interval. When that time is up, Visual Basic displays the Component Busy dialog box, as shown in Figure 10.6.
Figure 10.6 The Component Busy dialog box
The user can retry the request, cancel the request, or switch to the component and fix the problem (for example, by dismissing the dialog box). If the user chooses Cancel, the error &h80010001 (RPC_E_CALL_REJECTED) is raised in the procedure that made the request.
Once a component has accepted your application's request, your application must wait until the request has been completed. If the request takes a long time, the user may attempt to minimize your program or resize it to get it out of the way.
After a short timeout interval, Visual Basic responds to such attempts by displaying the Component Request Pending dialog.
The appearance of the Component Request Pending dialog box is slightly different from the Component Busy dialog. The Cancel button is disabled, as shown in Figure 10.7, because the request in progress cannot be canceled.
Figure 10.7 The Component Request Pending dialog box
Switching to the component is useful only if it has halted to display an error message as a result of your request. This should not be a common occurrence, because the proper behavior for a component is to return an error condition to the program that called it.
For More Information For more information, see "Changing the Component Busy or Request Pending Messages," "Controlling Timeout Intervals," and "Raising an Error on Component Busy Timeout" later in this chapter.