467,146 Members | 1,008 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,146 developers. It's quick & easy.

Has somebody made a surveillance thread which doesn't die?

I have a log-in window application. When the user presses the cancel button
it kills another window by it's name and then it exits. The problem is that
if somebody kills the log-in window by terminating the process in the task
manager the other window is not killed.

One solution might be to have a surveillande thread which doesn't die when
the mother-thread dies, and can't be killed in the task manager. As soon as
the log-in window thread stops responding to surveillance messages it will
kill the other window and then exit.

Is this possible?

I've also tried to have a form which spawns another form, but in the Task
Manager there is only one entry (PasswordDialog.exe). If you kill this
process everything dies and the window which I want to kill when the log-in
window dies is not killed.

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200710/1

Oct 25 '07 #1
  • viewed: 1635
Share:
3 Replies
Don't understand why you need to go through this "killing the process"
business. If you've got a reference to the "other form", why not just close
it?
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"lagu2653 via DotNetMonster.com" wrote:
I have a log-in window application. When the user presses the cancel button
it kills another window by it's name and then it exits. The problem is that
if somebody kills the log-in window by terminating the process in the task
manager the other window is not killed.

One solution might be to have a surveillande thread which doesn't die when
the mother-thread dies, and can't be killed in the task manager. As soon as
the log-in window thread stops responding to surveillance messages it will
kill the other window and then exit.

Is this possible?

I've also tried to have a form which spawns another form, but in the Task
Manager there is only one entry (PasswordDialog.exe). If you kill this
process everything dies and the window which I want to kill when the log-in
window dies is not killed.

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200710/1

Oct 25 '07 #2
Hi,

If somebody kills your "manager" app from the task manager I think it
receive a signal and only if no response is receive the scheduler simply
kill it.
In any case if the process is forcibly terminated you have no opportunity
to do nothing and there is nothing you can do about.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"lagu2653 via DotNetMonster.com" <u27739@uwewrote in message
news:7a37e1b3ed787@uwe...
>I have a log-in window application. When the user presses the cancel button
it kills another window by it's name and then it exits. The problem is
that
if somebody kills the log-in window by terminating the process in the task
manager the other window is not killed.

One solution might be to have a surveillande thread which doesn't die when
the mother-thread dies, and can't be killed in the task manager. As soon
as
the log-in window thread stops responding to surveillance messages it will
kill the other window and then exit.

Is this possible?

I've also tried to have a form which spawns another form, but in the Task
Manager there is only one entry (PasswordDialog.exe). If you kill this
process everything dies and the window which I want to kill when the
log-in
window dies is not killed.

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200710/1

Oct 25 '07 #3
lagu2653 via DotNetMonster.com wrote:
I have a log-in window application. When the user presses the cancel button
it kills another window by it's name and then it exits. The problem is that
if somebody kills the log-in window by terminating the process in the task
manager the other window is not killed.

One solution might be to have a surveillande thread which doesn't die when
the mother-thread dies, and can't be killed in the task manager. As soon as
the log-in window thread stops responding to surveillance messages it will
kill the other window and then exit.

Is this possible?
Sure. Anything is possible, depending only on how much time you want to
put into it and how much of the OS you want to rewrite. :)

That said, your specific idea doesn't sound too hard. But I question
the need for a separate "surveillance" thread that can't be killed in
the task manager. There's no such thing in the OS (you can always stop
a process, and all threads exist within a process), so it would indeed
involve hacking the OS pretty severely to introduce that sort of thing.

IMHO, it would be better to just have the "other window" do the querying
of the login window. Have it send a message to the login window every
half-second or so, asking if it should close. The login window, if it
responds at all, will respond in the negative. That is, it will tell
the other window not to close.

If the user presses the cancel button OR if the login window process is
terminated, the login window simply won't respond to the query. In the
former case, the lack of a response will be by choice, in the latter by
necessity. Either way, the other window won't get a response and will
know to close itself.

Designing it this way means you only have to implement a single
behavior, rather than relying on multiple pieces of code implementing
different algorithms to work well together.

The whole thing sounds a bit house-of-cards-ish (why is this
functionality split into two different processes in the first place?),
but assuming you really want something that does what you're talking
about, I see no need to add yet another process to the mix.

Pete
Oct 25 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Anto | last post: by
51 posts views Thread by Hans | last post: by
2 posts views Thread by paeh | last post: by
reply views Thread by Rambaldi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.