If there is a program that is currently running, what code should I insert to detect (?) it when the system shuts down and prevent it from shutting down?

Asked 2 years ago, Updated 2 years ago, 27 views

Every day, at 9 p.m., I'm working on a Python program You have registered with the startup program in Windows 8.1.

However, if you shut down your computer before 9 o'clock, the program will not run.

To prevent this situation, if a computer user tries to shut down the computer without knowing it, It detects the shutdown status (click on the shutdown button) and informs you that there is an ongoing program I'd like to ask you if you want to shut down your computer.

I'm asking you a question because I don't know where to start.^

^

python interceptor

2022-09-20 21:44

1 Answers

If a logoff or shutdown event occurs in the window, you can receive a callback. You can receive callbacks by window message.

https://docs.microsoft.com/ko-kr/windows/win32/shutdown/wm-endsession?redirectedfrom=MSDN

In other words, if the window is logged off or requested to end, a WM_ENDSESSION message will be generated, so please process it when you receive the message.

Either you put a program that detects an end in the tray or you register it as a service (in this case, you cannot display a message).

I can ask you how to use Python.Although window programming is possible with Python because there is a win32 module, you need to have basic knowledge.

Parameters used by windows such as handles, message pumps, message handling, lparam, rparam...

It's quite possible to study, but it's not impossible, so try it.


2022-09-20 21:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.