Automated process hanging waiting for dialog

  • Thread starter Thread starter Benny
  • Start date Start date
B

Benny

I have an automated application that opens and manipulates Office
documents. Every time a document triggers a dialog to pop up, the
process waits for the dialog before it continues. After a little
research, it seems like I will need to use hooks and messages in the
Win32 API. Does anyone know how I could go about catching when a
dialog is porduced and sending it a message to close? Any ideas are
more than appreciated considering this is a time-sensative matter.
Thanks in advance!
 
When automating Office applications you must assume that a interactive user
to be present to respond to dialogs, or you must make sure no dialogs can
show up.
The dialogs are showing application related info that requires a user action
, why would you close it without reading or taking an action?
Or are you using office automation from withing a service?

Willy.


|I have an automated application that opens and manipulates Office
| documents. Every time a document triggers a dialog to pop up, the
| process waits for the dialog before it continues. After a little
| research, it seems like I will need to use hooks and messages in the
| Win32 API. Does anyone know how I could go about catching when a
| dialog is porduced and sending it a message to close? Any ideas are
| more than appreciated considering this is a time-sensative matter.
| Thanks in advance!
|
 
Thank you for the reply. There are literally hundreds to thousands of
documents that are processed and obviously it would be impossible to monitor
the entire process. The thing is, it really doesnt matter wheather the
document that produces the dialog doesnt process, the main thing is to keep
the process going. So any way to close the dialog will be fine, even if the
document doesnt process as a result of closing the dialog. So is there ANY
way to find out when a dialog is produced because of the document and close
it? Like I said before, my initial idea was to use the Win32 API using
FindWindow and SendMessage(WM_CLOSE) but I'm not sure. Thanks again!
 
I assume you have loaded the Office Primary Interop Assembly in your
project?

The Word & Excel object models expose a DisplayAlerts property
specifically for the purpose of supressing such dialogs. You need to
set that property to false, remembering to unset it when you are done.
This causes the application to choose the default response to the
dialog.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top