CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Posts
    37

    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.

  2. #2
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

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

    Im affraid that this is impossible. Having thread which cannot be killed by OS is nonsenc. It means, that your app would like to become more powerfull than the OS itself.

    Only solution I can image now is to have separate processes, running under another account, which would control you forms. For example a windows service running under "Local System" account or any like this. Than there is good chance, that users won't be able to kill it.
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

  3. #3
    Join Date
    May 2003
    Location
    Germany
    Posts
    936

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

    You can also build a ApplicationLoader which contains the login mechanism. If the login is successful finished it loads the real application in a new AppDomain and after the real application is started the application loader finish. If the user try to start the application you can prevent it by several ways. For instance the real application could awaiting a secret from the loader. If the secret will not be passed the application do not start. I think this is more possible then trying to control threads which is impossible because like boudino said the OS is the one and only thing which can doing this.
    Useful or not? Rate my posting. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured