hsifelbmur wrote:
Our software launches a variety of applications and prints documents
using shellExecute and the printto verb. Occasionally, a program will
get stuck and will not be able to print, requiring user intervention.
Unfortunately, our program is a server program.
Is there a way to recognize that software is waiting for user
intervention so that we can at least alert the user and kill the
process?
There's not any especially nice way that I know of, since this involves
predicting what the program will do, but some simple approaches are:
* Set some fixed timeout value after which the alert is given and the
process is killed.
* Import the Win32 API function FindWindow at the following URL with
DllImport and use it to look for an open dialog with a title indicating a
printer error.
http://msdn.microsoft.com/library/de...findwindow.asp
* Try to test the printer's status from your own app. If it doesn't report
having printed the desired document, or it's down or not responding, and
the app times out, you can be reasonably confident something is up.
* Try sending user input to the app and seeing how it responds using basic
automation. This might help you establish its state.
The best possible way to do this would be to somehow obtain a programmatic
interface, or at least a command-line interface, to the needed application
functionality so that you can execute desired commands and get appropriate
errors back. This may not be an option in your case, but look around and
see if you can find anything.
--
Derrick Coetzee, MCP, MSFT (Speech Server)
This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included code samples are subject to the terms
specified at
http://www.microsoft.com/info/cpyright.htm