Microsoft KB Archive/120289

{| = BUG: Action Cannot Be Completed Because the Object Is Busy =
 * width="100%"|

ID: Q120289

The information in this article applies to:

- Microsoft FoxPro for Windows, versions 2.5a, 2.5b, 2.6, 2.6a

SYMPTOMS
When you are closing a document linked in a general field, Microsoft Windows reports the following error:

The action cannot be completed because the object is busy.

WORKAROUND
For an example of how to work around this problem, see "Workaround" in the "More Information" section below.

STATUS
Microsoft has confirmed this to be a problem in FoxPro versions 2.5a, 2.5b, 2.6, and 2.6a for Windows. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Steps to Reproduce Problem
1. Use the following commands to create a new cursor (a temporary table)

that contains a general field and append a new record to the cursor:

CREATE TABLE oletable (object G)     APPEND BLANK 2. Open Microsoft Word 6.0 for Windows and create a new document that contains some text. Save the document as OLETEST.DOC. 3. Return to FoxPro and link the new document into the general field using the following command:

APPEND GENERAL object FROM GETFILE('DOC' ) LINK

A standard open file dialog box is presented, allowing you to find and select the new Word document. 4. With the document linked into the general field, issue the following command in the Command window:

@ 0,0 SAY object VERB 'Edit'

The document linked into the general field is displayed in Word. 5. Close the document with or without having made any changes. Return to  FoxPro. The following error will be displayed:

The action cannot be completed because the object is busy.

Workaround
To avoid the error, add the undocumented NOWAIT clause to the @ ... SAY VERB command specified in step 4. Unfortunately, this modification has a potentially undesirable side effect: NOWAIT implies that FoxPro will continue to process commands asynchronously until it encounters a wait state or end of program.

WARNING: This function is undocumented, and therefore may be changed or omitted without notice from future releases of FoxPro. The reliability of this function is not guaranteed.

If the @ ... SAY ... VERB command is associated with the VALID clause of a control such as a push button, the addition of the NOWAIT clause may prove harmless. If, however, further processing depends on the completion of the @ ... SAY ... VERB command, processing must be suspended until the focus returns to FoxPro. There are a few ways to accomplish this. One method is to display a dialog box with a terminating push button and some text requesting the user click the button to continue. Another method, shown below, uses FoxTools to continuously check if FoxPro is the frontmost application and continue when this condition is met.

* This code assumes that Word for Windows is running IF !'FOXTOOLS' $ SET('LIBRARY') SET LIBRARY TO FoxTools ADDITIVE ENDIF

FoxWind = MAINHWND

*Get HWND of frontmost app GetActiveApp = REGFN('GetActiveWindow','','I')

@0,0 SAY object VERB 'Edit' NOWAIT

* Keep looping until the active window is FoxPro DO WHILE .t.     IF FoxWind = CALLFN(GetActiveApp) EXIT ENDIF ENDDO The disadvantage of this method is that it burdens the processor by looping continuously. Additional reference words: FoxWin buglist2.50a buglist2.50b buglist2.60 buglist2.60a 2.50a 2.50b 2.60 2.60a link linked object linking embedding errmsg KBCategory: kbole kberrmsg kbcode kbbuglist KBSubcategory: FxinteropWinword
 * }