[DEFINE]
#If SetIsMinWindowsXP Then
  Public IsMinWindowsXP As Boolean
  #End If
#If SetIsMinWindows2000W Then
  Public IsMinWindows2000W As Boolean
  #End If
#If SetIsMinWindows982000 Then
  Public IsMinWindows982000 As Boolean
  #End If

[CODE]
#If LoadResEx_Icon_Shared Then
Public Function OSVersionDependent(Optional ByVal MaxIconSupport As Long = 0&) As Boolean
#Else
Public Function OSVersionDependent() As Boolean
#End If
  #If XPTheme_DefControls Or LoadResEx_Icon_Shared Or DoEventsEx_Sleep Or SetIsMinWindowsXP Then
    Dim xLong1 As Long
    #End If
  #If LoadResEx_Icon_Shared Or DoEventsEx_Sleep Or SetIsMinWindowsXP Or SetIsMinWindows2000W Or SetIsMinWindows982000 Or XPTheme_DefControls Then
    Dim Major As Long
    Dim Minor As Long
    #If Unicode Then
      #Else
      Dim IsUnicode As Boolean
      #End If
    #End If

  #If LoadResEx_Icon_Shared Or DoEventsEx_Sleep Or SetIsMinWindowsXP Or SetIsMinWindows2000W Or XPTheme_DefControls Then
    xLong1 = GetVersion
    IsUnicode = ((xLong1 And &H80000000) = 0&)
    #ElseIf Unicode Then
    IsUnicode = ((GetVersion And &H80000000) = 0&)
    #End If
      
  #If LoadResEx_Icon_Shared Or DoEventsEx_Sleep Or SetIsMinWindowsXP Or SetIsMinWindows2000W Or SetIsMinWindows982000 Or XPTheme_DefControls Then
    Major = (xLong1 And &HFF&)
    Minor = (xLong1 And &HFF00&) \ &H100&
    #If SetIsMinWindowsXP Then
      IsMinWindowsXP = IsUnicode And ((Major > 5&) Or ((Major = 5&) And (Minor >= 1&)))
      #If XPTheme_DefControls Then
        If IsMinWindowsXP Then
          xLong1 = LoadLibraryA("shell32.dll")
          Call InitCommonControls
          Call FreeLibrary(xLong1)
          End If
        #End If
      #Else
      #If XPTheme_DefControls Then
        If IsUnicode And ((Major > 5&) Or ((Major = 5&) And (Minor >= 1&))) Then
          xLong1 = LoadLibraryA("shell32.dll")
          Call InitCommonControls
          Call FreeLibrary(xLong1)
          End If
        #End If
      #End If
    #If SetIsMinWindows2000W Then
      IsMinWindows2000W = IsUnicode And (Major >= 5&)
      #End If
    #If SetIsMinWindows982000 Then
      IsMinWindows982000 = (Major > 4& Or (Major = 4 And Minor >= 10))
      #End If

    #If DoEventsEx_Sleep Then
      DoEventsEx_Sleep_WaitableTimers = (IsUnicode Or (Major > 4&) Or ((Major = 4&) And (Minor >= 10&)))
      #End If
    #If LoadResEx_Icon_Shared Then
      xLong1 = GetDC(0&)
      If Not xLong1 = 0& Then
        LoadResEx_IsHighColor = (GetDeviceCaps(xLong1, 12&) > 15&)
        Call ReleaseDC(0&, xLong1)
        If MaxIconSupport > 0& Then
          xLong1 = GetVersion
          If IsUnicode Then
            'nt series; '2003=5.2=xp like icons
            'If Major > 5& Or Major = 5& And Minor > 1& Then
            If Major > 5& Then
              If LoadResEx_IsHighColor Then
                LoadResex_Caps_WinDIcon = LoadResEx_IconOS_WinVista
                Else
                LoadResex_Caps_WinDIcon = LoadResEx_IconOS_Win2000ME_16Color 'LoadResEx_IconOS_WinVista_16Color
                End If
              LoadResex_Caps_TrayIcon = LoadResex_Caps_WinDIcon
              ElseIf Major = 5& Then
              If Minor >= 1& Then
                If LoadResEx_IsHighColor Then
                  LoadResex_Caps_WinDIcon = LoadResEx_IconOS_WinXP
                  Else
                  LoadResex_Caps_WinDIcon = LoadResEx_IconOS_Win2000ME_16Color
                  End If
                LoadResex_Caps_TrayIcon = LoadResex_Caps_WinDIcon
                Else
                If LoadResEx_IsHighColor Then
                  LoadResex_Caps_WinDIcon = LoadResEx_IconOS_Win2000ME
                  Else
                  LoadResex_Caps_WinDIcon = LoadResEx_IconOS_Win2000ME_16Color
                  End If
                LoadResex_Caps_TrayIcon = LoadResEx_IconOS_Win2000ME_16Color
                End If
              Else
              If LoadResEx_IsHighColor Then
                LoadResex_Caps_WinDIcon = LoadResEx_IconOS_WinNT
                'Else
                'LoadResex_Caps_WinDIcon = LoadResEx_IconOS_Win95_16Color
                End If
              'LoadResex_Caps_TrayIcon = LoadResEx_IconOS_Win95_16Color
              End If
            Else
            If Major > 4& Or Major = 4& And Minor >= 90& Then
              If LoadResEx_IsHighColor Then
                LoadResex_Caps_WinDIcon = LoadResEx_IconOS_Win2000ME
                Else
                LoadResex_Caps_WinDIcon = LoadResEx_IconOS_Win2000ME_16Color
                End If
              LoadResex_Caps_TrayIcon = LoadResex_Caps_WinDIcon
              ElseIf Major = 4& And Minor >= 10& Then
              If LoadResEx_IsHighColor Then
                LoadResex_Caps_WinDIcon = LoadResEx_IconOS_Win98
                'Else
                'LoadResex_Caps_WinDIcon = LoadResEx_IconOS_Win95_16Color
                End If
              'LoadResex_Caps_TrayIcon = LoadResEx_IconOS_Win95_16Color
              Else
              If LoadResEx_IsHighColor Then
                LoadResex_Caps_WinDIcon = LoadResEx_IconOS_Win95
                'Else
                'LoadResex_Caps_WinDIcon = LoadResEx_IconOS_Win95_16Color
                End If
              'LoadResex_Caps_TrayIcon = LoadResEx_IconOS_Win95_16Color
              End If
            End If
          End If
        If LoadResex_Caps_WinDIcon > MaxIconSupport Then
          LoadResex_Caps_WinDIcon = MaxIconSupport
          If LoadResex_Caps_TrayIcon > MaxIconSupport Then LoadResex_Caps_TrayIcon = MaxIconSupport
          End If
        'If ForceHiColorTrayIcons Then LoadResex_Caps_TrayIcon = LoadResex_Caps_WinDIcon
        End If
      #End If
    #End If
  End Function
