J
Jerry Camel
Any insight here is greatly appreciated... (Eveything is in VB .NET)
Here's the baisc app flow:
-------------------------------------
Launch wrapper.exe:
wrapper.exe registers for the SessionEnding system event
wrapper.exe stores a pointer to its thread in MainThread
wrapper.exe declares, withevents, a process variable: np
wrapper.exe does some basic maintenance
wrapper.exe populates np with process info and sets
fp.EnableRaisingEvents to True
wrapper.exe launches fp
wrapper.exe suspends its thread <- Waiting for fp exit
wrapper.exe does some basic maintenance
Exit wrapper.exe
SessionEnding Handler: (User is logging off or shutting down without
exiting fp)
force fp to exit
End Handler
fp Exit Handler: (fp has exited either via user interaction or the
SessionEnding Handler)
resume MainThread
End Handler
------------------------------------
If the user exits fp then everythign works just fine. If the user tries to
shutdown or logoff while fp is still running, then my SessionEnding handler
never gets called. The message just waits in the queue and fp is never
forced to exit and the user gets a dialog box claiming that some .NET
process isn't ending. (This is the typical dialog seen when a process
doesn't play nice at shutdown.) While that dialog is on the screen, if the
user then shuts down fp, my code will continue to run.
So, here's the basic question. Why does the ExitHandler run while the
MainThread is suspended, but the SessionEnding Handler does not? (If you
need more info to provide some advice, please let me know...)
Thanks.
Jerry
Here's the baisc app flow:
-------------------------------------
Launch wrapper.exe:
wrapper.exe registers for the SessionEnding system event
wrapper.exe stores a pointer to its thread in MainThread
wrapper.exe declares, withevents, a process variable: np
wrapper.exe does some basic maintenance
wrapper.exe populates np with process info and sets
fp.EnableRaisingEvents to True
wrapper.exe launches fp
wrapper.exe suspends its thread <- Waiting for fp exit
wrapper.exe does some basic maintenance
Exit wrapper.exe
SessionEnding Handler: (User is logging off or shutting down without
exiting fp)
force fp to exit
End Handler
fp Exit Handler: (fp has exited either via user interaction or the
SessionEnding Handler)
resume MainThread
End Handler
------------------------------------
If the user exits fp then everythign works just fine. If the user tries to
shutdown or logoff while fp is still running, then my SessionEnding handler
never gets called. The message just waits in the queue and fp is never
forced to exit and the user gets a dialog box claiming that some .NET
process isn't ending. (This is the typical dialog seen when a process
doesn't play nice at shutdown.) While that dialog is on the screen, if the
user then shuts down fp, my code will continue to run.
So, here's the basic question. Why does the ExitHandler run while the
MainThread is suspended, but the SessionEnding Handler does not? (If you
need more info to provide some advice, please let me know...)
Thanks.
Jerry