'=========================================================================== ' Subject: DETERMINE WINDOWS STARTUP MODE Date: 02-12-99 (16:57) ' Author: Unknown Source Code: VBWIN ' Origin: CapeCanaveral/Lab/1961/ Packet: VBWIN.ABC '=========================================================================== How to Determine Windows Startup Mode Applies to: VB4-32 VB5 With appropriate 16-bit API declarations (untested), this code may also apply to: VB3 VB4-16 under Windows95 A simple API call to determine if Windows is currently running in Normal mode, Safe Mode, or Safe Mode with Network Support. Option Explicit Public Declare Function GetSystemMetrics Lib "user32" _ (ByVal nIndex As Long) As Long Public Const SM_CLEANBOOT = 67 On a form, add a command button and a label. Add the following code to the form: Private Sub Command1_Click() Select Case GetSystemMetrics(SM_CLEANBOOT) Case 1: Label1 = "The system was started in Safe Mode." Case 2: Label1 = "The system was started in Safe Mode with Network support." Case Else: Label1 = "Windows is running normally." End Select End Sub Comments SM_CLEANBOOT is not documented in the VB4 API viewer. The valid return values for SM_CLEANBOOT are 0 (normal), 1 and 2.