Results 1 to 5 of 5

Thread: Detect if in Safe Mode

  1. #1
    j2k
    Guest

    Detect if in Safe Mode

    Is it possible to detect whether Windows is running in "Normal" mode or Safe Mode from within your VB app? Thanks.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Sure is. Try this:

    Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

    Private Const SM_CLEANBOOT = 67


    Select Case GetSystemMetrics(SM_CLEANBOOT)
    Case 0: MsgBox "Normal boot"
    Case 1: MsgBox "Safe Mode"
    Case 2: MsgBox "Safe Mode with network boot"
    End Select

  3. #3
    j2k
    Guest
    Great stuff! Thanks!

    Does that work for all OS's? I can only try it on Windows 98 and Me.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    As far as I know it does. If you run into something in which it doesn't work, let me know.

  5. #5
    j2k
    Guest
    Okay, thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width