How do you write a program close every open application

In summary, the conversation discusses the possibility of creating a program that locks a computer unless a password is entered. The program would systematically loop through and close applications, but also have a list of approved applications. The user is open to trying different languages to achieve this effect and is given suggestions on how to approach the task. The idea of having such a program is questioned, but two potential solutions are mentioned.
  • #1
rp.beltran
4
0
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!
 
Technology news on Phys.org
  • #2
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.
 

Related to How do you write a program close every open application

1. How do I close all open applications using a program?

To close all open applications using a program, you can either use a built-in task manager or a third-party program. The task manager can be accessed by pressing "Ctrl + Alt + Delete" on Windows or "Command + Option + Escape" on Mac. From there, you can select the applications you want to close and click "End task" or "Force quit". Some third-party programs also offer the functionality to close all open applications at once.

2. Can I create a shortcut to close all open applications?

Yes, you can create a shortcut to close all open applications on your computer. On Windows, you can right-click on your desktop, select "New", and then click "Shortcut". In the location field, type "taskkill /IM explorer.exe /F" and click "Next". Name the shortcut "Close All Applications" and click "Finish". On Mac, you can use Automator to create a similar shortcut. First, open Automator and select "Application" as the document type. Then, drag the "Quit All Applications" action into the workflow, save the application, and place it on your desktop for easy access.

3. Is there a way to automatically close open applications at a specific time?

Yes, you can use a program or script to automatically close open applications at a specific time. For example, on Windows, you can create a batch file with the "taskkill" command and use the Windows Task Scheduler to schedule it to run at a specific time. On Mac, you can use a similar approach with a shell script and the built-in Automator or a third-party program like CronniX.

4. Can I close specific applications without closing all open applications?

Yes, you can close specific applications without closing all open applications. This can be done using the task manager or a third-party program. In the task manager, you can select the specific applications you want to close and click "End task" or "Force quit". Some third-party programs also offer the functionality to close specific applications without affecting others.

5. How can I prevent certain applications from automatically opening when I start my computer?

To prevent certain applications from automatically opening when you start your computer, you can adjust your startup settings. On Windows, you can open the Task Manager, go to the "Startup" tab, and disable the applications you don't want to open on startup. On Mac, you can go to System Preferences, click on "Users & Groups", and select your username. Then, click on the "Login Items" tab and uncheck the applications you don't want to open on startup.

Similar threads

  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
8
Views
6K
  • Programming and Computer Science
Replies
14
Views
3K
  • Programming and Computer Science
Replies
5
Views
6K
  • Programming and Computer Science
Replies
7
Views
4K
  • Programming and Computer Science
Replies
4
Views
5K
  • STEM Academic Advising
Replies
5
Views
2K
  • Programming and Computer Science
Replies
9
Views
4K
  • Programming and Computer Science
Replies
5
Views
7K
Back
Top