J
John McGhie
All:
Windows XP SP2/Word 2003 SP1
I have a customer with a conundrum. They have an application written
in C++ that is calling the Word spelling checker via COM. It is very
intermittently returning the error "The server threw an exception." If
you can give me a clue where to look or what to try, I would be most
grateful. Sorry: I am not a C++ developer, and they have run out of
ideas, so I said I would ask... what follows is a lot of detail ...
The application is rather a peculiar design: The application puts up a
form, the user fills it in, the application then opens a hidden
instance of Word and uses Word's spelling checker to check what the
user has typed. When there are no spelling errors, the application
closes Word and goes about processing the result.
Word is being called via the COM interface. A new, hidden instance of
Word is created for each form the user wants to submit. Word is
running on the user's desktop, installed locally, with the user's
default settings. Interestingly, once it has a handle to the instance
of Word, the application then passes individual words to the
CheckSpelling method, waiting for a result (True if the word is
correctly spelled, false if it isn't) before sending the next word. If
the result is false, the application puts up a Change/Add/Ignore
dialog and feeds the result back to the user's custom dictionary.
This application was designed around Windows NT4/Word 97, and has been
running without problems since then. Until the latest desktop upgrade
which took the users up to Windows XP SP2 and Office 2003 SP1. After
the upgrade, it's returning exception errors. Very rarely: say once
every 50 or a hundred forms processed.
The only languages installed on the desktop are English AUS and
English US. The default language should be English AUS. No
"documents" are involved: the spelling checker is being passed CSTRING
strings.
The error being returned is simply "The server threw an exception". No
error number comes back: the error is returned as text.
Any given user may run up to three weeks without getting the error.
Some users have never had it. For one user who did get the error,
they created a new user profile, effectively eliminating problems with
the Word data key, the Proofing Tools key and the Custom dictionary.
The error seems to occur just as readily regardless of what else is
running or not running on the user's machine (the standard desktop is
a Dell Pentium 4 with 512 MB of memory). It has occurred with Outlook
being the only other application running.
The text being checked has no effect: the error will occur, the user
will discard the form and start again and the form will complete
correctly the next time. Text that has produced the error will not
produce the error on the next several tries with the same user and
machine. Once the error has occurred, it will occur for every word
checked until the user discards the form (which destroys the
associated instance of Word).
So, my first question is:
* "What KIND of exception is this likely to be?" We have no
information on that: is in out of memory? Suffering a contention?
Deadlocking a file? Any clue would help...
* "How do we know what language is in use?" There is no way
documented to specify the language across the COM interface, other
than to specify the path to the main dictionary, and that is being
left to default. The only specification being sent along with the
string to be spelled is the IgnoreUpperCase instruction.
* "Is the 'Detect Language Automatically' setting enabled or not when
the spelling checker is being called via COM?"
* "When calling the 'CheckSpelling method via winword.exe and COM,
does this start a new instance of the spelling checker process, or
does it use the common instance that serves the rest of the running
office applications?" If it is a separate instance, can we find the
process and insert a debug check to see what it is doing?
* When you instantiate a hidden instance of winword.exe via COM, does
Word load the global template and add-ins? The company has some
global templates, and some of them have spelling macros.
Thanks for your patience: any clues at all would be gratefully
received
--
Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.
John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 4 1209 1410
Windows XP SP2/Word 2003 SP1
I have a customer with a conundrum. They have an application written
in C++ that is calling the Word spelling checker via COM. It is very
intermittently returning the error "The server threw an exception." If
you can give me a clue where to look or what to try, I would be most
grateful. Sorry: I am not a C++ developer, and they have run out of
ideas, so I said I would ask... what follows is a lot of detail ...
The application is rather a peculiar design: The application puts up a
form, the user fills it in, the application then opens a hidden
instance of Word and uses Word's spelling checker to check what the
user has typed. When there are no spelling errors, the application
closes Word and goes about processing the result.
Word is being called via the COM interface. A new, hidden instance of
Word is created for each form the user wants to submit. Word is
running on the user's desktop, installed locally, with the user's
default settings. Interestingly, once it has a handle to the instance
of Word, the application then passes individual words to the
CheckSpelling method, waiting for a result (True if the word is
correctly spelled, false if it isn't) before sending the next word. If
the result is false, the application puts up a Change/Add/Ignore
dialog and feeds the result back to the user's custom dictionary.
This application was designed around Windows NT4/Word 97, and has been
running without problems since then. Until the latest desktop upgrade
which took the users up to Windows XP SP2 and Office 2003 SP1. After
the upgrade, it's returning exception errors. Very rarely: say once
every 50 or a hundred forms processed.
The only languages installed on the desktop are English AUS and
English US. The default language should be English AUS. No
"documents" are involved: the spelling checker is being passed CSTRING
strings.
The error being returned is simply "The server threw an exception". No
error number comes back: the error is returned as text.
Any given user may run up to three weeks without getting the error.
Some users have never had it. For one user who did get the error,
they created a new user profile, effectively eliminating problems with
the Word data key, the Proofing Tools key and the Custom dictionary.
The error seems to occur just as readily regardless of what else is
running or not running on the user's machine (the standard desktop is
a Dell Pentium 4 with 512 MB of memory). It has occurred with Outlook
being the only other application running.
The text being checked has no effect: the error will occur, the user
will discard the form and start again and the form will complete
correctly the next time. Text that has produced the error will not
produce the error on the next several tries with the same user and
machine. Once the error has occurred, it will occur for every word
checked until the user discards the form (which destroys the
associated instance of Word).
So, my first question is:
* "What KIND of exception is this likely to be?" We have no
information on that: is in out of memory? Suffering a contention?
Deadlocking a file? Any clue would help...
* "How do we know what language is in use?" There is no way
documented to specify the language across the COM interface, other
than to specify the path to the main dictionary, and that is being
left to default. The only specification being sent along with the
string to be spelled is the IgnoreUpperCase instruction.
* "Is the 'Detect Language Automatically' setting enabled or not when
the spelling checker is being called via COM?"
* "When calling the 'CheckSpelling method via winword.exe and COM,
does this start a new instance of the spelling checker process, or
does it use the common instance that serves the rest of the running
office applications?" If it is a separate instance, can we find the
process and insert a debug check to see what it is doing?
* When you instantiate a hidden instance of winword.exe via COM, does
Word load the global template and add-ins? The company has some
global templates, and some of them have spelling macros.
Thanks for your patience: any clues at all would be gratefully
received
--
Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.
John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 4 1209 1410