新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Const SM_CLEANBOOT = 67
Private Sub Command1_Click()
    Select Case GetSystemMetrics(SM_CLEANBOOT)
    Case 1
        MsgBox "安全模式."
    Case 2
        MsgBox "支持网络的安全模式."
    Case Else
        MsgBox "Windows运行在普通模式"
    End Select
End Sub