Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Const SM_CLEANBOOT& = 67
Public Function IsSystemRunInSafeMode() As Boolean
Dim lngRet As Long
lngRet = GetSystemMetrics(SM_CLEANBOOT)
Select Case lngRet
Case 0 '普通模式
Case 1 '安全模式
IsSystemRunInSafeMode = True
Case 2 '带网络连接的安全模式
IsSystemRunInSafeMode = True
Case Else '获取状态失败
End Select
End Function
'测试Private Sub Command1_Click() If IsSystemRunInSafeMode() = True Then MsgBox "系统运行在安全模式" Else MsgBox "系统运行在普通模式" End IfEnd Sub
原文链接:https://www.f2er.com/vb/262888.html