Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How do you write a program close every open application

  1. Sep 4, 2012 #1
    I am trying to make a program that locks a computer unless you have a password by systematically looping through and closing applications. It would also have a list of applications that the user is ok with having open, (for example a dock like rocket dock or a desktop tool like konfabulator or Rain meter). I know how to close individual processes in batch, but is their a way to only close things with a main window? If there is an easier way to achieve the same effect (such as if you can block all programs from ever opening) feel free to say that too. I am most familiar with batch, c++, java, and python, but if another language makes something easier, I am willing to try it.Thanks!
  2. jcsd
  3. Sep 6, 2012 #2


    User Avatar
    Science Advisor

    Hey rp.beltran and welcome to the forums.

    From what you are describing I guess you are talking about linux which I don't know too much about.

    But to answer your question, you should see if you can either a) hook the execution pipeline to load new executables or b) if you can register to get events on something being executed then you can either send a response to deny it (if you can) or to just shut it down yourself in your program.

    Personally, the idea of having this functionality is not a good thing. I really wouldn't want standard application developers to be able to do something like this, but those are two ideas.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook