ToggleProcessProtection Method
Enables or disables termination protection for the application.
Syntax
public boolean toggleProcessProtection(boolean enabled);
Remarks
This method controls the termination protection mechanism, which applications can enable to prevent their process and threads from being terminated. If successful, this method returns true; otherwise, it returns false.
The Enabled parameter specifies whether termination protection should be enabled (true) or disabled (false); it is disabled by default. If termination protection is enabled, an application must disable it before attempting to exit.
Important: When developing a GUI-based application, please keep in mind that the termination protection mechanism does not intercept window notifications like WM_CLOSE, WM_QUIT, etc.; applications must intercept and handle such messages themselves if they wish to protect their UI. Please refer to Microsoft's Window Notifications articles for more information.