How to determine Windows startup mode
A simple API call to determine if Windows is currently running in Normal mode, Safe
Mode, or Safe Mode with Network Support.
Add the following code to the delarations section of a module
Public Declare Function GetSystemMetrics Lib "user32" _
(ByVal nIndex As Long) As Long
Public Const SM_CLEANBOOT = 67
following code to the form containing a label and a command
Select Case GetSystemMetrics(SM_CLEANBOOT)
Case 1: Label1 = "Safe Mode."
Case 2: Label1 = "Safe Mode with Network support."
Case Else: Label1 = "Windows is running normally."
The constant SM_CLEANBOOT is not documented in the VB4 or VB5 API viewers. Valid return
values for SM_CLEANBOOT are 0 (normal), 1 and 2.