A
Andy Fish
Hi,
I am automating ms word 2003 through .Net office interop, and my app is
running on an unattended server.
If I try to open a password protected document, word pops up a dialog box
asking for the password. Obviously since the machine is unattended, there is
nobody to press cancel, so my process just hangs forever. Infact because
it's running as a service, there's probably not even a dialog box actually
displayed anywhere.
I'm not worried about what happens to that particular document, but I need
to have some way of stopping the calling process hanging. So far my ideas
are (in order of preference):
1. tell word it should never pop-up any dialogs because it's running on a
server
2. find out the process ID of winword.exe when invoking it from COM so I can
kill it from a separate thread (bearing in mind there might be several
winword.exe's running on the same machine)
3. detect up front if the document is password-protected
4. somehow kill the calling thread in .net (thread.abort doesn't work)
can anyone help me accomplish _any_ of these ?
Thanks very much in advance for any hints (other than "don't OLE word from a
server process" - I already know that one)
Andy
I am automating ms word 2003 through .Net office interop, and my app is
running on an unattended server.
If I try to open a password protected document, word pops up a dialog box
asking for the password. Obviously since the machine is unattended, there is
nobody to press cancel, so my process just hangs forever. Infact because
it's running as a service, there's probably not even a dialog box actually
displayed anywhere.
I'm not worried about what happens to that particular document, but I need
to have some way of stopping the calling process hanging. So far my ideas
are (in order of preference):
1. tell word it should never pop-up any dialogs because it's running on a
server
2. find out the process ID of winword.exe when invoking it from COM so I can
kill it from a separate thread (bearing in mind there might be several
winword.exe's running on the same machine)
3. detect up front if the document is password-protected
4. somehow kill the calling thread in .net (thread.abort doesn't work)
can anyone help me accomplish _any_ of these ?
Thanks very much in advance for any hints (other than "don't OLE word from a
server process" - I already know that one)
Andy