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 If
End Sub
标签:Case,IsSystemRunInSafeMode,Function,操作系统,模式,VB6,lngRet,True From: https://blog.51cto.com/u_8260968/6007473