One of the things I've done with my automation code is use try..catch. If some 
kind of exception occurs I make the Word  object visible. That way you can 
avoid you users having hidden instances of Word running, at least when VFP 
catches an exception.

--

rk
-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of Fernando D. 
Bozzo
Sent: Friday, June 12, 2015 9:48 AM
To: [email protected]
Subject: Re: OLE Automation - This action cannot be completed because the other 
program is busy

I don't know, but I think that is not possible, at least not from the caller 
app, because once the called app have the control, the caller only can wait. 
But you can have a 3rd process that check this. In example, you can use Process 
Explorer and see that the Word application es created and have a PID, so that 
3rd process can check that and kill Word if necessary.

I think that, anyway, you should use a timeout for the dialog, just in case.

2015-06-12 14:31 GMT+02:00 Paul Newton <[email protected]>:

> Thanks Fernando
> In practice it is not the print dialog that is causing the problem - I 
> just used it to replicate the problem.  In practice my app does not 
> want Word to be visible but Word is sometimes bring up some unknown 
> dialog on some machines.
>
> Is there a way in Windows to make an application visible after it been 
> created invisible in VFP?
>
> -----Original Message-----
> From: ProfoxTech [mailto:[email protected]] On Behalf Of 
> Fernando D. Bozzo
> Sent: 12 June 2015 11:43
> To: [email protected]
> Subject: Re: OLE Automation - This action cannot be completed because 
> the other program is busy
>
> Hi Paul:
>
> I've made a quick test, and I think you can use something like this:
>
>
> LOCAL oo as Word.Application
> oo = CreateObject('Word.Application')
> oo.Documents.Add()
> oo.Visible= .T.
> oo.Dialogs(88).Show(5000)
> oo.Application.Quit(0)
>
>
> I assuming some things here (may be wrong, please, correct me):
>
> 1) I've made the Word Application visible, because I see no sense in 
> not showing the main window when the printer dialog is invoked so the 
> user can choose the printer options.
>
> 2) I've added a timeout of 5 secs to the dialog so it autocloses and 
> do not wait forever
>
> 3) I use Quit(0) to make sure that the "Save, Ignore, Cancel" dialog 
> does not show, which can hang Word again waiting forever
>
> Note: In testing this code, I've found that if I keep Word Application 
> Invisible (not adding Visible=.T.), then when the timeout of 5 secs 
> ends, the doc is automatically printed. May be this is what are you looking 
> for?
>
>
> Regards.-


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/blupr10mb0451494a21561f17a1fe4410d2...@blupr10mb0451.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to