Shut Down the System Safely

Category:
System/API
Type:
Modules
Difficulty:
Advanced
Author:
Sergey Merzlikin

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
Frequently there is a need for code which shuts down the without user participation. One way is to force a shutdown using the ExitWindowsEx API function with the EWX_FORCE flag, but in this case all applications are terminating by a method of "rough force", which may result in data loss.

This module provides code that attempts to close all applications safely without data loss before resorting to an ExitWindowsEx forced shutdown.

Included is a sample program and detailed documentation.


Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download shsystem.zip