Determine Windows Startup Mode

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Insert the following code to your module:

Public Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Public Const SM_CLEANBOOT = 67

'Insert the following code to your form:

Private Sub Form_Load()
Select Case GetSystemMetrics(SM_CLEANBOOT)
Case 1: MsgBox "Safe Mode."
Case 2: MsgBox "Safe Mode with Network support."
Case Else: MsgBox "Windows is running normally."
End Select
End Sub

Go Back