Windows'un hangi modda açıldığı öğrenmek için aşağıdaki kodu yazabiliriz ;
Kod:
[FONT=Arial]Option Explicit[/FONT]
[FONT=Arial]Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long[/FONT]
[FONT=Arial]Private Const SM_CLEANBOOT = 67[/FONT]
[FONT=Arial]Private Sub Command1_Click()[/FONT]
[FONT=Arial]Select Case GetSystemMetrics(SM_CLEANBOOT)[/FONT]
[FONT=Arial]Case 1: MsgBox "Safe Mode."[/FONT]
[FONT=Arial]Case 2: MsgBox "Safe Mode with Network support."[/FONT]
[FONT=Arial]Case Else: MsgBox "Windows is running normally."[/FONT]
[FONT=Arial]End Select[/FONT]
[FONT=Arial]End Sub[/FONT]
