How to write a program that stops the completion process using C?

Programs such as Notepad can stop the process of shutting down your computer when files are not saved. How can I write a program that stops the shutdown process (in C)?

+4
source share
1 answer

For Windows Vista and above, there is a fuction function defined in User32.dll (User32.lib) called "ShutdownBlockReasonCreate".
It takes two parameters:
- Window handle
- A string representing the displayed message
If the call succeeds, than the application will block the closing of windows.

This is a powerful feature and should not be abused!

+1
source

All Articles