Home > Blockchain >  Can I force a windows 10/11 program to be unresponsive?
Can I force a windows 10/11 program to be unresponsive?

Time:10-07

Is there anyway to set a program to be unresponsive in windows?

I have python code that starts a program. But when the program becomes unresponsive i want to do some specific clean up task.

But how do I test it. Because currently it is random. Is there a way to either make a small program that I can force to be unresponsive?

Or force a running program to be unresponsive.

CodePudding user response:

An "unresponsive" program is typically a GUI application that's blocked on it's main (UI) thread such that it hasn't pumped messages in a long time. That is, the UI feels "frozen" when you try to interact with it and/or the window doesn't seem to repaint itself as it should.

You can easily simulate this by creating a Windows Forms app in C# or Win32 GUI app in C using the default project templates in Visual Studio. Or basically any UI framework like Qt for that matter. Then introduce a very long sleep statement (several minutes) in response to a button click.

I don't think the "unresponsive" attribute applies to services, console applications, or background tasks.

CodePudding user response:

Use Alt Tab keyboard shortcut to bring your unresponsive program to the front, and then press Alt F4 keys at the same time to force the program to quit.

  • Related