Using OLE automation with another application, such as Microsoft Word, you may receive the following error message if you are using Microsoft Windows NT 4.0, Windows 2000, Windows XP, or Windows Server 2003:
This action cannot be completed because the other application is busy. Choose 'Switch To' to activate the busy application and correct the problem.If you are using Windows 95 and Windows 98, you receive the following error message:
This action could not be completed because the other program is busy. Click the appropriate button on the taskbar to activate the program and correct the problem.
This error message usually occurs because the OLE activated application has an open dialog box and is expecting user input. This error message can be eliminated by using the property OLERequestPendingTimeout. This property specifies the amount of time after an Automation request is made before a busy message is displayed. The default is five seconds and is specified in milliseconds. By setting the timeout to 0, Microsoft Visual FoxPro will wait indefinitely for the other application. The busy message will not be displayed whether the Automation request is pending or if a mouse or keyboard event occurs.
- Create a program and enter the following code.
APPLICATION.OLERequestPendingTimeout = 0 && 0 means no busy error message
WITH oword && Change to 100 to see busy
.Dialogs(88).SHOW && Open the Word Print dialog
.APPLICATION.QUIT(0) && Quit and don't save changes
- Run the program and click on the Microsoft Visual FoxPro window after the Word Print dialog box appears. You will not see the error messages mentioned prior.
- To see the error message, change the OLERequestPendingTimeout to a relatively low number such as 100.
- Run the code again and click the Microsoft Visual FoxPro window after the Microsoft Word Print dialog box appears. Now one of the messages that is listed in the "Summary" section appears.
Visual FoxPro Online Help, version 6.0; Search for "OLERequestPendingTimeout"